solaris dhcp configuration

Upload: sourav-jyoti-das

Post on 08-Aug-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/22/2019 Solaris DHCP Configuration

    1/2

    IntroductionOne of the problems that can arise when trying to use a Solaris box as a DHCP client is that by default, the server is expected to supply a hostname, in addition to all the other stuff (like IP address, DNS servers, etc.). Most cable modemsand 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 below.

    Setting up DHCPThere are two ways of using DHCP:

    DHCP has limited controlDHCP has full controlThe 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 provider has a habit of changing DNS name server IP addresses on you (like mine does!), so I'll concentrate on that here. I have a script to automate the first method, 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 software to do its stuff.

    Next, you create /etc/dhcp.le0. This file can be empty if you want to accept thedefaults, but may also contain one or both of these directives:

    wait time, and

    primaryBy default, ifconfig will wait 30 seconds for the DHCP server to respond (afterwhich time, the boot will continue, while the interface gets configured in the background). Specifying the wait directive tells ifconfig not to return until theDHCP has responded. time can be set to the special value of forever, with obvious meaning. I use a time value of 300, which seems to be long enough for my cable provider.

    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 only have 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 hostnameActually, there's one snag: most (if not all) cable modem DHCP servers don't provide you with a hostname (even if they did, odds are it won't be one you want anyway!). This wouldn't be a problem, except that the boot scripts (/etc/init.d/rootusr in particular) try to be clever, and set your hostname to "unknown" in this case, which is not at all useful!

  • 8/22/2019 Solaris DHCP Configuration

    2/2

    The trick is to change your hostname back to the right one, preferably without changing any of the supplied start-up scripts, which are liable to be being stomped on when you upgrade or install a patch. You've also got to do it early enoughin the boot process, so that rpcbind, sendmail and friends don't get confused by 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_hostname.

    Starting with Solaris 10, the preceding paragraph can be ignored. Instead, justmake sure that the hostname you want to use is in /etc/nodename; the contents ofthat file will then be used to set the hostname. (Note that it is essential that 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 possible to tell the DHCP software not to request a hostname from the DHCP server. Todo this, remove the token 12 from the PARAM_REQUEST_LIST line in /etc/default/dhcpagent. (/etc/default/dhcpagent describes what the default tokens are; 12 is the 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 modemin no time!