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

/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.

ADVERTISEMENTS

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

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
7 comments… add one
  • Anonymous Sep 6, 2006 @ 22:42

    Is it just me or is this answer, answering “How do I setup a default route in Solaris?” Rather than “How do I setup a static route?”

    I suppose the default route is also considered a static route but this still didn’t really help me.

  • Jake Feb 21, 2008 @ 4:42

    No – you’re 100% correct. This article answers the question better.

  • Mohammed Asif Oct 28, 2008 @ 9:45

    To the point & very brief clear intructions. I like your website.

  • ch haqsar Jul 15, 2009 @ 8:45

    when we restart our router then it display the wrong routing table.netstat -r
    pl advice us how we stop this routing table and set our own routing table.
    I am new user of sunsolaris 8. and want to learn all this how in.routed works

  • george willms Dec 3, 2009 @ 11:44

    Great post,ihave trying to get my sweet virgin phoenix to put out with no luck ,thinking she was just mad at me ,so i am getting a correct router this am and thanks for this setup manual , one think this would be in the manual that comes with the unit / i guess i am asking for too much info. guess the company techs. think everyone should on half nuts and wastse 10 days when they could do just as much good with there thumb up the south port!!!!!!!!!!!!!!!!!!!!! A BBIGET THANKS FOR INFO.

  • george willms Dec 9, 2009 @ 0:53

    plz help i not program thr comstar router / no buttons to do this on my phoenix remote

  • Chris Feb 16, 2010 @ 20:32

    I don’t have an /etc/init.d/network script, so I restarted network with:

    svcadm restart network/physical

Leave a Reply

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

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.