Manually manipulates the routing tables.
route [ -f ] [ -n ] [ -q ] [ -v ] Command [ Family ] [ [ -net | -host ] Destination [ -prefixlen n] [ -netmask [ Address ] ] Gateway ] [ Arguments ]
The route command allows you to make manual entries into the network routing tables. The route command distinguishes between routes to hosts and routes to networks by interpreting the network address of the Destination variable, which can be specified either by symbolic name or numeric address. The route command resolves all symbolic names into addresses, using either the /etc/hosts file or the network name server.
Routes to a particular host are distinguished from those to a network by interpreting the Internet address associated with the destination. The optional keywords -net and -host force the destination to be interpreted as a network or a host, respectively. If the destination has a local address part of INADDR_ANY or if the destination is the symbolic name of a network, then the route is assumed to be to a network; otherwise, it is presumed to be a route to a host.
For example, 128.32 is interpreted as -host 18.104.22.168; 128.32.130 is interpreted as -host 22.214.171.124; -net 128.32 is interpreted as 126.96.36.199; and -net 128.32.130 is interpreted as 188.8.131.52.
If the route is by way of an interface rather than through a gateway, the -interface argument should be specified. The specified gateway is the address of the host on the common network, indicating the interface to be used for transmission.
The -netmask argument must be followed by an address parameter (to be interpreted as a network mask). One can override the implicit network mask generated in the -inet case by making sure this option follows the Destination parameter.
All symbolic names specified for a destination or gateway are looked up first as a host name, using the gethostbyname subroutine. If this fails, the getnetbyname subroutine is then used to interpret the name as a network name.
Note: Route uses a routing socket and the new message types RTM_ADD, RTM_DELETE, and RTM_CHANGE. As such, only the root user may modify the routing tables.
If the flush or -f command is specified, route will "flush," or clear, the routing tables of all gateway entries. One can choose to flush only those routes whose destinations are of a given address family, by specifying an optional keyword describing which address family.
The netstat -r command displays the current routing information contained in the routing tables.
|-f||Purges all entries in the routing table that are not associated with network interfaces.|
|-n||Displays host and network names numerically, rather than symbolically, when reporting results of a flush or of any action in verbose mode.|
|-q||Specifies quiet mode and suppresses all output.|
|-v||Specifies verbose mode and prints additional details.|
|-net||Indicates that the Destination parameter should be interpreted as a network.|
|-netmask||Specifies the network mask to the destination address. Make sure this option follows the Destination parameter.|
|-host||Indicates that the Destination parameter should be interpreted as a host.|
|-prefixlen n||Specifies the length of a destination prefix (the number of bits in the netmask).|
The route default is a host (a single computer on the network). When neither the -net parameter nor the -host parameter is specified, but the network portion of the address is specified, the route is assumed to be to a network. The host portion of the address is 0 (zero).
|Arguments||Specifies one or more of the following arguments. Where
n is specified as a variable to an argument, the value of the
n variable is a positive integer.
|Command||Specifies one of six possibilities:
|Family||Specifies the address family. The -inet address family is the default. The -inet6 family specifies that all subsequent addresses are in the inet6 family, and the -xns address family specifies that all subsequent addresses are in the Xerox Network System (XNS) address family.|
|Destination||Identifies the host or network to which you are directing the route. The Destination parameter can be specified either by symbolic name or numeric address.|
|Gateway||Identifies the gateway to which packets are addressed. The Gateway parameter can be specified either by symbolic name or numeric address.|
The following are examples using the route command on a TCP/IP network and an XNS network, respectively:
route add 184.108.40.206 220.127.116.11
The 18.104.22.168 address is that of the receiving computer (the Destination parameter). The 22.214.171.124 address is that of the routing computer (the Gateway parameter).
route add -net 126.96.36.199 188.8.131.52
The 184.108.40.206 address is that of the receiving network (the Destination parameter). The 220.127.116.11 address is that of the routing network (the Gateway parameter).
route add 0 18.104.22.168
The value 0 or the default keyword for the Destination parameter means that any packets sent to destinations not previously defined and not on a directly connected network go through the default gateway. The 22.214.171.124 address is that of the gateway chosen to be the default.
route add -xns 120 110:02.60.8c.2c.a4.98
This adds an xns route to destination network 120 through gateway 110:02.60.8c.2c.a4.98.
route flush -xns
The netstat command.
The routed daemon.
The gethostbyname subroutine, getnetbyname subroutine.
The /etc/hosts file format.
TCP/IP Routing, Gateways, TCP/IP Addressing in AIX 5L Version 5.1 System Management Guide: Communications and Networks.
Xerox Network Systems (XNS) Overview for Programming in AIX 5L Version 5.1 Communications Programming Concepts.