Solaris route command examples

Solaris 8

Example: Route 149.122.65.0/24 and 149.122.73.0/24 through qfe1. 149.122.4.1 is a router on qfe1's subnet.

Routing Table: IPv4
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
149.122.4.0          149.122.4.21          U        1  60413  qfe1
149.122.3.0          149.122.3.11          U        1 195504  qfe0
149.122.1.0          149.122.1.11          U        1  64323  hme0
224.0.0.0            149.122.1.11          U        1      0  hme0
default              149.122.1.1           UG       13596144 
127.0.0.1            127.0.0.1             UH       52020171  lo0

# route add -net 149.122.65.0 149.122.4.1
# route add -net 149.122.73.0 149.122.4.1

Routing Table: IPv4
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
149.122.73.0         149.122.4.1           UG       1      2 
149.122.4.0          149.122.4.21          U        1  60413  qfe1
149.122.3.0          149.122.3.11          U        1 195516  qfe0
149.122.1.0          149.122.1.11          U        1  64323  hme0
149.122.65.0         149.122.4.1           UG       1      2 
224.0.0.0            149.122.1.11          U        1      0  hme0
default              149.122.1.1           UG       13596357 
127.0.0.1            127.0.0.1             UH       52020193  lo0

To preserve the changes across system reboots:

# cat - << STATICROUTES > /etc/init.d/staticroutes
route add -net 149.122.65.0 149.122.4.1
route add -net 149.122.73.0 149.122.4.1
STATICROUTES

# chown root:root /etc/init.d/staticroutes
# chmod 744 /etc/init.d/staticroutes
# ln -s /etc/init.d/staticroutes /etc/rc2.d/S70staticroutes

Back to brandonhutchinson.com.
Last modified: 2007/06/01