If the machine is connected to the network during the installation of the OS (Solaris in this case), the operating system takes care of setting up the dhcp (Dynamic Host Configuration Protocol) client for us. But if the machine is not hooked up to a network during the installation, we may have to set it up on our own once the machine is ready to use the network services. Infact it is a very simple process to setup and run dhcp client, which in turn takes care of getting the dynamic IP, DNS etc., from a DHCP server
All we need to do is to create couple of files for the ethernet interface.
- To get the interface name for ethernet, type dmesg | grep ether. Let's assume that it is elxl0
- Create an empty file called /etc/hostname.<ether interface> eg., touch /etc/hostname.elxl0
Creating this file ensures that the interface gets plumbed. By plumbing, it implements the TCP/IP stack ie., the OS sets up the streams needed for TCP/IP to use the device and makes it ready for the DHCP software to do its stuff
Behind the scenes: During the boot process, the OS reads all the /etc/hostname.* files and plumbs the devices. Once plumbed, the devices are configured by reading the /etc/hosts and the /etc/netmasks file
- Next step is to create /etc/dhcp.<ether interface>. eg., touch /etc/dhcp.elxl0
This file can be empty if you want to accept the defaults, but may also contain one or both of the following directives:
By default, ifconfig will wait for 30 sec for the DHCP server to respond and then the boot process continues, while the interface gets configured in the background. Specifying the wait directive tells ifconfig not to return until the DHCP has responded. The primary directive indicates to ifconfig that the current interface is the primary one, if you have more than one interface under DHCP control. If you have only one interface under DHCP control, then it is automatically the primary one; so primary is redundant, although it's permissible
It is important to note that the dhcp client daemon,
dhcpagent will be started only if /etc/dhcp.interface file exists. With these files in place, subsequent reboots will place the ethernet interface under DHCP control and the machine will be ready to access network services
Acknowledgements & suggested reading:
- Setting up a Solaris DHCP client by Rich Teer
- Configuring network interface cards by Lance Spitznet
- Solaris DHCP client at Sun Solaris documentation web site