Time for action – enabling IP forwarding
- To enable IP forwarding on Linux-based operating systems, we can use any of the following methods.
Using the
sysctl
command:sysctl -w net.ipv4.ip_forward=1
This method doesn't need a reboot and will enable IP forwarding on the fly but will not be preserved after a reboot.
Using the
sysctl
configuration file, we can add the following line in the/etc/sysctl.conf
file:net.ipv4.ip_forward = 1
- To enable the changes made to the
/etc/sysctl.conf
file, we need to run the following command:sysctl -p /etc/sysctl.conf
These changes will be preserved after a reboot.
- Enabling IP forwarding on BSD operating systems is almost similar. We can use any of the following methods:
Using the
sysctl
command.sysctl -w net.inet.ip.forwarding=1 ...
Get Squid Proxy Server 3.1 Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.