Take the 2-minute tour ×
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 10.0.0.108/32 table 1 # outbound
ip rule add to 10.0.0.108/32 table 1   # inbound
ip route add default via 10.0.0.1 dev eth0 table 1
ip rule add from 10.0.0.100/32 table 2 # outbound
ip rule add to 10.0.0.100/32 table 2   # inbound
ip route add default via 10.0.0.1 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 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 10.0.0.108 eth0: 56(84) bytes of data.
From 10.0.0.108 icmp_seq=2 Destination Host Unreachable
From 10.0.0.108 icmp_seq=3 Destination Host Unreachable
From 10.0.0.108 icmp_seq=4 Destination Host Unreachable

$ ping -I eth1 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 10.0.0.28 eth1: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=48 time=14.6 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=48 time=14.6 ms
^C
--- 8.8.8.8 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 10.0.0.1 dev eth1 table 2 is prefered over default via 10.0.0.1 dev eth0 table 1) but using -I eth0 just replaces src IP of icmp packets (correct me if I'm not right). Also, does 10.0.0.1 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

 
discard

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.