This howto guide outlines the steps to enable IP forwarding on Ubuntu 13.04. This is required if you want your system to act as a router.
Check the current setting:
$ sysctl net.ipv4.ip_forward
This should output a 0 or a 1 depending on if it is already enabled or not.
eg: the following shows where ip forwarding is disabled
$ sysctl net.ipv4.ip_forward net.ipv4.ip_forward = 0
Enable the kernel option for IP forwarding:
$ sudo sysctl net.ipv4.ip_forward=1
$ sudo sysctl net.ipv4.ip_forward=1 net.ipv4.ip_forward = 1
To make these changes perminant across reboots:
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
Your Ubuntui 13.04 system will now have IP forwarding enabled. Make sure your iptables rules are set up correctly to prevent possible abuse.