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
    and a "Destination" of, and a "Gateway" of,
    what does that mean in terms of how the "netmask" works?

    Googling, I find that I need to do a binary bitwise boolean AND:

    So, to convert the IP address to binary, I went here for a lookup:
    Where it seems that the Genmask of is really a netmask
    of, which is really a netmask of the following 32 bits:
    10000000 00000000 00000000 00000000

    From, it seems that
    I need to run this calculation manually to figure what is going on:

    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. Advertisements

  2. <>
    Jonathan N. Little, Sep 11, 2014
    1. Advertisements

  3. Alphonse Arnaud

    detha Guest

    It tells you that traffic to all destinations with the highest bit being 0
    (i.e. to will be sent to, 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
    and one for, both with netmask This way, they create
    a 'default' route through the VPN tunnel without having to remember what
    the original default route ( mask 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.

    detha, Sep 11, 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.