By default, Linux distribution such as Redhat, CentOS, and Fedora will have IP Forwarding disabled. The need to forward IP packets from one source to another using linux as the default gateway or linux router, IP forwarding should be enabled from this considerations. There are several techniques to enable IP Forwarding.
Check IP Forwarding status
Type the following command
[root@lifelinux ~]# sysctl -l | grep ip_forward
Sample outputs
net.ipv4.ip_forward = 0
or checking out the value in the /proc system
[root@lifelinux ~]# cat /proc/sys/net/ipv4/ip_forward 0
If IP forwarding is disabled, a value of 0 would be displayed and if IP forwarding was recently enabled, linux should be displaying a numerical value of 1.
Enable IP Forwarding temporarily
Login as root and type the following command
[root@lifelinux ~]# echo 1 > /proc/sys/net/ipv4/ip_forward
The setting is changed instantly but this setting will be erased after the reboot.
Enable IP Forwarding permanently
Type the following command
[root@lifelinux ~]# vi /etc/sysctl.conf
Add the following line
net.ipv4.ip_forward = 1
To enable the changes made in sysctl.conf you will need to run the command
[root@lifelinux ~]# sysctl -p
Related Posts:
- How to disable ICMP echo responses in Linux
- How To Install Lighttpd And PHP (PHP-FPM) On CentOS 6
- How To Install Nginx And PHP-FPM On CentOS 6 Via Yum
- How Do I Disable The Ping Response On Linux?
- How To Install Nginx And PHP (PHP-FPM) On CentOS 6
- How To Increase The Number Of PTY (Pseudo-Terminal Driver)
- How To Increase PHP Memory Limit
- MySQL Slow Query Log File
- How To Install Rootkit Hunter
- How To Install ionCube Loader