Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here is my current setup (all servers are Ubuntu Server Edition 12.04):

Server 0 has two devices, eth0 and eth1. eth0 is connected to the wall (the internet), and eth1 is connected to a switch. eth1 has the following entry in /etc/network/interfaces:

auto eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

Servers 1-4 each have one device, eth0. They are all connected to the switch, and they all obtain their DHCP information from Server 0. eth0 has the following interfaces entry (This is because Servers 1-4 are diskless nodes that ask Server 0 for everything needed to boot):

iface eth0 inet manual

With this configuration, Server 0 is the only server that has access to the internet. How would I go about routing any web request (such as apt-get or HTTP) from Servers 1-4 through Server 0 in order to give Servers 1-4 internet access? This seems like a problem that has been encountered many times, but I cannot for the life of me figure out how to set up the network properly.

The output of route -n is:

Destination    Gateway         Genmask         Flags ... Iface
0.0.0.0        123.45.132.254  0.0.0.0         UG    ... eth0
123.45.132.0   0.0.0.0         255.255.255.0   U     ... eth0
192.168.1.0    0.0.0.0         255.255.255.0   U     ... eth1
share|improve this question

1 Answer 1

You need to put two things : activating the forwarding (in /etc/sysctl.conf net.ipv4.ip_forward=1) and activate the NAT with iptables (/sbin/iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE). The NAT translate the private network to the external IP, so the internal machines can go on Internet. This line should be applied by your firewall. I don't know which firewall you have, so you must integrate it in your configuration.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.