Beyond DHCP with DNS and Routing in OpenSolaris

I've finally had time to install OpenSolaris on bare metal.  Previously I've installed it under VirtualBox on my Mac and Linux machines.  The networking configuration really had me pulling out my hair.  If you knew me, you'd know I don't have much hair so this means I was really desperate.   Here's some helpful pointers to get started with networking beyond the default DHCP settings for DNS hostname resolution and routing.


First, I should provide some background.   My office (home office) networking scheme includes a cable modem, 3 non-commercial routers (networks), and a switch.  I'm running "Bind" on a Kubuntu machine as my DNS server.  I know, I'll convert all this over to OpenSolaris when I learn more about it.  So each machine on my networks has an assigned IP address and hostname mapped by the DNS server.  Naturally, when I run my OpenSolaris machine, I want it to have a static IP address and a hostname.  In the future I'm going to look into MultiCast DNS.  But for now, I just wanted to add my new OpenSolaris machine to my network.

Changing From a DHCP assigned IP Address to a Static IP Address

The first step is to configure NWAM (Network Auto-Magic) so my wired ethernet interface is used instead of my wireless interface.  I also need to tell it to use a static IP address for the wired interface.  To do this, I edited the NWAM config file "llP" like this:
pfexec vi /etc/nwam/llp
I changed it to look like this:
e1000g0 static
ath0 dhcp
Notice that the wired interface is before the wireless interface.  This is how NWAM determines which interface to use first.  Note - the nwamd man page states, "Note, however, that this interface is Volatile and may change in a future release."

Since I changed NWAM, I have to restart nwamd (the NWAM daemon).
pfexec svcadm restart nwam

Getting DNS to Work Correctly

Since I went to all that work when I setup Bind (DNS), I really wanted to use it.  My DNS server does forwarding so if the hostname lookup fails, the request is forwarded to "real" DNS servers somewhere in the ether to get IP addresses for hostnames like "" and "" (couldn't resist the plug :) ).

OpenSolaris by default uses NIS (Network Information Service) AKA YellowPages.   So I had to tell NIS to use DNS for hostname resolution.  This is a fairly simple task.  I simply had to copy the provided nsswitch file like this.
pfexec cp /etc/nsswitch.dns /etc/nsswitch.conf 
The DNS client is already running.  I know this because I ran this command.
svcs -a | grep dns 
and saw this result
online   14:17:45 svc:/network/dns/client:default
If you remember from networking 101, the DNS client uses "/etc/resolv.conf" to find the "nameserver".  So I ran
pfexec vi /etc/resolv.conf
made sure I had this entry in there.


So now I had a static IP.  Doing "dig" returned valid IP addresses.  But, I could still not "ping".  You guessed it.  There was a routing problem.  I dug around in some of the service configuration files, particularly "/lib/svc/method/net-routing-setup" and found that without DHCP,  OpenSolaris routing checks for this static route file.
Apparently, if I had real routers that supported RIP (Routing Information Protocol), OpenSolaris would discover the route out to the internet automatically.  But remember, I'm running home routers not Cisco routers. :)  I think some of them support RIP but I'll save that for another day.

In the "/etc/defaultrouter" file I put the IP address of my gateway (the router IP address) for the network my OpenSolaris machine is on.  In my case this is "".  Now I need to restart the routing by running the following command.
pfexec svcadm restart network/routing-setup

Until Next Time

So now I can get on to learning more about OpenSolaris.  Disclaimer:  I'm not an OpenSolaris or Solaris expert as some of you can already tell.  If you sysadmins out there know of better ways to accomplish what I set out to do, please send your comments.



I found myself in a similar predicament recently. In an attempt to learn more about OpenSolaris, I've been working on rebuilding my firewall / file server using OpenSolaris 2008.05. I needed the internal interface to be static and the external interface to be DHCP. Rather than use NWAM, I used the traditional network configuration.

Below, I'll use real interface names. For me the bge0 interface is internal and the iprb0 interface is external. You should be able to just replace those names with your interface names.

To configure the static interface, I added an entry into /etc/hosts for the system's hostname and static IP address. Then I created /etc/hostname.bge0 containing the full host name as it appeared in /etc/hosts.

The dynamic interface took a little research, but the final solution was easy. Simply create a file named /etc/dhcp.iprb0. That part was clear from the documentation, but it wasn't working. During boot there was a message that it couldn't configure the interface, and then the interface was left unplumbed. I finally found that I needed to create an empty /etc/hostname.iprb0. Once I did that, everything worked perfectly.



Posted by Paul Frieden on August 28, 2008 at 05:00 PM GMT #

"OpenSolaris by default uses NIS (Network Information Service) AKA YellowPages."

Curious, what makes you believe that (Open)Solaris would do such a thing?

Which naming service (Open)Solaris will use is decided at installation time by the person installing the OS, if the OS is being interactively installed. Solaris will not prefer any one of the available methods for naming resolution.

Scenario #2 is a completely automated installation, where no interaction with a human being happens (Solaris installs & configures himself completely automatically). But even in that case, the naming service will be explicitly specified in the sysidcfg(4) file by the person who configured the JumpStart(TM) infrastructure.

Posted by UX-admin on August 29, 2008 at 12:08 AM GMT #

"If you sysadmins out there know of better ways to accomplish what I set out to do, please send your comments."

What you could do is configure your DHCP server to permanently and forever reserve IP addresses for the specific MAC addresses.

Then you'd configure all the clients, AND all the servers, to use DHCP. As the address assignment in the DHCP server tables will be permanent, you have just centralized IP administration in one single point!

Additionally, if using the Sun DHCP server which comes by default with Solaris, one has the option to configure the DHCP server to send automatic updates to the DNS server; this is even documented on The DNS (in your case, BIND) server will also need to be configured to accept updates. This is a relatively trivial affair.

Sounds great so far, doesn't it?
Well, as it turns out, there is a drawback associated with this method of administration: by centrally managing all IP addresses in the DHCP server, one makes the DHCP server himself the central point of failure. The way to solve that problem is to set up a DHCP server in at least two node cluster; for example, the Sun cluster/OHAC has a special resource just for dealing with DHCP. For further information, see the Sun Cluster documentation on

Posted by UX-admin on August 29, 2008 at 12:16 AM GMT #

Has anyone tried configuring a static IP address for a wireless nic using the traditional networking (w/o nwam)? I was not able to get the dladm connect-wifi command to run automatically during the boot up when I use the traditional networking configuration. After the boot up, I would have to manually execute dladm connect-wifi to have the traffic flowing.

Posted by Keith on September 02, 2008 at 09:35 PM GMT #

thanx worked gr8 for me.... :)

Posted by gurpreet on February 05, 2009 at 06:00 AM GMT #

/etc/defaultrouter probably isn't the way to go anymore. Use route -p:

route -p add default <IP address>

which will store that in /etc/inet/static_routes, which will (also) be read by the network/routing-setup service.

Posted by Danek on February 07, 2009 at 01:43 PM GMT #

thanx worked gr8 for me.... :)

Posted by wow gold on March 12, 2009 at 12:35 AM GMT #

I have Solaris 11 Express installed, running IPv6 only.
Upon each boot, resolv.conf is overwritten and is blank.
I can edit resolv.conf, and its fine, until I have to reboot and its left empty again.

How can I keep resolv.conf?

Posted by rdicaire on December 28, 2010 at 06:18 PM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.


« July 2016