Sunday, May 25, 2008

Solaris DNS

After saving the files from the last broken solaris, I need to reinstall the Solaris again. But this time, I didn't get that luck so that everything was smoothy. The network is broken. I have dual network cards in that box. One plugin for external, and the other integrated for internal. It only gets an IP 10.0.0.x and cannot work on the external one. I bet the plugg-in network card is broken. So I hook the external cable to the integrated network card. It can get an external IP now, but the DNS server address 2.35 is wrong. It can browse google by 61.233.169.104. But it can not go any further with DNS broken.

Without network, Solaris is a lonely isolated island. Even the sky is grey.

The solaris is default using the facility NWAM to auto configure the network. I have tried to switch to GNOME network configuration tool, it doesn't work that well. So I have to research in NWAM and make it work right.

For more details you can check the pages:
http://opensolaris.org/os/project/nwam/
and
http://docs.sun.com/app/docs/doc/806-1386/6jam5ahnd?a=view

Generally speaking, most of the websites introduce the way to configure DNS in solaris is to modify the related configuration file: /etc/resolv.conf and /etc/nsswitch.conf.
/etc/resolv.conf is to specify the DNS server, search domain, etc.
sample:
search clarkson.edu
nameserver 128.153.128.2
nameserver 128.153.4.2


/etc/nsswitch.conf is to specify the resolution order. To resolve an address, it has many ways: files, dns, mdns, etc.
key part of a sample
hosts: files dns mdns
ipnodes: files dns mdns

Originally, hosts option only has files, we need to add dns and mdns after it to provide more resolution methods.

How does DNS work in Solaris?
When there is an web address to be resolved, the DNS client in solaris FIRST consults the /etc/nsswitch.conf file to see which to look into first. In this example, the presumed order is local file first, DNS server second.
THEN, if the DNS client consults the local file and does not find an entry, the client consults the /etc/resolv.conf file to look through the name resolution search list and the address of the local DNS server.

It seems that as long as we make these two configure files right, then it is done. However, Solaris doesn't work as Linux does. Linux working style is to modify the configuration, and then restart the service, then all will be good. Solaris style works differently. Everything is in framework. No manually modifying configuration files but there are always tools or facilities to provide consistent modification.

Once the facility nwam can obtain IP from DHCP server, then the DNS should also work properly now. But there is another problem for Clarkson Network. The DHCP server in Clarkson gives me the 2.35 which is not the DNS server at all(I also tried ubuntu, the same result). The key problem is that Clarkson has multiple DNS servers. If it can broadcast and collect all the DNS server responses, then 2.35 is not a problem any more.

Solaris has the facility mdnsd (multicast DNS daemon)but it doesn't automatically run after booting. It is to broadcast to discover the DNS servers.

To make it work, first /etc/nsswitch.conf should be modified to add mdns after hosts option.
Then, to start the service by the following command:
# svcadm enable svc:/network/mdns:default
As the DNS daemon will cache the file. So once the configuration is done, Solaris needs to REBOOT.
-----------------------------------------ADDON-----------------------------------------------------------------------------------
The network interfaces in Solaris is stored in the file /etc/nwam/llp (LLP)
# cat /etc/nwam/llp
bge0 dhcp
rge0 dhcp

The host name and domain is stored in the file /etc/hosts
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain solaris

No comments: