• beginner question on route

    From Magnus Warker@110:110/2002 to All on Sat Jul 5 07:09:40 2014
    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

    --- MBSE BBS v1.0.1 (GNU/Linux-i386)
    * Origin: (posted via) M-net Telekommunikations GmbH (110:110/2002@linuxnet)
  • From detha@110:110/2002 to All on Sat Jul 5 07:38:00 2014
    On Sat, 05 Jul 2014 09:09:40 +0200, Magnus Warker wrote:

    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?

    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.


    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?


    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

    Thanks
    Magnus


    --- MBSE BBS v1.0.1 (GNU/Linux-i386)
    * Origin: whoever pays best (110:110/2002@linuxnet)
  • From William Unruh@110:110/2002 to All on Sun Jul 6 04:44:51 2014
    On 2014-07-05, Magnus Warker <magnux@mailinator.com> wrote:
    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?

    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.


    Thanks
    Magnus

    --- MBSE BBS v1.0.1 (GNU/Linux-i386)
    * Origin: A noiseless patient Spider (110:110/2002@linuxnet)
  • From Pascal Hambourg@110:110/2002 to All on Sun Jul 6 08:34:56 2014
    Reply-To: pascal.news@plouf.fr.eu.org

    William Unruh a ‚crit :
    On 2014-07-05, Magnus Warker <magnux@mailinator.com> wrote:

    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?

    I suspect that localnet is 127.0.0.0

    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.

    --- MBSE BBS v1.0.1 (GNU/Linux-i386)
    * Origin: Plouf ! (110:110/2002@linuxnet)
  • From Magnus Warker@110:110/2002 to All on Mon Jul 7 16:30:44 2014
    On 07/05/2014 09:38 AM, detha wrote:
    On Sat, 05 Jul 2014 09:09:40 +0200, Magnus Warker wrote:

    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.

    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

    --- MBSE BBS v1.0.1 (GNU/Linux-i386)
    * Origin: (posted via) M-net Telekommunikations GmbH (110:110/2002@linuxnet)
  • From Tauno Voipio@110:110/2002 to All on Mon Jul 7 16:40:43 2014
    On 7.7.14 19:30, Magnus Warker wrote:

    Ok. What does a destination 0.0.0.0 mean? And what does a gateway
    0.0.0.0 mean?

    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.

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

    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


    --- MBSE BBS v1.0.1 (GNU/Linux-i386)
    * Origin: A noiseless patient Spider (110:110/2002@linuxnet)
  • From William Unruh@110:110/2002 to All on Mon Jul 7 20:34:00 2014
    On 2014-07-07, Magnus Warker <magnux@mailinator.com> wrote:
    On 07/05/2014 09:38 AM, detha wrote:
    On Sat, 05 Jul 2014 09:09:40 +0200, Magnus Warker wrote:

    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.

    Ok. What does a destination 0.0.0.0 mean? And what does a gateway
    0.0.0.0 mean?

    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.





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

    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.


    Thanks
    Magnus

    --- MBSE BBS v1.0.1 (GNU/Linux-i386)
    * Origin: A noiseless patient Spider (110:110/2002@linuxnet)