Thursday, June 30, 2011

Getting a DHCP Linux Host to Broadcast Its Name

When set to using DHCP, the IP address of the machine can change.  When running a server that can be annoying so in the past, I've generally assigned it a static IP and edit all the other machines' /etc/hosts file to give a name that points to the server.  Instead of keep doing this, I decided to have the Linux server broadcast its name to the local network.

Edit /etc/sysconfig/network-scripts/ifcfg-eth0 by adding DHCP_HOSTNAME=<your machine name here>.

This is the location for Fedora so your distribution might be different.  ifcfg-eth0 is dependent on whatever network adaptor you want to config (i.e. if you're using a wireless adaptor it'll have a different name).

Finally, restart the network and your server should be found by your other machines simply by its name.

No comments:

Post a Comment