This content is submitted by a BigAdmin user. It has not been reviewed for technical accuracy by Sun Microsystems, though it may have been lightly edited to improve readability. If you find an error or would like to comment on the article, please contact the submitter or use the comment field at the bottom of the article.
Community submissions may not follow Sun trademark guidelines. For information on Sun trademarks, please see http://www.sun.com/suntrademarks/.
Configuring the DHCP Server for the Solaris OS or OpenSolaris OS
Jeppe Toustrup, June 2009
When people are going to set up a DHCP server on a UNIX or Linux system, chances are that they will use the ISC DHCP server, since it is included in
many distributions. However, it is not included with the Solaris Operating System or the OpenSolaris OS. So, in this case, people might include their own DHCP server, which is a lot different to configure.
This tech tip provides a procedure to get you started configuring a DHCP server by using the bundled DHCP server provided in the Solaris OS or the
SUNWdhcs package for the OpenSolaris OS. I will configure the DHCP server with some static entries for specific hosts,
and also with a small pool of addresses for random users.
Note: This procedure works with both the Solaris 10 OS and the OpenSolaris OS. It has not been tested on Solaris versions other than version 10.
The DHCP server is found in the Solaris OS as the SUNWdhcsr and SUNWdhcsu packages.
However, you have to install the package named SUNWdhcs in the OpenSolaris OS. This is done by running the following command:
$ pfexec pkg install SUNWdhcs
After the installation, you should start off by using the dhcpconfig command to set up the initial configuration directory to
hold the settings used by the DHCP server:
-N 192.168.0.0: Creates a new network with the specified network address
-m 255.255.255.0: Specifies the network mask to use for the network
-t 192.168.0.1: Specifies the default gateway
All the previously entered network settings are put into macros, each of which is a small assembly of configuration options. Macros make it easier
to put a group of settings on specific hosts. You can see which macros are currently created and their settings by running the following command:
$ dhtadm -P
You will see that three macros are created. One macro is named after your server's host name, and it contains the settings specified as
system-wide settings with the first dhcpconfig command.
Another macro has the name of the network you just created, and it contains the settings entered in the last command.
The last macro named Locale simply holds timezone information, with a setting claiming the amount of seconds your
local timezone differs from UTC.
As you can see from the output, the current time server is set to 127.0.0.1, which isn't going to do any good
for the DHCP clients. So we are going to correct that to 192.168.0.1, the same address used by our default gateway and DNS server.
The change is done like this:
-M: Specifies that we are going to modify a macro.
-m `hostname`: Specifies the macro we are going to modify. The shell replaces `hostname` with your server's host name.
-e Timeserv=192.168.0.1: Specifies the setting we want to change, and what it should be changed to.
Again, you can check that the setting is indeed changed with this command:
$ dhtadm -P
We are also going to alter the 192.168.0.0 macro, and set it to include the settings from the `hostname` macro:
$ pfexec -M -m 192.168.0.0 -e Include=`hostname`
The last command used to configure the DHCP server is pntadm, which sets up settings for each host on the network. The following command adds a static DHCP entry for a host:
-c "Comment": Specifies a comment for the entry, for your own convenience.
-f MANUAL: Sets the flag MANUAL in order to only assign this IP address to the MAC address specified.
-i 01001BFC92BC10: Sets the MAC address (Client_ID) for the host this entry goes to. Should be prepended
with 01 to specify that this is an Ethernet address.
-m 192.168.0.0: Specifies that this host is going to use the 192.168.0.0 macro.
-y: Verifies that the macro entered actually exists.
192.168.0.0: Specifies the network the address is assigned to.
The command to check the settings is:
$ pntadm -P 192.168.0.0
And now we add an IP address for any host on the network:
$ pfexec pntadm -A 192.168.0.10 -m 192.168.0.0 -y 192.168.0.0
The same parameters apply as before, but we have just left out a lot more options, since we don't know which host is going to get this address.
The last thing to do is to restart the DHCP server, in order for all the changes to take effect:
Jeppe Toustrup has been playing around with Linux, the Solaris OS, and various other pieces of open source software for the last ten years, and has been working professionally as a system administrator at Danish ISPs for the last five years.
The information and links on this page have been provided by a BigAdmin user. The submitter is solely responsible for such information and links. Sun is not responsible for the availability of external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. Sun will not be responsible or liable, directly or indirectly, for any actual or alleged damage or loss caused by or in connection with use of or reliance on the information posted here, or goods or services available on or through any external site or resource.
Comments (latest comments first)
Discuss and comment on this resource in the BigAdmin Wiki
Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.