Results 1 to 1 of 1

Thread: need to add route when ping a host in another subnet?

  1. #1
    Join Date
    Jun 2014
    Beans
    1

    need to add route when ping a host in another subnet?

    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!
    Last edited by herbert6; June 12th, 2014 at 04:34 AM. Reason: format

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •