Setting the DHCP Hostname on Linux

On October 14, 2008, in Code Monkey, by Tom

I’m always forgetting how to register my machine name with the DHCP server so I can ping my box without having to remember my IP address. Here’s how to do it on Fedora Core 9:

  1. Set the hostname: `# hostname <hostname>`
  2. Add ‘HOSTNAME=<hostname>’ to ‘/etc/sysconfig/network’ (makes the change permanent).
  3. Add ‘DHCP_HOSTNAME=<hostname>’ to ‘/etc/sysconfig/network-scripts/ifcfg-eth0′
  4. Restart the networking service: `# service network restart`

Volia! Now you can connect to your box via hostname.


Tagged with:  

4 Responses to Setting the DHCP Hostname on Linux

  1. [...] Tom Distler » Setting the DHCP Hostname on Linux To err is human, but to really foul things up you need a computer. (tags: linux networking dhcp hostname dns) [...]

  2. Sebastia says:

    you never register your host to a DHCP server … never
    you do register to a DNS server …

    DHCP server provides a “new” ip to your computer
    DNS resolves a hostname to an ip

    so, you get an IP from DHCP server, then tell it to a DNS server,
    so the rest of the world asks DNS server “what ip has” and dns server provides the correponding ip

    good luck


  3. wieland says:

    Thanks. You saved my day.


  4. jan says:

    This was just what I needed to know.


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>