Thursday, November 25, 2010

How to setup DHCP client on Debian

The Dynamic Host Configuration Protocol (DHCP) is an auto configuration protocol used on IP networks. Before we proceed let assume the hostname we are going to setup is
  1. Configure hostname:
    echo "deby01" > /etc/hostname
  2. Ensure hosts file properly resolves localhost:       localhost
    # In some circumstance it is not recommended to
    # resolve machine name to local ip address
    #  deby01
  3. Here is content of /etc/network/interfaces
    # The primary network interface
    allow-hotplug eth0
    iface eth0 inet dhcp
    # If you experience issues with obtaining
    # default gateway consider uncomment lines below.
    #       up route add default gw
    #       down route del default gw
  4. Let your dhcp client publish our name (so it can be resolved by name). Ensure the following in file /etc/dhcp/dhcpclient.conf:
    send host-name "deby01";
  5. If you experience issues with DNS you can set them manually (file /etc/dhcp/dhcpclient.conf)
    prepend domain-name-servers,;
  6. Reboot in order to changes take effect or issue the following commands:
    ifdown eth0 && ifup eth0
  7. Check your dynamically obtained ip address:
    deby01:~# ifconfig eth0 | grep inet
     inet addr: ...
If you need to setup a static ip address, take a look here.

No comments :

Post a Comment