HowTo: Add a Static Route (persistent) in Sun Solaris


  1. if you have a destop with ip to access using a port 7588 to a server with ip on solaris operating system.{solaris 10)

    how do go about opening the port.

  2. What is a ‘starup script’?

    Do you mean an empty text file, with the command,

    route add net netmask 1

    for example, added in the first line?

    How do you know, from the output of netstat -rn, what gateway to put in? What netmask to use?

    Why is the file called /etc/rc2.d/S76static-routes? Does the S76 have significance? Is it always S76 or does the number change based upon the situation?

    Why is there a hyphen there in the name? Other writeups have just S, a number, and the word ‘staticroutes’. Does it matter?

    How do you test a static route to make sure it worked?

    I cannot find any of this information on the web.

    Unfortunately I cannot reboot the box I am on, so I have no way of knowing if this ‘permanent’ route will come back.

  3. how to configure gateway in sun solaris 10 operating system, i configure the ip address with help of “ifconfig” command. pls help me!!

  4. To add a gateway :

    # route add default
    # echo > /etc/defaultrouter

  5. Simply writing ‘route add’ etc., in a text file and save it as /etc/rc2.d/S76static-routes works fine for me

    Thankzzzzzzzzzzzz a Lottttttttt

  6. As of Solaris 10 the ‘-p’ permanent flag was added to ‘/usr/sbin/route’.

    route -p add default w.x.y.z

    Now your route is permanent and will persist across reboots. Using /etc/rc?.d scripts is a BAD idea because with SMF your routes may get added after a dependant service is started.

  7. In Solaris 10, the static routes are kept in /etc/inet/static_routes, but that file is to be maintained by using the “-p” (persistant) switch to the “route” command.

  8. What about assigning a route to a specific interface? I am using Solaris 10, and I’d like to specify that a specific host be routed through my bge1 interface.

    I’ve tried several flavors of:

    route add -host a.b.c.d -iface bge1

    but each comes back w/ “bge1: bad value”.

  9. How to route two ips which is in two different networks?

Leave a Reply

Your email address will not be published. Required fields are marked *