Search This Blog

Tuesday, July 19, 2011

1-2-3 DHCP

            Today I just wanted to document here the quickest and easiest way of setting your Solaris box as a DHCP client. Setting up a Sun Solaris Server to receive its IP address from a DHCP Server is fairly straight forward and is infact just a matter of setting up files on your Solaris Server.

dhcpagent is the dhcp client thats running on your Solaris operating system. With this in place create the following file:


1. Create the /etc/hostname. <interface>

This will be an empty file

sun1# touch /etc/hostname.e1000g0
                                                                  

Repeat the above for all the avaliable interface cards on which you would like to have the IP from DHCP.


2. Create the /etc/dhcp.<interface>

This is also an empty file

sun1# touch /etc/dhcp.e1000g0  
                                                           

but you can also use it to specify how long ifconfig should be waiting for a DHCP-server reply before giving up and continuing with Solaris boot.

sun1# cat /etc/dhcp.e1000g0    
wait 60 ( default 30 sec)            ------> (Can be any value or forever)
primary                                                ------> (To notfy ifconfig about primary interface incase you have more tha one interface)


3. Specify your system name

It has to be specified in /etc/nodename. This name is going to be used as your hostname in case your DHCP-server does not return your hostname in reply to your DHCP-request.
                       
sun1# cat > /etc/nodename 
sun2                         


Reboot your system, and it all should work !!!

As simple as that, 1-2-3 DHCP





Appendix A:

Problem: Unknown hostname

            Actually, 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!

Solution: Add the hostname to /etc/nodename as mentioned earlier.


Appendix B: Tunable dhcpagent parameters.

Below is the file which needs to be modifed to have changes according to requirments.

                                                           
            /etc/default/dhcpagent
                                                             

Most important parameter value attribute is below.

PARAM_REQUEST_LIST=1,3,6,12,15,28,43

This variable tells dhcpagent what to request for from DHCP server.
Each value in the above list has specific meaning.

    1 = subnet mask
    3 = Default Router
    6 = DNS Server
    12 = hostname
    15 = DNS Domain Name
    28 = broadcast address
    43 = Encapsulated Vendor options

If you doesn't want the client to request for hostname delete number 12 followed by its comma (,) symbol

No comments:

Post a Comment