Question about netstat -r -n Genmask when it ends up being allzeros

Discussion in 'Linux Networking' started by Alphonse Arnaud, Sep 11, 2014.

  1. If, when I run "netstat -r -n", I see a "Genmask" of 128.0.0.0
    and a "Destination" of 0.0.0.0, and a "Gateway" of 192.168.1.1,
    what does that mean in terms of how the "netmask" works?

    Googling, I find that I need to do a binary bitwise boolean AND:
    http://en.wikiversity.org/wiki/EE_Digital_Electronics/Lecture_Digital_Logic_Gates#The_AND_function

    So, to convert the IP address to binary, I went here for a lookup:
    http://www.pawprint.net/designresources/netmask-converter.php
    Where it seems that the Genmask of 128.0.0.0 is really a netmask
    of 128.0.0.0, which is really a netmask of the following 32 bits:
    10000000 00000000 00000000 00000000

    From http://www.sput.nl/internet/cidr-routing.html, it seems that
    I need to run this calculation manually to figure what is going on:

    Addr 0.0.0.0
    Mask 128.0.0.0
    AND --------------------------------------------
    Net ?.?.?.?

    Addr 0000 0000 1010 1000 0000 0000 0000 0000
    Mask 1000 0000 0000 0000 0000 0000 0000 0000
    AND --------------------------------------------
    Net 0000 0000 0000 0000 0000 0000 0000 0000

    I must admit, I'm confused.
    I "think" I did all the right math.
    But, what does all zeros tell me about the route?
     
    Alphonse Arnaud, Sep 11, 2014
    #1
    1. Advertisements

  2. <http://www.cyberciti.biz/faq/what-is-a-routing-table/>
     
    Jonathan N. Little, Sep 11, 2014
    #2
    1. Advertisements

  3. Alphonse Arnaud

    detha Guest

    It tells you that traffic to all destinations with the highest bit being 0
    (i.e. 0.0.0.0 to 127.255.255.255) will be sent to 192.168.1.1, unless
    there is a more specific route for that destination. To select the gateway
    for a destination, the system takes the destination, ANDs with the netmask
    for each route, and compares that with the destination of the route. If
    that matches exactly, the route is a possible choice. The most specific
    route (i.e. the one with the most bits matching) wins.

    I have seen VPN clients do this, they install two routes, one for 0.0.0.0
    and one for 128.0.0.0, both with netmask 128.0.0.0. This way, they create
    a 'default' route through the VPN tunnel without having to remember what
    the original default route (0.0.0.0 mask 0.0.0.0) was for when the tunnel
    goes down. As long as the tunnel is up, the more specifics are selected,
    and when the tunnel goes down all the vpn client has to do is remove the
    more specifics it installed, and selection falls back to your original
    default route.

    -d
     
    detha, Sep 11, 2014
    #3
    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.