My host IP is 192.168.2.178/24
and Previously my route table looks like:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.2.5 0.0.0.0 UG 0 0 0 eth0
I want to ping 192.168.10.21/24.which is located in another subnet. Ping failed first.
But after I add this route:
route add -net 192.168.10.0 netmask 255.255.255.0 dev eth0
now my route table looks like this:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.2.5 0.0.0.0 UG 0 0 0 eth0
and I can ping.
The question is :
In the previous case, ping 192.168.10.21 would apply the last rule and use the default gateway(192.168.2.5).
In the later case, ping 192.168.10.21 would apply the second rule and still use the default gateway(192.168.2.5).
Why came out different result? What makes the difference?
Thanks a lot in advance!
Bookmarks