“IP forwarding” is a synonym for “routing.” It is called “kernel IP forwarding” because it is a feature of the Linux kernel.
By default any modern Linux distributions will have IP Forwarding disabled.IP forwarding is a process used to determine which path a packet or datagram can be sent. The process uses routing information to make decisions and is designed to send a packet over multiple networks.
iptablesprovides routing and forwarding policies that can be implemented to prevent abnormal usage of network resources.
Check if IP forwarding is enabled:
~]# sysctl net.ipv4.ip_forward net.ipv4.ip_forward = 0
or By Checking value in /proc/sys/net/ipv4/ip_forward
~]# cat /proc/sys/net/ipv4/ip_forward 0
Enable IP Forwarding:-
By default, the IPv4 policy in Red Hat Enterprise Linux kernels disables support for IP forwarding. This prevents machines that run Red Hat Enterprise Linux from functioning as dedicated edge routers. To enable IP forwarding, use the following command as the root user:-
~]# sysctl -w net.ipv4.ip_forward=1 net.ipv4.ip_forward = 1
This configuration change is only valid for the current session; the result will not be preserved after rebooting the system.
.To permanently set IP forwarding, add the line in /
etc/sysctl.conf file as follows:
~]# vim /etc/sysctl.conf net.ipv4.ip_forward = 1
To enable the changes made in sysctl.conf you will need to run the command as the root user:
-p /etc/sysctl.confnet.ipv4.ip_forward = 1