Hostname disappeared after upgrade to Fedora 7

Q I have a Linux box which I use as a server for testing web development projects (it's in my DMZ, so I use a dedicated machine rather than my main machine). When it was running an older Fedora, Windows machines were able to access the machine by its hostname. All seemed well. Now, I upgraded the machine to Fedora 7 and its hostname is unavailable - pinging webdev (the server name) no longer works but I can still access it through its IP address.

A I suspect you're setting the address statically instead of using DHCP. When you let the computer request an address via DHCP, the DHCP server keeps track of the hostname and IP address, as DHCP servers generally act as local name servers too, so any other computer can resolve the hostname to an IP address. You have three choices, the first is to set the IP address by DHCP. I understand you may want a fixed address for this box, but many DHCP servers have an option to map specific MAC addresses or hostnames to given IP addresses, so you get an effectively static address but working within the DHCP framework.

You set the hostname to be sent to the DHCP server in the network-config window. Your second option is to record the IP address and hostname in the hosts file of every other computer on the network. The file is /etc/hosts on the Linux systems and C:\windows\hosts on (yes, you guessed it) Windows. The format of the file is one line per IP address containing the address, full hostname and then any aliases, all separated by white space, like this

192.168.1.27 webserver.example.com webserver
192.168.1.43 mail.example.com              mail ftp.example.com ftp

The third option is to run your own local DNS server. This is nowhere near as complicated as it sounds, as long as you don't try to set up a full-blown Internet DNS server like Bind. Dnsmasq, which I use on my home network, is available from www.thekelleys.org.uk/dnsmasq and is very easy to set up. Its default setup is to use the /etc/hosts file from the computer running it to provide local DNS resolution and pass other requests to the name servers listed in /etc/resolv.conf. Just install it on one computer on your network (not the one in the DMZ) and set all the others to use that computer as their DNS server.

Dnsmasq can work as a DHCP server too (SmoothWall Express uses it) and it is a lot more configurable than built-in DHCP servers of most routers. If you have a computer that is always on, using this to provide DNS and DHCP for your network makes life easier; make sure you disable the DHCP server in the router to avoid conflicts. The dnsmasq configuration file is well documented (see man page and comments in the file) with sensible defaults. It may need no configuration at all for you, but if it does, the options are explained clearly.

Back to the list