First, I don't understand why you have each subnet listed twice in the routing tables above. Moreover, you are using /16 subnet masks when I suspect you really want /24's (i.e., a netmask of 255.255.255.0). Linux will automatically set up routes to the various networks when the interfaces come up. You shouldn't need to declare any of them manually except the default gateway, 10.0.2.1.
Code:
route add default gw 10.0.2.1
should be all it takes. That may also happen automatically based on the gateway parameter in the interfaces file.
If you want to forward all default traffic out to the Internet, you'll need a masquerading rule using iptables. Something like:
Code:
sudo iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 10.0.2.154
That tells the kernel that all packets going out to the default gateway via eth0 should be rewritten with the source address assigned to eth0, 10.0.2.154. The kernel will keep track making sure return packets are routed back to their original source IPs.
Bookmarks