Convert Microsoft to LINUX: DHCP Client

DHCP Clients exists on almost all the various Linux, HP-UX, Solaris, Irix and other UNIX platforms. This is very important in the network real world. You want to have as much as possible, all your clients on DHCP (Dynamic Host Control Protocol) so you do not have to change the address on hundreds of servers, every time you move. This page serves as a practical guide. If I have left out your particular flavor of Linux or UNIX, please send me an email with the appropriate information.

This file in /etc/resolv.conf
should be on all systems as:
cat /etc/resolv.conf
#Madeup IP addresses and domain name, put in your own
# You may have to search more than one domain or be using multiple
# domains. Consult your network admin.

HP-UX Hosts with Operating system NOT B.11.11

This would include versions B.11.23 and greater. You only need to change one file: /etc/rc.config.d/netconf
You will see a line that says DHCP_ENABLE[0]="0"
The zero on the right denotes off, to turn on DHCP change the zero to one. If there are any lines denoting IP Addresses you can comment them out with a "#" sign as the first character. You can then reboot the machine or take the network down and back up. Note, You want your network Admin to delete any addresses in the DNS table.

Why won't DHCP work on B.11.11 systems?

I spent at least two days on this and could find nobody that could make it work. This seems to be the consensus on the internet. You will see some kind of /usr/lbin/dhcpclient -b lan0 -p -l 8 process running but it will not update the DNS table on the name server.

Red Hat/ Centos Systems

You need to go to /etc/sysconfig/network-scripts
and edit the file for the appropriate card. Careful some systems may have two cards, one going to an external network and one going to an internal private network. Pick the right one. Let us assume it is eth0 here. Here is a sample file:

cat ifcfg-eth0

# Address follows made up by me

If you see any coded IP addresses in there comment them out with the "#" sign as first character.

Gentoo Linux

Gentoo Linux is suprisingly easy of all the Linuxes out there. Simply edit /etc/conf.d/net
Make the config_eth0= ... line be
dhcpcd_eth0="-t 15"#Timeout after 15 seconds

Suse Linux

Note, alot of these procedures could be done with the GUI interface, but being an administrator you probably prefer the command line so you are getting it here.

  1. Download and install from our Network disks these 3 modules, on Suse
    wget http://path to your version of Suse /suse/ia64/dhcp-client.rpm
    wget http://path to your version of Suse /suse/ia64/dhcp.rpm
    wget http://path to your version of Suse /suse/ia64/dhcp-tools.rpm
    You probably do not need the tools, but it does not hurt to have it.
  2. rpm -i dhcp-client.rpm dhcp.rpm dhcp-tools.rpm
  3. This should automatically create a dhclient.conf file as in
    PrettySuse:/etc #
    cat /etc/dhclient.conf
    You only have to uncomment and modify one line as in below:

    # Uncomment the following line and enter your Client ID, which # should
    # have come in your mail from @Home # # send dhcp-client-identifier
    # "c32423-a"

    send host-name "PrettySuse";

    # .........
  4. Change only one line in /etc/sysconfig/network/dhcp

    cat /etc/sysconfig/network/dhcp | grep dhclient
    # Most of these options are used only by dhcpcd, not by the ISC
    #dhclient (which # If empty, dhcpcd is tried, then dhclient
    # dhclient (ISC dhclient)
    # /var/log/dhclient-script for ISC dhclient)
    ## Type: string("dhcpcd dhclient")

  5. Force dhcp client at Bootup with file below.
    Please note, I changed here to network broadcast of 139.212.xx.xx
    Also changed BOOTPROTO to 'dhcp'
    Above is a madeup network broadcast. Consult your network admin for appropriate values.
  6. cat /etc/sysconfig/network/ifcfg-eth-id-00\:11\:22\:5f\:33\:44

    ## Made up Hardware Address file name

  7. Verification
    You should see dhclient after bootup
    With ps -ef | grep dhclient
    It will reference eth0
    nslookup PrettySuse should give the new IP Address
    You can do a rcnetwork restart
    To make all these config files be read.

  8. Solaris Boxes version 10, 9 and 8

    Please allow me to start with Version 10 and work my down to Version 8 which can be the most difficult.The following steps will be done in all versions.

    1. cd /etc
      ifconfig -a
      and figure out which card you want to be the dhcp card. Note, Solaris does not use the standard eth0, but bge0 dme0 or something like that. You will do a touch with the file extension for the card as in:
      touch dhcp.bge0
      touch hostname.bge0
      Note you type in literally hostname not the name of your host. The first character will be created with zero bytes, that is fine. The next file already exists. Make sure you edit in and it has the word inet in there as in:
      cat hostname.bge0
      inet HolySolaris
    2. vi /etc/default/dhcpagent
      Uncomment the one line so it says:
    3. cat /etc/nodename
      It should say HolySolaris
      If not, vi /etc/inet/hosts
      There should only be one line: localhost loghost
      For now after DHCP goes into effect you will see the dhcpagent process running and a line added to your hostfile with the new IP address for HolySolaris
      It will have a # added by dhcp
      at the end of the second line. Delete any old host names you find before rebooting.
    The above procedure should work great for Solaris 10 and beyond. You may need to do one thing further for Solaris 9 and 8.

    1. You may find the dhcpagent is running but the DNS server has still not updated with your new IP address. Typically you see unknown for the host name when you do uname -a
      Do a cat /etc/nodename to make sure is says the correct one, i.e. HolySolaris here. If not you can force it to get the right node name, by editing two scripts underneath the /etc directory.
    2. Edit the file /etc/init.d/network
      # comment out the next line ****
      # "dhcp") hostname=`/sbin/dhcpinfo Hostname` ;;
      # Add in the following line
      "dhcp") hostname=`cat /etc/nodename` ;;

      Then, edit the file /etc/init.d/inetsvc
      # comment out the next line
      # hostname=`/sbin/dhcpinfo Hostname`
      #Add in the next line.
      hostname=`cat /etc/nodename`
    3. Note, even after doing the previous, you may find your hostname is proper, i.e. HolySolaris , but the DNS Server still refuses to register it. Your last option is to have your network admin put in your physical card address on the DNS nameserver so that when it sees that address it will register the proper host name. We had to do this for a Solaris from 2001 which was version 17 of Solaris 8.
    4. You may find that you have a second line with a route in it beginning with and a gateway name of your IP address for your card. This 224.0... route is also called the multi-interface route This will prevent nslookup holysolaris from working. The solution is to delete the route with the command below:
      [][root@holysolaris sbin]
      route -n delete -interface 224.0/4 -gateway
      (Previous is all one line.)
      The Solaris host will respond with:
      delete net 224.0/4
      [][root@holysolaris sbin]
      # netstat -rn

      Routing Table: IPv4
      Destination Gateway Flags Ref Use Interface
      -------------------- -------------------- ----- ----- ------ --------- U 1 2 hme0
      default UG 1 7 UH 14 280 lo0
      [][root@holysolaris sbin]
      # take network up and down with usual commands
      ifconfig hme0 down
      /etc/init.d/network restart
      and you are set!! # /usr/sbin/nslookup holysolaris


    Solaris Version 6

    Here is what I did , I took something off the web to force the hostname, but DNS server was still not getting updated. I typed
    ifconfig hme0 dhcp realease
    ifconfig hme0 dhcp
    Then all worked, so I stuck it in a script.
    # cat set_hostname
    HOSTNAME=`cat /etc/nodename`
    # Hey, it is kludgy , but it works.
    echo "Setting hostname to $HOSTNAME... \c"
    uname -S $HOSTNAME
    # now take DHCP up and down to get rid of the route
    echo "Cleaning up DHCP, take a deep breath and relax! "
    /usr/sbin/ifconfig hme0 dhcp release
    /usr/sbin/ifconfig hme0 dhcp
    echo "Done Om, Shanti ......"
    **** here is the symbolic link *******
    # ls -al ./S70set_hostname
    lrwxrwxrwx 1 root other 24 Feb 21 08:51 ./S70set_hostname
    -> /etc/init.d/set_hostname
    # uname -a
    SunOS javabox 5.6 Generic_105181-33 sun4u sparc SUNW,Ultra-5_10 # exit

    Irix Machines

    These machines were top quality in their prime 20 years ago. I found it is easiest here to use the GUI interface. You will be installing the proclaim dhcp client. Even after doing everything right, that is setting up the gateway, subnet mask etc. you may find proclaim is listed as a process but still has not updated the DNS nameserver. Just follow the same solution as in Solaris 8. Have the network admin use the hardware address of the card to reserve a DHCP lease and update the DNS nameserver appropriately.

    AIX Hosts

    Use the command line/GUI interface of smitty and select dhcp and enter the hostname You will type something like:
    smitty tcpip
    Sorry, IBM does not let you do config files easily so this is one time, you have to use the GUI. Do a
    netstat -rn
    to check and it should look more or less like the Solaris One above.

    VAX Multinet Hosts

    If you are using Multinet 5.1 or greater you can do the following to set up the dhcpclient
    multinet con/net
    Type the previous at the dollar prompt. You can then choose to modify the network interface
    Enable the dhcp client and type ctrl-z to exit the menu. Save the network config when it asks you. Note, you will also have to edit using the VAX EDT editor the dhclient.conf file you can see all the details here It also here as a text file. If you have Multinet, lower than this, i.e. verison 4.0 just use the same menu but type in your static IP address and your gateway under global parameters. You can launch this by typing
    multinet configure /menu
    Note , there is no dhcp client choice here. You may have problems getting the machine to reboot
    This is because old VAX hosts like version 7.1 also come up in an EFI-Shell like HP-UX boxes. To fix this as the box comes up type help you should see be able to then show device
    Select the appropriate device, there may be several starting with diaX where X is a number. If it was dia5 you wanted you would type boot dia5
    If you try all the dia devices one of them will probably work.

    Configuring HP TCPIP Services for DHCP Client

    This is the TCPIP that comes built into the old VAX hosts of about 20 years ago VMS Version 7.x. Here is how to do it:
    You can go through the menu using

    The key is to select "routing" under interfaces.
    Also make sure you enable the dhcp client for only one card, usually the first one. It will say primary. You want to ENABLE GATED and DISABLE ROUTED. You have to do this in two steps. When you enable gated, it will tell you to rename a file to
    Here is the file, you need to put in the gateway and uncomment the "static clause". You have to use the EDT editor.

    Restarting HP-UX Multiboot Boxes

    You may get an error message about log full with a warning
    This is important to clear once in a while. Upon rebooting:
    Select "efi-shell"
    errdump clear
    to get back to boot machine. "clearlogs"
    may also work.

    Sometimes the system may just sit there and not boot up
    This is because you must first select the device and tell it which system to boot. i.e.:
    type fsx: where x is your bootdisk (0, 1, 2...)
    type hpux to start hpux bootloader.

    I hope this was useful to somebody out there.