beginner question on route

Discussion in 'Linux Networking' started by Magnus Warker, Jul 5, 2014.

  1. Hi,

    the output of a "route" call on my Linux box looks like this:

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use
    Iface
    default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
    localnet * 255.255.255.0 U 0 0 0 eth0

    Questions:

    What is this route with destination "localnet" for and what does "*" as
    gateway mean?

    Why isn't the default route the last one? I thought that the entries are
    processed from top to bottom and the first one that matches is used?

    Thanks
    Magnus
     
    Magnus Warker, Jul 5, 2014
    #1
    1. Advertisements

  2. Magnus Warker

    detha Guest

    localnet is what is directly connected to eth0, probably 192.168.1.0/24 in
    your case; the * means no gateway, directly reachable.

    If you use 'route -n' (or 'ip route show') things may be a bit clearer.
    In what order the routing table is displayed doesn't matter. Routes are
    selected on 'closest match', i.e. how many bits match. If you had routes

    0.0.0.0/0 gateway 192.168.1.1
    10.0.0.0/8 gateway 192.168.1.2
    10.3.0.0/16 gateway 192.168.1.3

    traffic for 10.3.1.1 would go to 192.168.1.3, traffic for 10.6.1.1 would
    go to 192.168.1.2, and anything not in 10.*.*.* to 192.168.1.1
     
    detha, Jul 5, 2014
    #2
    1. Advertisements

  3. Nope. More specialised to less specialised. Ie, the route used is the
    most specialised route which matches the address.
    Use
    route -n
    so it does not give names to the destinations, but rather IP addresses.
    I suspect that localnet is 127.0.0.0
    Ie, any address that starts with 127.0.0 (see the genmask)
    And the * in the gateway is to use
    the local network.
     
    William Unruh, Jul 6, 2014
    #3
  4. William Unruh a écrit :
    No. 127.0.0.0 is rather the loopback subnet, its mask would be
    255.0.0.0, not 255.255.255.0 and its interface would be the loopback
    interface "lo". Besides, the loopback route does not appear in the main
    routing table, it is stored in a special "local" table which can be
    displayed with "ip route table local".

    As detha wrote, localnet is the LAN subnet attached to eth0. Network
    names are usually stored in /etc/networks.
     
    Pascal Hambourg, Jul 6, 2014
    #4
  5. Ok. What does a destination 0.0.0.0 mean? And what does a gateway
    0.0.0.0 mean?

    And BTW: Why does "route" last several seconds until the table is
    printed (while "route -n" prints the table immediately)?

    Thanks
    Magnus
     
    Magnus Warker, Jul 7, 2014
    #5
  6. Magnus Warker

    Tauno Voipio Guest

    Destination 0.0.0.0 is associated with netmask 0.0.0.0, and it means
    that all destinations that have come this far in the table match, so
    its gateway is the default route to the outside world.

    Gateway 0.0.0.0 means that there is none: the destination is reachable
    directly on the local network.
    The time goes to the name service attempting to reverse resolve the
    addresses in the table. A long time means that the resolution timed
    out of some reason.
     
    Tauno Voipio, Jul 7, 2014
    #6
  7. It means any destination (default route)
    It means thatthe system is just to dump the packets onto the local
    network as those addresses are of computers are attached directly to your computer.
    by your local network. Ie, it is to look up the arp tables and deliver
    the messages to mac adresses not ip addresses.



    It has to use dns to figure out what the names associated with the
    addresses are.
    In the coputer, the routing is by address, not name, so it needs no time
    to figure out what the addresses in the table are, that is how they are
    stored there.
     
    William Unruh, Jul 7, 2014
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.