Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Dec 12 '10 at 4:02

This question came from our site for professional and enthusiast programmers.

1  
This question doesn't belong on Stack Overflow –  Joel Coel Dec 12 '10 at 3:49

2 Answers 2

The "default route" is meaningless if you have setup your routes with "ip route" correctly. The difficulty comes from the fact that both eth0 and ppp0 are likely to be setup by DHCP, which will overwrite whatever you had setup.

You should give the output of "ip route show" for all the tables you have setup, as well as "ip rule show" and anything else you've done during setup.

BTW, the link you posted did not work for me, this one does

share|improve this answer

I have done this using CONNMARK, firewall marking, and multiple routing tables.

Works great even for PPP and DHCP interfaces.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.