I'm setting up a router using Ubuntu 12.04. I need my router to route between our internet modem and my client's network, for which we're given one IP address.
The box has 3 interfaces:
- eth0 - port to client's network. Configured using static IP.
- eth1 - our LAN. Configured as static IP 192.168.1.1 and serving DHCP/DNS.
- eth2 - uplink to 3G router modem. Configured as DHCP client.
My /etc/network/interfaces looks like:
# The primary network interface auto eth2 iface eth2 inet dhcp # LAN point to our client's network auto eth0 iface eth0 inet static address 10.198.250.171 #gateway 10.198.0.4 netmask 255.255.0.0 network 10.198.0.0 broadcast 10.198.255.255 hwaddress ether 00:1E:EC:72:ED:92 # eth1 acts as our LAN's router IP 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
I've configured eth1 to serve as DHCP and configured NAT from my LAN to internet as follows in /etc/rc.local:
# IP forwarding script from our LAN to internet /sbin/iptables -P FORWARD ACCEPT /sbin/iptables --table nat -A POSTROUTING -o eth2 -j MASQUERADE
In order to access my client's LAN (which is a private class A network), I've configured a static route as follows:
up route add -net 10.0.0.0/8 gw 10.198.250.171 dev eth0
Thus far, I can ping and access my client's LAN from the router itself, but from any of my LAN clients, I cannot get the router to route to my client's LAN.
Can anybody advise what else I need to do? Do I need to set outbound NAT for both eth0 and eth2?
Any advice much appreciated.