IP forwarding is the process of forwarding packets from one network interface to another based on their destination IP addresses. This can be useful, for example, to enable a Linux system to act as a router or to allow multiple network interfaces on a system to access the Internet.
To enable IP forwarding on a CentOS or Red Hat Linux system, you can use the following steps:
/etc/sysctl.conf
file: Open the /etc/sysctl.conf
file in a text editor and find the following line:# net.ipv4.ip_forward = 0
1
: Remove the #
character at the beginning of the line and set the value to 1
:net.ipv4.ip_forward = 1
This will enable IP forwarding.
/etc/sysctl.conf
file and exit the text editor. Then, apply the changes by running the following command:sysctl -p
This will apply the changes to the kernel parameters and enable IP forwarding.
Keep in mind that you will need to have root privileges (or be a member of the sudo
group) in order to edit the /etc/sysctl.conf
file and apply the changes.