Welcome to the Linux Foundation Forum!

Routing between two networks that have duplicate IP addresses


On a linux box we have three network interfaces, they look like below

    | CentOS 6 Server
    | ---------> eth0 (DHCP (192.168.1.x) Default Gateway, connects to a wired internet, 
    |----------> eth2 (IP : ( GW to be used : (, connects to a network A
    |----------> eth3 (IP : ( GW to be used: (, connects to a network B

Problem here is that both network A and network B have nodes with same IP, example :

route-eth1 file looks like: via via

route-eth2 file looks like: via via

so pinging will always route it thru eth1 and not eth2 tried with application which binds with interface (asterisk PBX), incoming connection from above IP work fine, but any response to it is sent via eth1, hence rejected.

I tried source based routing but that wont ping past gateway

ip rule add from lookup net1
ip route add via  dev eth2 table net1

ip rule add from lookup net2
ip route add via dev eth3 table net2
# ip route show table net2 via dev eth3 

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

Any pointers how to resolve this?


Upcoming Training