Setting Up a DHCP Client

Setting Up a DHCP Client

Configuring a network client to get addresses from your DHCP server is fairly easy. Different types of operating systems, however, have different ways of using DHCP. Here are examples for setting up Windows and Red Hat Linux DHCP clients.


  1. From most Windows operating systems (Windows 95, 98, 2000, ME, and so on), you open the Network window from the Control Panel (Start ? Settings ? Control Panel).

  2. From the Configuration tab, click the TCP/IP interface associated with your Ethernet card (something like TCP/IP ? 3Com EtherLink III).

  3. Click Properties. The Properties window appears.

  4. Click the IP Address tab and then select "Obtain an IP Address Automatically".

  5. Click OK and reboot the computer so the client can pick up the new IP address.

Red Hat Linux:

  1. While you are initially installing Red Hat Linux, click Configure using DHCP on the Network Configuration screen. Your network client should automatically pick up its IP address from your DHCP server when it starts up.

  2. To set up DHCP after installation, open the Network Configuration window (neat command).

  3. From the Network Configuration window:

    1. Click the Devices tab (on by default).

    2. Click your Ethernet device (probably eth0).

    3. Click Edit.

    4. Click the General tab.

    5. Click "Automatically obtain IP address Settings with" and select dhcp.

    6. Select OK.

    7. Select Apply.

  4. Then, from a Terminal window, type:

    # /etc/init.d/network restart

By default, a Red Hat Linux client will not accept all information passed to it from the DHCP server. The way that the Red Hat client handles DHCP server input is based on settings in the /etc/sysconfig/network-scripts/ifup script. If the client has DHCP turned on, when the system starts up networking, the ifup script runs the dhcpcd command as follows:

  • If the dhcpcd client process is currently running, the dhcpcd command sends a signal to it so that it asks the DHCP server to renew the lease on the IP address.

  • If no host name is set on the client (or if the host name is set to localhost), the -H option is passed to dhcpcd to indicate that it should accept the host name supplied by the DHCP server. (If the host name is already set, the client will not reset the host name from the server.)

  • Any new DNS server assignments are accepted by the client. If your DNS servers are already configured in the /etc/resolv.conf file, then you can have the -R option passed to dhcpcd to prevent it from updating that file with new DNS server information. (To do this, add PEERDNS=no to the /etc/sysconfig/network file on the client.)

To change how the dhcpcd command works to accept information from the DHCP server, you can pass options to the dhcpcd command. Do this by adding arguments to the DHCPCDARGS variable in the /etc/sysconfig/network configuration file. For example, DHCPCDARGS="-d" causes the ifup script to run dhcpcd in debug mode so that messages are sent to the /var/log/messages file. (Type man dhcpcd to see other dhcpcd options.)

The dhcpcd daemon assumes that your DHCP server is accessible on your first Ethernet interface (eth0). If you want the client to get its DHCP information from a different interface, you can add the interface name (eth1, eth2, etc.) to the dhcpd command line. For example, to do this you could add DHCPCDARGS=eth1 to the /etc/sysconfig/network file.

Part IV: Red Hat Linux Network and Server Setup