Home > Linux HOWTOs > Ubuntu Server 10.04 LTS – NAT Router

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

Categories: Linux HOWTOs
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.