Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I have two public IPs. One's connected to eth0 and one to eth1, from 2 separate routers as complete DMZ towards the LAN IP.

I added this following:

ip rule add from table 1 # outbound
ip rule add to table 1   # inbound
ip route add default via dev eth0 table 1
ip rule add from table 2 # outbound
ip rule add to table 2   # inbound
ip route add default via dev eth1 table 2

Since adding this above, I've been having problems sending traffic correctly for inbound and outbound.

For example:

$ ping -I eth0
PING ( from eth0: 56(84) bytes of data.
From icmp_seq=2 Destination Host Unreachable
From icmp_seq=3 Destination Host Unreachable
From icmp_seq=4 Destination Host Unreachable

$ ping -I eth1
PING ( from eth1: 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=48 time=14.6 ms
64 bytes from icmp_seq=2 ttl=48 time=14.6 ms
--- ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1233ms
rtt min/avg/max/mdev = 14.611/14.639/14.667/0.028 ms

How do I use ip rule add from/to method to fix the eth0 (from/to), but without breaking the eth1 (eth1 is working perfect).

share|improve this question

1 Answer 1

it seems you're routing all traffic through eth1 (default via dev eth1 table 2 is prefered over default via dev eth0 table 1) but using -I eth0 just replaces src IP of icmp packets (correct me if I'm not right). Also, does gateway exist in both networks?

I believe this LARTC article should definitely help you. Btw, it would be nice if you provide us with more network configuration detail.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.