- Forums
- Networking
- How To Configure Linux As A Router
if you are setting your linux server as a router, there is one item you may need to adjust [3502], Last Updated: Mon Jun 24, 2024
Webune Support
Sun Feb 28, 2010
0 Comments
415 Visits
if you are setting your linux server as a router, there is one item you may need to adjust. normally, a linux system will not forward packets it receives from one system that are directed at another system. if linux is to act as a router, it has to accepts these packets and send them on to the destination network. to enable this feature in linux, you have to modify a key file in the /proc filesystem. for example, you would use this command:
echo "1" > /proc/sys/net/ipv4/ip_forward
this commands enables IP forwarding.
ok, so if you are the changes to be permanent, then you will have to edit the configuration file: /etc/sysctl.conf
so when you open the /etc/sysctl.conf set the following as:
net.ipv4.ip_forward = 1if you have a different distribution, you may have a different configuration file like /etc/sysconfig/sysctl and the line reads: IP_FORWARD
for example, if you have a REDHAT, FEDORA, CENTOS distribution you would use the /etc/sysctl.conf file and edit the line:
# Controls IP packet forwarding
net.ipv4.ip_forward = 1