Solaris: How do I setup a default static route / static router IP address?

November 15, 2010 by: upa_kid


/etc/defaultrouter is the configuration file for default router under Solaris os. The /etc/defaultrouter file can contain the IP addresses or hostnames of one or more default routers, with each entry on its own line. If you use hostnames, each hostname must also be listed in the local /etc/hosts file, because no name services are running at the time that defaultrouter is read.

The default routes listed in this file replace those added by the kernel during diskless booting. An empty /etc/defaultrouter file will cause the default route added by the kernel to be deleted.

(1) First login to Solaris box as a root user:
# su
The /etc/defaultrouter is configuration file for default router under Sun Solaris. Open the file /etc/defaultrouter and add the router IP address:
# vi /etc/defaultrouter
Append IP address:
192.168.1.254
Restart the Solaris network with following command:
# /etc/init.d/network restart
(3) Or you can add the router IP to default route table as follows:
# route add default 192.168.1.254
Output:

add net default: gateway 192.168.1.254

Finally use nslookup and ping command to check network settings:
$ ping 192.168.1.254
$ nslookup nixcraft.com

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Have you found this script useful? Please support author by PayPal donation.

Leave a Reply