Battling “new-host,” Round Two

With the home server‘s hostname problem apparently resolved, I was able to access its Samba shares from Windows machines using the desired syntax (\\jtown\...). (Configuring the shares will be the topic of the next posting.) However, I had difficulties connecting to the server by name with SSH.

Router identifies server as “new-host”

A check of the administration GUI on my Verizon FiOS router, which also functions as a DNS and DHCP server, uncovered the issue: The router was still calling the server “new-host”! As a result, DNS lookups on “jtown,” the desired hostname, were failing.

DHCP request omits hostname

Wireshark review of traffic between the server and the router confirmed the underlying problem: the server was not including its hostname in its DHCP request for an IP address. So, the router was choosing to continue calling it “new-host.”

The Red Hat documentation looked like it would guide me to a solution. It includes a section on DHCP client configuration, which talks about a promising DHCP_HOSTNAME option. The only problem was, the option belongs in a device configuration file in /etc/sysconfig/network-scripts, but with NetworkManager handling my networking, there was no such file! How, then, to proceed?

The Fix

The information in Red Hat bug #723374 put me on the path to a fix. If you’re facing the same problem I did, hopefully this approach will work for you, too.

If you’re using a networking device other than wired Ethernet on eth0, you’ll want to change the filename in step #1 accordingly.

  1. Create an /etc/dhclient-eth0.conf file. (Putting the file in /etc/dhcp works, too, but unlike /etc, non-root users can’t list that directory’s contents.) Creating the file while su‘ed to root will give non-root users privileges to read it but not write to it, which is desirable.
  2. Setting up the file per the dhclient.conf man page, write out a send host-name statement with the desired hostname (comments are supported with #):
    # Added by D. Manchester, 2 May 2012
    send host-name "jtown";
  3. Restart the NetworkManager service (sudo service NetworkManager restart).

DHCP request includes hostname

With that additional configuration file in place, Wireshark indicates that the server includes its hostname in its DHCP request. And indeed, the router now identifies the server correctly, and DNS lookups on “jtown” work!

Router identifies server as “jtown”

Shares Accessible Even Without Fix?

The fact that the home server’s Samba shares were accessible via “jtown” even without this fix offers a useful reminder: While it apparently can work with DNS, SMB/CIFS, the protocol implemented by Samba, does not require DNS for name resolution. Rather, a client can discover a server via NetBIOS broadcast, and indeed, responding to such broadcasts is the primary purpose of Samba’s nmbd daemon.

Next: Configuring Samba!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s