Enable IP Forwarding on Ubuntu

Edit the /etc/sysctl.conf file:

$ sudo nano /etc/sysctl.conf 

Find the following text:

# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1

Uncomment the net.ipv4.ip_forward=1 line:

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
Save and exit the file.

Run sysctl -p to make the changes take effect immediatly:

$ sudo sysctl -p

 

$ sudo sysctl -p
net.ipv4.ip_forward = 1