468x60 Ads

Monday, January 27, 2014

Pin It

Widgets

Creating Persistent Routes in Solaris



Creating Persistent Routes in Solaris

Print the currently active routes:

# netstat -rn

Routing Table: IPv4
  Destination           Gateway           Flags  Ref     Use     Interface
-------------------- -------------------- ----- ----- ---------- ---------
default              172.16.0.254         UG        1 1650937522
10.0.0.0             172.16.0.12          UG        1   10206514
172.16.0.0           172.16.0.3           U         1    9528249 igb0:1
224.0.0.0            172.16.0.3           U         1          0 igb0:1
127.0.0.1            127.0.0.1            UH       19      26626 lo0:1

Add a route persistently:

# route -p add default ip-address

Eg:
# route -p add 192.168.10.0/24 172.16.0.10

-p             Make changes to the network route tables per-
                    sistent across system restarts. The operation
                    is applied  to  the  network  routing  tables
                    first  and, if successful, is then applied to
                    the list  of  saved  routes  used  at  system
                    startup.  In determining whether an operation
                    was successful, a failure to add a route that
                    already  exists  or to delete a route that is
                    not in the routing table is ignored. Particu-
                    lar  care  should be taken when using host or
                    network  names  in  persistent   routes,   as
                    network-based  name  resolution  services are
                    not available at the time routes are added at
                    startup.
          (Reference :Solaris man page)

For routes that are created by using this method, use following command
to display all of the static routes

 #route -p show 

Following examples creates an IPv4 route to the destination 192.168.10.0 and subnet  with the subnet  mask of 255.255.255.0(/24):

# route add 192.168.10.0/24 somegateway
       
# route add 192.168.10.0 -netmask 255.255.255.0 somegateway

# route add 192.168.10.0 somegateway 255.255.255.0

For IPv6, only “/” format is accepting for subnet. The following example creates an IPv6 route to the destination 35dd:: with netmask of 16 one-bits followed by 112 zero-bits.


# route add -inet6 35dd::/16 somegateway




0 comments:

Post a Comment