You are on page 1of 2

Introduction One of the problems that can arise when trying to use a Solaris box as a DHCP cl ient is that

by default, the server is expected to supply a hostname, in additio n to all the other stuff (like IP address, DNS servers, etc.). Most cable modems and home routers don't supply a (usable) hostname, so it gets set to "unknown". This page describes how to get around that. (Where this page says "cable modem" , "DSL modem" can be substituted.) This page assumes that le0 is the interface you using for your DHCP connection. Substitute hme0 or whatever interface you're actually using in the examples belo w. Setting up DHCP There are two ways of using DHCP: DHCP has limited control DHCP has full control The first case may be where you want to use your own /etc/resolv.conf and so on, with a minimum of hassle. The second case would be the normal situation, especially if your cable modem pr ovider has a habit of changing DNS name server IP addresses on you (like mine do es!), so I'll concentrate on that here. I have a script to automate the first me thod, should you want to use it. You'll need to change the DEFAULT_ADDR and INTE RFACE variables as required. The first thing to do is to create an empty /etc/hostname.le0, like this: > /etc/hostname.le0 Creating this file ensures that the interface gets plumbed, ready for the DHCP s oftware to do its stuff. Next, you create /etc/dhcp.le0. This file can be empty if you want to accept the defaults, but may also contain one or both of these directives: wait time, and primary By default, ifconfig will wait 30 seconds for the DHCP server to respond (after which time, the boot will continue, while the interface gets configured in the b ackground). Specifying the wait directive tells ifconfig not to return until the DHCP has responded. time can be set to the special value of forever, with obvio us meaning. I use a time value of 300, which seems to be long enough for my cabl e provider. The primary directive indicates to ifconfig that the current interface is the pr imary one, if you have more than one interface under DHCP control. If you only h ave one interface under DHCP control, then it is automatically the primary one, so primary is redundant (although it's permissible). With these files in place, subsequent reboots will place le0 under DHCP control: you're ready to go! Unknown hostname Actually, there's one snag: most (if not all) cable modem DHCP servers don't pro vide you with a hostname (even if they did, odds are it won't be one you want an yway!). This wouldn't be a problem, except that the boot scripts (/etc/init.d/ro otusr in particular) try to be clever, and set your hostname to "unknown" in thi s case, which is not at all useful!

The trick is to change your hostname back to the right one, preferably without c hanging any of the supplied start-up scripts, which are liable to be being stomp ed on when you upgrade or install a patch. You've also got to do it early enough in the boot process, so that rpcbind, sendmail and friends don't get confused b y using the wrong hostname. To solve this problem, put this little script in to /etc/init.d/set_hostname, with a symbolic link to it from /etc/rc2.d/S70set_host name. Starting with Solaris 10, the preceding paragraph can be ignored. Instead, just make sure that the hostname you want to use is in /etc/nodename; the contents of that file will then be used to set the hostname. (Note that it is essential tha t the hostname you put into /etc/nodename is terminated with a carriage return. Breakage will happen if this is not the case.) Also, from Solaris 8 it is possib le to tell the DHCP software not to request a hostname from the DHCP server. To do this, remove the token 12 from the PARAM_REQUEST_LIST line in /etc/default/dh cpagent. (/etc/default/dhcpagent describes what the default tokens are; 12 is th e hostname, 3 is the default router, 6 is the DNS server, and so on.) With these modifications in place, reboot, and you'll be using your cable modem in no time!