Enabling IP forwarding allows to forward/pass ip packets through a linux machine. Its necessary when you configure linux system a Linux router/gateway. So if your linux system has two NIC cards, the IP packets received from one NIC will forward to the second NIC card.
This post is based on RPM based Distros like Redhat, CentOS, Fedora, etc.
Temporary enable ip packet forwarding
Change the value from "zero" to "one" in the file /proc/sys/net/ipv4/ip_forward
Default value will be Zero (ip forwarding disabled)
#run the below command to enable forwarding
[root@server ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
This post is based on RPM based Distros like Redhat, CentOS, Fedora, etc.
Temporary enable ip packet forwarding
Change the value from "zero" to "one" in the file /proc/sys/net/ipv4/ip_forward
Default value will be Zero (ip forwarding disabled)
#run the below command to enable forwarding
[root@server ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
Verify ip packet forwarding enabled (required output is "1")
[root@server ~]# cat /proc/sys/net/ipv4/ip_forward
1
Permenent ip packet forwarding configuration
[root@server ~]# vi /etc/sysctl.conf
# in the 7th line edit like below..(change value from "0" to "1" )
net.ipv4.ip_forward = 1
# save the file
Reboot machine to take effect
[root@server ~]# reboot
1
Permenent ip packet forwarding configuration
[root@server ~]# vi /etc/sysctl.conf
# in the 7th line edit like below..(change value from "0" to "1" )
net.ipv4.ip_forward = 1
# save the file
Reboot machine to take effect
[root@server ~]# reboot
1 comments:
You don't have to reboot. A minimum what you need is:
sysctl -p /etc/sysctl.conf
Alternatively you can restart the networking subsystem:
/etc/init.d/network restart
or in a modern fashion:
service network restart
Reboot will obviously do the job but this is not the Linux way.
Post a Comment