I have a machine with 2 network interfaces on it eth0
and eth1
. I want to use interface eth0
for internet and eth1
for my intranet communication which is connected to a internal router.
The internet connection works fine when only the interface eth0
is up and interface eth1
is down. The routing table is as shown below when eth1
is down.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.24.140.1 0.0.0.0 UG 0 0 0 eth0
10.24.140.0 0.0.0.0 255.255.252.0 U 1 0 0 eth0
When I bring the interface eth1
up, a default routing entry is added in the routing table with Destination as 192.168.1.0
and Gateway as 0.0.0.0
and this creates problems.
Now whenever I try to ping a public domain like www.google.com
, the ping results always show that the system tried to ping 192.168.1.1
.
Even the 'nslookup' for www.google.com
results in the IP of the domain as 192.168.1.1
.
I don't understand why the nslookup
is failing just by bringing the eth1
up. I am no longer able to access the internet and things are getting messed up.
I have tried deleting the routing entry for 192.168.1.0
, but that doesn't help. A simple reboot of the machine would add the routing entry again and things would be in messed up situation again.
Kindly suggest what I can try so that both the networks fine on my machine.