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
    default UG 0 0 0 eth0
    localnet * U 0 0 0 eth0


    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?

    Magnus Warker, Jul 5, 2014
    1. Advertisements

  2. Magnus Warker

    detha Guest

    localnet is what is directly connected to eth0, probably 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 gateway gateway gateway

    traffic for would go to, traffic for would
    go to, and anything not in 10.*.*.* to
    detha, Jul 5, 2014
    1. Advertisements

  3. Nope. More specialised to less specialised. Ie, the route used is the
    most specialised route which matches the address.
    route -n
    so it does not give names to the destinations, but rather IP addresses.
    I suspect that localnet is
    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
  4. William Unruh a écrit :
    No. is rather the loopback subnet, its mask would be, not 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
  5. Ok. What does a destination mean? And what does a gateway mean?

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

    Magnus Warker, Jul 7, 2014
  6. Magnus Warker

    Tauno Voipio Guest

    Destination is associated with netmask, 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 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
  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
    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.