Phil R. Karn (email@example.com)
Mon, 17 Aug 87 20:07:53 EDT
The recent discussion about varying subnet sizes was interesting. I have
implemented a "generalized subnetting" scheme in my own IP routing code that
handles this and many similar problems quite well.
Basically, I completely ignore the usual rules that distinguish class A, B
and C addresses. Instead I keep an explicit subnet mask with each entry in
the routing table. (Actually, I use integers between 0 and 32, but the
semantics are the same). When a packet is to be routed, I search the routing
table for the "best" match under control of the mask. That is, if my
routing table contains
target width interface gateway
220.127.116.11 32 sl0
128.96 16 ec0
0 0 ec0 18.104.22.168
and I present the address 22.214.171.124, all three entries match. In this
case, I select the entry with the greatest width, i.e., the first one. Note
that the last entry always matches every address; it is the default route.
The first one is a host-specific entry, matching only one IP address.
Note that the routing table points to an INTERFACE name, not a gateway
address. The gateway field is optional. It is filled in only if the target
is to be reached through a gateway on a multiple access subnet, in which
case the gateway field is passed down to the subnet driver for translation
into a subnet address. If the gateway field is null, the subnet driver is
given the target IP address for translation; this would be done if the
target is directly on the same subnet. If the subnet is a point-to-point
link, the gateway address field is ignored altogether since the subnet
has no need for link level addresses.
With this scheme you can construct a completely arbitrary internet out of
ad-hoc point-to-point links, incompletely connected broadcast subnets (e.g.,
amateur packet radio), partitioned networks as well as "real" subnets like
Ethernets without filling up your routing table with lots of host-specific
entries. You can "bunch up" address groups that begin with a common bit
pattern, regardless of whether they are really all hosts on the same subnet,
or you can split off one or more hosts that are behind a point-to-point
link, for example. It works very well.
This archive was generated by hypermail 2.0b3 on Thu Mar 09 2000 - 14:39:14 GMT