User Tools

Site Tools


ubuntu:networking:configuration:ip_forwarding

Ubuntu - Networking - Configuration - IP Forwarding

IP forwarding is the ability for an operating system to accept incoming network packets on one interface, recognize that it is not meant for the system itself, but that it should be passed on to another network, and then forwards it accordingly.


Enable Port Forwarding Permanantly

Uncomment or add this line to /etc/sysctl.conf:

/etc/sysctl.conf
net.ipv4.ip_forward=1

To enable the changes made in sysctl.conf, run:

sysctl -p

Enable IP Forwarding on the fly

To enable IP Forwarding, without rebooting the system:

sysctl -w net.ipv4.ip_forward=1

or

echo 1 > /proc/sys/net/ipv4/ip_forward

NOTE: The setting is changed instantly.

  • However the result will not be preserved after rebooting the system.

Check if Port Forwarding is Enabled

cat /proc/sys/net/ipv4/ip_forward

returns:

1

NOTE:

  • 0: Port forwarding is not enabled.
  • 1: Port forwarding is enabled.
ubuntu/networking/configuration/ip_forwarding.txt · Last modified: 2021/07/26 12:19 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki