Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of enabling IP forwarding on Linux

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how to enable IP forwarding on Linux. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

For security reasons, IP forwarding is disabled by default in modern Linux operating systems. If you need to enable IP forwarding on the system, perform the following steps. In this article, you will learn how to check if IP forwarding is enabled. If not, how to enable it.

Check current IP forwarding

Use the following command to check the value of the ip_forward in/proc file system.

$cat / proc/sys/net/ipv4/ip_forward0

Or we can use the sysctl command line to query kernel values, such as the following command.

$sudo sysctl net.ipv4.ip_forwardnet.ipv4.ip_forward = 0

Enable kernel IP forwarding

Let's enable IP forwarding for the active shell of the current Linux system. These changes are lost when the system is shut down or rebooted.

$echo 1 > / proc/sys/net/ipv4/ip_forward

Or, we can use sysctl to enable it

$sysctl-w net.ipv4.ip_forward=1

Enable kernel IP forwarding (permanent)

To enable IP forwarding, permanently edit / etc/sysctl.conf and add the following line. This enables IP forwarding, even after a system reboot.

Net.ipv4.ip_forward = 1

After adding the above values to sysctl.conf, reload the values of this file using the following command.

$sysctl-p Thank you for your reading! So much for the method of enabling IP forwarding on Linux. I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report