DNAT for two external NIC
I have Linux gateway/firewall with 3 NIC: eth0 – LAN, eth1 – ISP1, eth2 – ISP2.
I’ve got separate static IPs from each of the ISP (IP1 & IP2) which I statically assigned to eth1 and eth2.
My default route points to ISP1 gateway via eth1. I need to provide external access to a few computers on the LAN using different IPs and port numbers (no load balancing and target machines are IP-specific). Everything works fine if I use IP1 address but I was unable to get to the corresponding LAN machine through IP2. Ping requests are also not responded if they’re made to IP2. They do reach eth2 and I can see them using tcpdump but then nothing goes out on any NIC. The same goes for TCP/IP requests – I’ve managed to trace them to the nat table PREROUTING chain but they could not be found in either INPUT or FORWARD chain of the mangle table. If I make default route through eth2 – everything starts working through that NIC and stops through eth1. I seem to be missing something simple. Any help is greatly appreciated.
Mikhail.
Hello,
Quoted 8 lines · Mikhail
Everything works fine if I use IP1 address but I was unable to get to the
corresponding LAN machine through IP2. Ping requests are also not responded if they're made to IP2. They do reach eth2 and I can see them using tcpdump but then nothing goes out on any NIC. The same goes for TCP/IP requests - I've managed to trace them to the nat table PREROUTING chain but they could not be found in either INPUT or FORWARD chain of the mangle table. If I make default route through eth2 - everything starts working through that NIC and stops through eth1.
Maybe you need to disable rp_filter (reverse path filtering) on the interface that has not the default route.
sysctl -w net/ipv4/conf/eth2/rp_filter=0
$> echo "2 ISP2" >> /etc/iproute2/rt_tables
$> ip route add default via gatewayISP2 dev devISP2 table ISP2 $> ip rule add from IPISP2 lookup ISP2 prio 1000
$> ip route flush table cache
so ping will be ok on the ISP2, you will able to connect any services on your router throuht ISP2 but DNAT will only work with ISP1. I'm working on this problem. I think I will use Shorewall to so that automatically
Quoted 21 lines · Mikhail
I have Linux gateway/firewall with 3 NIC: eth0 – LAN, eth1 – ISP1, eth2 –
ISP2.
I’ve got separate static IPs from each of the ISP (IP1 & IP2) which I statically assigned to eth1 and eth2.
My default route points to ISP1 gateway via eth1. I need to provide external access to a few computers on the LAN using different IPs and port numbers (no load balancing and target machines are IP-specific).
Everything works fine if I use IP1 address but I was unable to get to the
corresponding LAN machine through IP2. Ping requests are also not responded if they’re made to IP2. They do reach eth2 and I can see them using tcpdump but then nothing goes out on any NIC. The same goes for TCP/IP requests – I’ve managed to trace them to the nat table PREROUTING chain but they could not be found in either INPUT or FORWARD chain of the mangle table. If I make default route through eth2 – everything starts working through that NIC and stops through eth1. I seem to be missing something simple. Any help is greatly appreciated.Mikhail.
Signature · 5 lines
* Florent GUILIANI - Développement Système* 41, avenue Jean Jaurès - 67100 STRASBOURG /Tel :/ 03.88.44.96.00 /- Fax :/ 03.88.44.96.29 /E-mail :/ [email protected] <mailto:[email protected]> /Site Web :/ http://www.perinfo.com