Currently, I have 3 NICs on a server, 1 connects to a adsl modem(eth0), another connects to a optical fiber(ppp0) and the other to a LAN(eth2).
I've set up all the interfaces, routes and rules as described here (http://www.linux.org/PRIVOXY-FORCE/docs/ldp/howto/Adv-Routing-HOWTO/lartc.rpdb.multiple-links.html), and it works perfectly. I can connect externally to both hosts without any problems, but I'm facing another problem now...
I can only do NAT on the host that I've set up as the default route on the main table. For example, if I use these rules:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.2:8080
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.2:8080
It works depending on the default route. If the default route is via eth0, incoming connections from ppp0 do not get redirected to the LAN machine. Also, if the default route is via ppp0, connections from eth0 will not be redirected. I have a table for each provider with the gateway configured as default route, but it doesn't seem to work for NAT.
Does anyone have an idea to fix this issue?