Static routing

In an IPv4 network, hosts can dynamically discover the presence of routers by using the ICMP router discovery protocol. Router hosts can run in.rdisc in order to advertise themselves through the ICMP router discovery protocol. When a host invokes in.rdisc at boot time, it listens on the (ALL_HOSTS) multicast address for router advertisement messages from routers on the network. In turn, router hosts send out advertisement messages to the multicast address advertising all of their IP addresses. Multiple initial advertisement messages are sent out during the first few seconds after the router boots, backing off to transmit advertisement messages approximately once every ten minutes. Optionally, a host can avoid waiting for routers to announce themselves by sending out a few router solicitation messages to the (ALL_ROUTERS) multicast address where routers listen for requests. If the host does not find a default router, it may choose to start in.routed in quiet mode to listen for Router Information Protocol (RIP) advertisements broadcast by router hosts. Router hosts invoke in.routed at boot time in order to publish their routing tables using RIP. The route information is broadcast every 30 seconds. In a small IPv4 network, or one in which there is only one router connecting it to other networks, static routing is preferable to the previously described dynamic routing requiring rdisc or routed. In a single-outlet network, every route goes through the solitary router, so the entire routing table can be compressed into a default route entry:

route add default 131.40.52.14 1


The destination is given as default, and the gateway address is the IP address or hostname of the router. In Solaris, you can effectively define static routes at boot time by simply creating the /etc/defaultrouter file on each machine, and putting the name of the default router in this file. If this file exists, the /etc/init.d/inetinit boot script will read the router name from this file and set up a default route. Furthermore, if a default route has been established, the /etc/init.d/inetinit script skips the invocation of routed and rdisc. You can specify either the IP address or the hostname of the router in /etc/defaultrouter. If you use the hostname, make sure to also include its IP address mapping in the /etc/hosts or /etc/inet/ipnodes file, because no name services are running at the time that the boot script is run. Note that the IPv6 protocol is designed to be dynamic in nature, therefore IPv6 heavily relies on router discovery. For Solaris hosts, in.ndpd is the only mechanism available to discover IPv6 routers. in.ndpd sends router solicitation messages and uses the router advertisement messages it receives to autoconfigure the IPv6 host. Although nothing in the IPv6 protocol precludes static routes from being defined, Solaris has chosen not to implement a mechanism to define static routes for IPv6.