Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

netstat(1)

ifconfig(1m)

route(1m)

routing(7)

Requires Optional LAN/X.25 Software

NAME

routing − system support for local network packet routing

DESCRIPTION

The network facilities provide general packet routing, leaving most routing table maintenance to applications processes. 

A simple set of data structures comprise a “routing table” used in selecting the appropriate remote host or gateway when transmitting packets.  This table contains a single entry for each route to a specific network or host. 

The table contains the entry lo0 for the local loopback after you boot up your system, and an entry ( lan0,lan1,lan2,...)  for each interface card after you execute ifconfig(1m).

The table can be changed by the super-user through the route(1m) command, or by information received in Internet Control Message Protocol (ICMP) redirect messages.

The routing table can be displayed by using the netstat(1) command with the −r option.  This command displays the destination internet address, the gateway to use to get to that destination, and flags. There are three types of entries in a routing table: entries for a specific host, entries for all hosts on a specific network, and entries for any destination not matched by entries of the first two types (a wildcard route).   The various types of routes are determined by the flags field of the display from netstat. The flags field is either U, UG, UH, or UGH.  The U flag is always present. The G flag indicates a route using a gateway and a hop count.  If a route is via a remote gateway, the hop count must be greater than zero. No G flag indicates a route without the use of a remote gateway.  The H flag indicates a route to a host. No H flag indicates a route to a network. 

The keyword, default, in the destination field indicates a wildcard gateway.  This is used as a last resort if no information exists in the table about how to get to a particular remote network. Routes that are not valid are not displayed. (See Flags below for details.) 

An attempt is first made to find a route to the specific host.  If that search fails the algorithm looks for a route to the host’s network.  If both searches fail, the wildcard gateway is returned, if one is in the table. If there are multiple routes of the same type (in other words, two routes to a host via different gateways, two routes to a network via different gateways, or two default routes), the packet will be routed over the route which has had the lowest number of packets sent on it. 

If all of the searches fail, an error is returned. 

Flags

The following truth table can be used to help understand the relationship between the count parameter of the route(1M) command, destination type, flags, and route type.

Count Destination Type Flags Route Type
=0 network 1=U route to a network via a gateway
which is the local host itself
>0 network 3=UG route to a network via a gateway
which is a remote host
=0 host 5=UH route to a host via a gateway
which is the local host itself
>0 host 7=UGH route to a host via a gateway
which is a remote host
any "default" 3=UG wildcard gateway route

The routing algorithm used includes the ability to recognize “subnets.” Subnet addresses are similar to the network address portion of Internet addresses;  network addresses identify physically distinct networks;  subnet addresses identify physically distinct subnetworks of the same network.  Subnets allow a network manager to partition the host number space associated with a given network number into discrete subnetworks.  This facility is desirable if it is necessary for several physical networks to share a single network number.  An example is a facility with a single class B network number and several Ethernet-like physical networks.  The host space of a class B address is 16 bits, while a single physical network can have a limitation of 200-300 hosts.  If subnets are used it is possible for all of the networks to have the same network number while each host recognizes that another host with the same network number is not necessarily on the same physical network.  The routing algorithm attempts to find a gateway for a host if it is not on the same subnet, although it may have the same network number. 

The subnet for a given host is specified in the ifconfig(1m) command.  It is specified as a 32-bit subnet mask. The next paragraph outlines an example use of subnets.

An example class C network number is 192.34.17.0, with the last field specifying the host number.  Normally all hosts with the prefix 192.34.17 are recognized as being on the same logical and physical network.  If subnets are not in use, the default mask used is 255.255.255.0.  When routing, bitwise “ands” are performed between the mask and the internet address of the remote host, and between the mask and the local internet address.  If the result is non-zero, it is assumed that the remote host is on the same subnet as the local host.  If subnets are to be used, and the 8-bit host field is to be partitioned into 2 bits of subnet and 6 bits of host, the subnet mask would be 255.255.255.192.  Note that a subnet mask of all zeroes will cause the routing mechanism to assume that all hosts, whether local or remote, are on the local physical network. 

If a subnet mask is not specified in the ifconfig(1m) command, the default mask is used to indicate that subnets are not in use. The default masks for the various classes of internet addresses are as follows:

Class A:  255.0.0.0
Class B:  255.255.0.0
Class C:  255.255.255.0

WARNINGS

Reciprocal route commands must be executed on the local host and the destination host, as well as all intermediate hosts, if routing is to succeed in the cases of virtual circuit connections or bidirectional datagram transfers. 

AUTHOR

routing was developed by the University of California, Berkeley. 

FILES

/etc/hosts
/etc/networks

SEE ALSO

netstat(1), ifconfig(1m), route(1m). 

Hewlett-Packard Company  —  HP-UX Release 8.05: June 1991

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026