I'm trying to configure a linux pc-router that must deal with routing and using NAT to provide connectivity to an internal network (it's also the DHCP server and firewall). In the external side the computer has 2 interfaces with 2 cablemodem connected (it gets public IP in both via DHCP).
The scenario looks like this: http://img810.imageshack.us/img810/411/filer.jpg
Considering the dynamic role of the external interfaces I'll have to add some scripts to /etc/network/if-up.d and /etc/network/if-down.d in order to establish the right values, but right now I just want to make sure that it works.
So, for the basic config I'm using this: http://pastebin.com/raw.php?i=tvSj0d5S
In the tests I've done one of the computers can connect to internet, but the other can not. By sniffing with wireshark I've seen how the non working PC sends its packets, the router redirects them after applying NAT and the responses do arrive to the router again, but the NAT is not "undone", and the PC never receives them. On the opposite the other PC works perfectly. Of course I have 2 default gateways (one per provider) that do appear by showing the route list (route -n).
Assuming that both external interfaces have well known addresses and gateways (I'm allways getting the same addresses, so for the test it should work in the same way) what is failing here? Should I use the SNAT target instead of the MASQUERADE one? should I use the "route from" feature of iproute2 instead of fwmark?
Thanks in advance and regards
ip route show table all
?