HP-UX Reference (11i v2 07/12) - 7 Device (Special) Files, 9 General Information, Index (vol 10)

r
routing(7) routing(7)
If subnets are not in use, the default mask used is 255.255.255.0.
If subnets are used and the 8-bit host field is partitioned into 3 bits of subnet and 5 bits of host as in the
above example, then the subnet mask would be 255.255.255.192.
If a host has multiple interfaces, then it can belong to different subnets. Unlike past releases, the subnets
can have different sizes even if they may have the same network address. This is accomplished by using a
different netmask on each of the host interfaces. For example, the
lan1 and lan2 interface shown in the
netstat tables above are connected to two distinct subnets of the same network, 147.253. The subnet
that lan1 belongs to can have at most 14 hosts, because its netmask is 255.255.255.240.
Note:
The host portion of those IP addresses in the subnet cannot be all 1’s or all 0’s, therefore this subnet
can support only 14 hosts, not 16.
The subnet that
lan2 belongs to can have up to 510 hosts, because its netmask is 255.255.254.0.
Supernets
A supernet is a collection of smaller networks. Supernetting is a technique of using the netmask to aggre-
gate a collection of smaller networks into a supernet. This technique is particularly useful for class C net-
works. A Class C network can only have 254 hosts. This can be too restrictive for some companies. For
these companies, a netmask that only contains a portion of the network part can be applied to the hosts in
these class C networks to form a supernet. This supernet netmask should be applied to those interfaces
that connect to the supernet using the ifconfig command (see ifconfig(1M)). For example, a host can
configure its interface to connect to a class C supernet, for example, 192.6, by configuring an IP address of
192.6.1.1 and a netmask of 255.255.0.0 to its interface.
Routing Algorithm
The routing table entries are of three types:
Entries for a specific host.
Entries for all hosts on a specific network.
Wildcard entries for any destination not matched by entries of the first two types.
To select a route for forwarding an IP packet, the network facilities select the complete set of "matching"
routing table entries from the routing table. A routing table entry is considered a match, if the result of the
bit-wise AND operation between the netmask in the routing entry and the IP packet’s destination address
equals the destination address in the routing entry.
The network facilities then select from the set the routing entries that have the longest netmask. The
length of a netmask is defined as the number of contiguous 1 bits starting from the leftmost bit position in
the 32-bit netmask field. In other words, the network facilities select the routing entry that specifies the
narrowest range of IP addresses. For example, the host route entry that has a destination/netmask pair of
(147.253.56.1, 0xFFFFFFFF), is more specific than the network route entry that has a destination/netmask
pair of (147.253.56.0, 0xFFFFFE00); therefore, the network facilities select the host route entry. The
default route by default has a destination/netmask pair of (0,0). Therefore, the default route matches all
destinations but it is also the least specific. The default route will be selected only if there is not a more
specific route.
There may still be multiple routing entries remaining. In that case, the IP packet is routed over the first
entry displayed by
netstat -r. Such multiple routes include:
Two or more routes to a host via different gateways.
Two or more routes to a network via different gateways.
Two default routes.
A superuser can change entries in the table by using the route command (see route(1M), or by informa-
tion received in Internet Control Message Protocol (ICMP) redirect messages.
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.
HP-UX 11i Version 2: December 2007 Update 4 Hewlett-Packard Company 141