route [<subcommand>]

With no arguments, 'route' displays the IP routing table.

route add <desthostid>[/bits] default <iface> [<gatewayhostid> | direct] [metric]

NOTE: Attempting tcp connections to an address without an existing route fails immediately.

This command adds an entry to the routing table. It requires at least two more arguments, the desthostid of the target destination and the name of the interface <iface> to which its packets should be sent. If the destination is not local, the gateway's hostid should also be specified. (If the interface is a point-to-point link, then <gatewayhostid> may be omitted even if the target is non-local because this field is only used to determine the gateway's link level address, if any. If the destination is directly reachable, <gatewayhostid> is also unnecessary since the destination address is used to determine the interface link address). If <rspf> is used and the system is a switch / router to multiple routes, the keyword 'direct' can be used instead of a <gatewayhostid> to set the metric higher than the default of 1. This way routes advertised by other rspf stations can be cheaper and get selected. If 'direct' is given but <metric> not, an new algorithm is used to set the metric dependent on the number of subnet mask bits.

The optional /bits suffix to the destination host id specifies how many leading bits in the host id are to be considered significant in the routing comparisons. If not specified, 32 bits (i.e., full significance) is assumed. With this option, a single routing table entry may refer to many hosts all sharing a common bit string prefix in their IP addresses. For example, ARPA Class A, B and C networks would use suffixes of /8, /16 and /24 respectively. E.g. the command

route add 44/8 ax0 44.64.0.2

causes any IP addresses beginning with "44" in the first 8 bits to be routed to 44.64.0.2; the remaining 24 bits are "don't-cares".

When an IP address to be routed matches more than one entry in the routing table, the entry with largest 'bits' parameter (i.e., the "best" match) is used. This allows individual hosts or blocks of hosts to be exceptions to a more general rule for a larger block of hosts.

The special destination 'default' is used to route datagrams to addresses not matched by any other entries in the routing table; it is equivalent to specifying a /bits suffix of /0 to any destination hostid. Care must be taken with 'default' entries since two nodes with default entries pointing at each other will route packets to unknown addresses back and forth in a loop until their time-to-live (TTL) fields expire. (Routing loops for specific addresses can also be created, but this is less likely to occur accidentally).

There is one built-in interface: loopback. Loopback is for internal purposes only.

Here are some examples of the route command:

# Route datagrams to IP address 44.0.0.3 to SLIP line #0.

# No gateway is needed because SLIP is point-to point.

route add 44.0.0.3 sl0

# Route all default traffic to the gateway on the local Ethernet

# with IP address 44.0.0.1

route add default ec0 44.0.0.1

# The local Ethernet has an ARPA Class-C address assignment;

# route all IP addresses beginning with 192.4.8 to it

route add 192.4.8/24 ec0

# The station with IP address 44.0.0.10 is on the local AX.25 channel

route add 44.0.0.10 ax0

#An encapsulation link to 192.4.8.12 where the subnet 44.64.0.0 is accessible. The Internet does not know

#where we are but we just use them with what they know:

route add 44.64.0.0/16 encap 192.4.8.12 4

route addprivate <dest hostid>[/bits] | default <iface> [<gateway hostid> [<metric>]]

This command is identical to 'route add' except that it also marks the new entry as private; it will never be included in outgoing RIP updates. It will also not be shown in the nodeshell 'IProute' command.

route drop <dest hostid>

Delete an entry from the table. If a packet arrives for the deleted address and a default route is in effect, it will be used.