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
iface eth2 inet dhcp
# LAN point to our client's network
iface eth0 inet static
hwaddress ether 00:1E:EC:72:ED:92
# eth1 acts as our LAN's router IP
iface eth1 inet static
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.