[comp.protocols.tcp-ip] question about /etc/route

timk@NCSA.UIUC.EDU (Tim Krauskopf) (02/05/88)

/etc/route on SunOS 3.3

Am I right that the following entry is taken as a host entry and not
a network entry?

# route add 128.174.22 mygateway 3

produces a netstat -r -n output:

128.174.0.22  128.174.20.77   UGH  

Seems that route isn't using the subnet mask (8 bit subnet on Class B) to
determine that the 128.174.22 is a separate subnet instead of a host.

A bug?  Fixed in later release?

 Tim Krauskopf                                        timk@ncsa.uiuc.edu (ARPA)
 National Center for Supercomputing Applications      14013@ncsavmsa (BITNET)

slevy@UC.MSC.UMN.EDU (Stuart Levy) (02/05/88)

You seem to need to say
	route -n add ...
in which case it's forced to consider it a network route.

bzs@BU-CS.BU.EDU (Barry Shein) (02/05/88)

I think you want to change:

# route add 128.174.22 mygateway 3

to

# route add 128.174.22.0 mygateway 3

The parsing routine is pretty dumb, give it all four octets. Also,
last I looked it doesn't matter what you pass for that last integer
(3), it's just checked for 0 or not 0 (or if it's not there at all.) I
assume this may change in the future (note: the original question was
specific to Sun/OS, your mileage may vary.)

	-Barry Shein, Boston University

PAP4@AI.AI.MIT.EDU ("Philip A. Prindeville") (02/05/88)

    Am I right that the following entry is taken as a host entry and not
    a network entry?

    # route add 128.174.22 mygateway 3

    produces a netstat -r -n output:

    128.174.0.22  128.174.20.77   UGH  

    Seems that route isn't using the subnet mask (8 bit subnet on Class B) to
    determine that the 128.174.22 is a separate subnet instead of a host.

    A bug?  Fixed in later release?

Actually, it's minor brain-death in the way BSD parses addreses.  If you
leave dotted numbers out, all but the last set of digits get left
justified in the address, whereas the last digit gets right justified.
Therefore, 10.51 == 10.0.0.51, and 128.174.22 == 128.174.0.22.
If you try:

# route add 128.174.22.0 mygateway 3

you will find this nastiness goes away.  And I thought that standard
notation for internet addresses was four dotted digits...

-Philip

guyton%condor@RAND-UNIX.ARPA (02/05/88)

> # route add 128.174.22 mygateway 3
>
> produces a netstat -r -n output:
>
> 128.174.0.22  128.174.20.77   UGH

You need to add the trailing zero:

 # route add 128.174.22.0 mygateway 3


-- Jim

mminnich@UDEL.EDU (Mike Minnich) (02/05/88)

> # route add 128.174.22 mygateway 3
> produces a netstat -r -n output:
> 128.174.0.22  128.174.20.77   UGH  

You need to force the interpretation of 128.174.22 as a network address 
rather than as a host address.  Do this by using the keyword "net" in front
of 128.174.22:

route add net 128.174.22 mygateway 3

The manual page in Sun/OS 3.4 (and I suspect 3.3 as well) for /etc/route 
does not explain this -- it seems to be out of sync with the installed binary.

mike

jas@MONK.PROTEON.COM (John A. Shriver) (02/05/88)

Classically, /etc/route (in most implmentations I have dealt with)
discerns the difference between hosts and routes not on the basis of
address, but on the basis of whether the NAME you give is in the file
/etc/networks.  This is a rather tricky little gotcha, and barely
documented.

This may not be the case anymore in SunOS 3.3.  (It certainly caught
be with WIN/VX 2.3.)  Also, I beleive Sun has noted problems with
subnet routes with /etc/routed in 3.3, as noted in the Sun Technical
Bulletin.  There may be a patch tape, or it may be fixed in a higher
release.