Routing between two networks that have duplicate IP addresses
by theprofoundgeek from LinuxQuestions.org on (#5GGD2)
On a linux box we have three network interfaces, they look like below
Code: | CentOS 6 Server
| ---------> eth0 (DHCP (192.168.1.x) Default Gateway, connects to a wired internet,
|----------> eth2 (IP : (10.165.11.139) GW to be used : (10.165.11.137), connects to a network A
|----------> eth3 (IP : (10.150.114.190) GW to be used: (10.150.114.191), connects to a network BProblem here is that both network A and network B have nodes with same IP, example :
Code: 10.232.130.171
10.232.130.172
10.232.131.100route-eth1 file looks like:
Code: 10.232.130.0/24 via 10.165.11.137
10.232.131.0/24 via 10.165.11.137route-eth2 file looks like:
Code: 10.232.130.0/24 via 10.150.114.189
10.232.131.0/24 via 10.150.114.189so pinging 10.232.130.171 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
Code:ip rule add from 10.165.11.139 lookup net1
ip route add 10.232.130.0/23 via 10.165.11.137 dev eth2 table net1
ip rule add from 10.150.114.190 lookup net2
ip route add 10.232.130.0/23 via 10.150.114.189 dev eth3 table net2Code:# ip route show table net2
10.232.130.0/23 via 10.150.114.189 dev eth3
# ping -I eth3 10.232.130.170 PING 10.232.130.170 (10.232.130.170) from 10.150.114.190 eth3: 56(84) bytes of data.
From 10.150.114.190 icmp_seq=2 Destination Host Unreachable
From 10.150.114.190 icmp_seq=3 Destination Host UnreachableAny pointers how to resolve this?


Code: | CentOS 6 Server
| ---------> eth0 (DHCP (192.168.1.x) Default Gateway, connects to a wired internet,
|----------> eth2 (IP : (10.165.11.139) GW to be used : (10.165.11.137), connects to a network A
|----------> eth3 (IP : (10.150.114.190) GW to be used: (10.150.114.191), connects to a network BProblem here is that both network A and network B have nodes with same IP, example :
Code: 10.232.130.171
10.232.130.172
10.232.131.100route-eth1 file looks like:
Code: 10.232.130.0/24 via 10.165.11.137
10.232.131.0/24 via 10.165.11.137route-eth2 file looks like:
Code: 10.232.130.0/24 via 10.150.114.189
10.232.131.0/24 via 10.150.114.189so pinging 10.232.130.171 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
Code:ip rule add from 10.165.11.139 lookup net1
ip route add 10.232.130.0/23 via 10.165.11.137 dev eth2 table net1
ip rule add from 10.150.114.190 lookup net2
ip route add 10.232.130.0/23 via 10.150.114.189 dev eth3 table net2Code:# ip route show table net2
10.232.130.0/23 via 10.150.114.189 dev eth3
# ping -I eth3 10.232.130.170 PING 10.232.130.170 (10.232.130.170) from 10.150.114.190 eth3: 56(84) bytes of data.
From 10.150.114.190 icmp_seq=2 Destination Host Unreachable
From 10.150.114.190 icmp_seq=3 Destination Host UnreachableAny pointers how to resolve this?