2

I have a server running ubuntu 10.04 with four interfaces. eth0 and eth1 have static WAN ip's, and eth2 and eth3 are connected to two separate NAT networks 192.168.0.0/24 and 192.168.1.0/24 respectively. eth0 is masqueraded and NAT traffic from eth2 is forwarded to it. In order to forward eth3 traffic to eth1 I have used these rules:

ip route add xxx.xxx.xxx.176/29 dev eth1 src xxx.xxx.xxx.180 table link2
ip route add default via xxx.xxx.xxx.178 dev eth1 table link2

ip route add xxx.xxx.xxx.176/29 dev eth1 src xxx.xxx.xxx.180

ip rule add from xxx.xxx.xxx.180/32 table link2
ip rule add iif eth3 lookup link2

ip route add 192.168.1.0/24 dev eth3 table link2

This setup is working fine. eth1 is masqueraded and NAT traffic from eth3 is forwarded to it. But I feel some rules above are redundant, and there must be a simpler way of achieving it. Are there any better ways of doing it?

nixnotwin
  • 1,543
  • 5
  • 35
  • 55

0 Answers0