Ubuntu Server 10.04 LTS – NAT Router
How to share your internet connection with NAT to all or some of the computers on the same LAN.
In other words: “I want to make my old pc a hardware firewall and/or router which works flawlessly (depending on the hardware ;))
And maybe share some multimedia on the network later. How do i do that?”
note: uncomment means to remove the # sign in the beginning of the line
Let’s say /dev/eth1 is the interface used for WAN and /dev/eth0 is the LAN interface of your machine.
- So we’ll edit/add some entries to iptables:
vi /etc/sysctl.conf
- uncomment the following lines
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
- Next
vi /etc/rc.local
Add the following lines before exit0
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables –table nat -A POSTROUTING -0 eth1 -j MASQUERADE