Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 May 2006 18:15:53 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-net@FreeBSD.ORG
Subject:   Re: Can't delete route
Message-ID:  <200605181615.k4IGFr1h020752@lurza.secnetix.de>
In-Reply-To: <446C934A.3040600@seudns.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Alexandre Biancalana <ale@seudns.net> wrote:
 >     Today I had to add a new route in the company gateway. So I ran the 
 > command:
 > 
 > # route add 128.110.0.0 255.255.0.0 10.0.0.17
 > add net 128.110.0.0: gateway 255.255.0.0

You used the wrong syntax.  Correct syntax is:
# route add -net <destination> <gateway> [<netmask>]

So what your command actually did was to add 255.255.0.0
as a gateway for 128.110.0.0 (with an illegal netmask of
10.0.0.17).  You certainly didn't want that, but the
route command did exactly what you told it to do.  ;-)

 >    Running   netstat -nr I get the following:
 > 
 > 0&0xa000011        255.255.0.0        UGSc       15      332   fxp0 =>
 > 
 > this is incorrect, the interface should be fxp1 not fxp0 (that is the 
 > default interface).

That's expected.  255.255.0.0 is probably on your default
route, so it'll be routed to fxp0.

 > And Why the destination network is 0&0xa000011 and 
 > not 128.110.0.0

You specified 10.0.0.17 as the netmask, which is 0xa000011
in hexadecimal.  When you perform a bitwise-and operation
between your destination (128.110.0.0) and your netmask
(10.0.0.17), you get zero.  That's why netstat(1) displays
"0".  It also displays the netmask, usually CIDR notation
if possible (i.e. "/x"), but that's not possible with your
weird netmask, so it just displays "&" followed by the mask
in hex.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"Documentation is like sex; when it's good, it's very, very good,
and when it's bad, it's better than nothing."
        -- Dick Brandon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605181615.k4IGFr1h020752>