Beyond DHCP with DNS and Routing in OpenSolaris
By David Botterill on Aug 28, 2008
BackgroundFirst, 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 AddressThe 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:
I changed it to look like this:pfexec vi /etc/nwam/llp
e1000g0 static 192.168.1.17
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."ath0 dhcp
Since I changed NWAM, I have to restart nwamd (the NWAM daemon).
pfexec svcadm restart nwam
Getting DNS to Work CorrectlySince 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 "yahoo.com" and "davidbotterill.com" (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.
The DNS client is already running. I know this because I ran this command.pfexec cp /etc/nsswitch.dns /etc/nsswitch.conf
and saw this resultsvcs -a | grep dns
If you remember from networking 101, the DNS client uses "/etc/resolv.conf" to find the "nameserver". So I ranonline 14:17:45 svc:/network/dns/client:default
made sure I had this entry in there.pfexec vi /etc/resolv.conf
RoutingSo now I had a static IP. Doing "dig yahoo.com" returned valid IP addresses. But, I could still not "ping yahoo.com". 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./etc/defaultrouter
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 "192.168.1.1". Now I need to restart the routing by running the following command.
pfexec svcadm restart network/routing-setup