netstat output question -- gateways?

Discussion in 'Linux Networking' started by Duane Evenson, Sep 21, 2006.

  1. looking at the output from netstat -rn...

    My books and some internet sites use the interface's IP address for
    networks' gateway. My computer and other internet sites use 0.0.0.0
    as the gateway.
    eg.
    Kernel IP routing table
    Destination Gateway Genmask Flags MSS Window irtt Iface
    192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
    192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
    0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0

    Where can I go to get this difference explained? This seems to be an "of
    course" topic I'm missing. A wild guess is that newer versions of the
    router daemon don't need the interface's IP address.

    TIA,
    Duane
     
    Duane Evenson, Sep 21, 2006
    #1
    1. Advertisements

  2. I'm not certain what you mean by "gateway" above. The only gateway that
    netstat reveals above is the default route of 192.168.0.1. That's what
    the G flag means.

    Locally connected networks don't need a gateway. That's why none of the
    other lines have a gateway.

    What are you really trying to ask? Are you saying you're disturbed by
    the lack of info in the "Gateway" column for networks that don't use a
    gateway?
     
    Allen Kistler, Sep 21, 2006
    #2
    1. Advertisements

  3. Duane Evenson

    Moe Trin Guest

    On Thu, 21 Sep 2006, in the Usenet newsgroup comp.os.linux.networking, in
    /sbin/route -n would be another way to look at the same information
    Hmmm, none of the UNIX boxes I have access to use the interface address,
    and I don't recall any off the top of the head. On the other hand,
    when microsoft invented networking, they put their own weird twist on
    things, probably because they didn't understand it, and didn't want to
    use tools and standards that had been around 13 years before.

    In windoze, (host = 192.168.1.2 default gateway = 192.168.1.1), you'd see

    route print
    Network Address Netmask Gateway Address Interface Metric
    0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.2 1
    127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
    192.168.1.0 255.255.255.0 192.168.1.2 192.168.1.2 1
    192.168.1.2 255.255.255.255 127.0.0.1 127.0.0.1 1
    192.168.1.255 255.255.255.255 192.168.1.2 192.168.1.2 1
    224.0.0.0 224.0.0.0 192.168.1.2 192.168.1.2 1
    255.255.255.255 255.255.255.255 192.168.1.2 192.168.1.2 1

    compared to (in this case Linux)

    Kernel IP routing table
    Destination Gateway Genmask Flags MSS Window irtt Iface
    192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
    224.0.0.0 0.0.0.0 240.0.0.0 U 0 0 0 eth0
    0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

    so four lines instead of seven. Incidentally, windoze got it wrong above, as
    the network mask for Multicast is not 224.0.0.0 (which would be 224.0.0.0
    through 255.255.255.255), but is 240.0.0.0 (224.0.0.0 - 239.255.255.255).
    Also, the main difference between the various *nix is the name given to the
    interface. Linux used 'ethX', but others use different letters, such as hmeX
    or leX (Sun), ecX or etX (IRIX) and so on (where the X is a number).
    In *nix, we refer to the interface by name - while microsoft refers to it
    by IP address. This appears to be part of the "baffle 'em with bullsh!t"
    techno-babble used to scare away the curious. What to read... how about
    the "Linux Network Administrator's Guide" from the Linux Documentation
    Project (http://tldp.org/guides.html), or you can buy the dead-tree edition
    from O'Reilly and Associates (www.ora.com) as ISBN 0-596-00548-2 for US$35.
    Some of this is semantics - you use a "gateway" to reach some _other_
    network that isn't directly attached to your system. In the above listing,
    the networking code doesn't use a gateway to send to local addresses,
    because they can be reached directly.

    Old guy
     
    Moe Trin, Sep 21, 2006
    #3
  4. Hello,

    Moe Trin a écrit :
    In the Windows world, it seems that gateway address = interface address
    means no gateway, i.e. the destination is directly reachable.
    Well, this is because you show only the "main" routing table and hide
    the "local" routing table which contains the missing local and broadcast
    routes :

    $ ip route show table local
    broadcast 192.168.1.255 dev eth0 proto kernel scope link src 192.168.1.2
    broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1
    local 192.168.1.2 dev eth0 proto kernel scope host src 192.168.1.2
    broadcast 192.168.1.0 dev eth0 proto kernel scope link src 192.168.1.2
    broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1
    local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1
    local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1

    Note that the local destination 127.0.0.0/8 must be in the local table,
    and is not supposed to be in the main table.
     
    Pascal Hambourg, Sep 22, 2006
    #4
    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.