Debian Wheezy subnet configuration (proxy, MASQUARADing etc.)

connection-sharinginternetiptables

I have a "server" with eth1 having a full IP address, DNS, gateway and proxy name connected to the university internet/intranet provider and eth0 IP 192.168.1.2 connected by a gigabit switch with two "nodes" 192.168.1.3 and 192.168.1.4. All three running the latest full Debian Wheeze installation from DVD with all components available.

I have configured this subnet using "interfaces" file using only static IP addresses and netmask like this

iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0

with extra set of parameters for eth1 on "server" which is able to access internet through this card.

I can not arrange an internet access for the "nodes" through "server's" eth1 using iptables or any other tools available for look up on the Internet.
Any help with complete script example using iptables and/or additional features/lines to introduce to the interfaces files on two "nodes" taking into account all these proxy and fixed university ipadress configurations for the outer network on eth1?
SSH is working just fine on this subnet. My "server" can access Internet as well.

I'm reading this tutorial.

May be I misconfigured all these DHCP, NSF, NAT etc though I've never touched them directly and SSH is working just fine across this subnet.

Best Answer

Assuming that what you're looking for is to provide internal hosts to access the internet via your server:

First you need to set this box as the default gateway for the nodes.

Second you need to enable IP forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward

Third you need to masquerade (SNAT) the outgoing traffic from these hosts:

iptables -I POSTROUTING -o eth1 -j MASQUERADE

This should be all that you need.

Related Question