Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am having a lot of trouble setting up a hostname for my home server for use within my home network. My home server is running Ubuntu 12.04 LTS and all packages are up to date. Management of this server is done using SSH only, no GUI is present. I want to use the servers host name mainly for accessing web pages and samba shares from several Windows computers and Android devices.

My homeserver acquires its (static) IP address from a Linksys WRT54GC using DHCP. Both /etc/hosts and /etc/hostname have added "homeserver" as a host name. I did not tamper /etc/dhcp/dhclient.conf, because the default settings should work according to Ubuntu sources.

The router is only able to resolve host names for DHCP clients. It does not let me edit the client names like some newer products can. All host names of my Windows PC are recognized by the router. I am also able to ping those machines using their host names. So everything seems to be all right on my router.

The Linksys WRT54GC is cascaded to an ISP configured DSL modem/router. All internet traffic is routed to the Linksys, as it is placed in the DMZ of the DSL modem/router. The IP address of the DSL modem/router is 192.168.1.1 and the Linksys is 192.168.2.1. The Linksys is configured using a static IP address. The DNS server for the Linksys is configured to 192.168.1.1. All clients linked to the Linksys report having 192.168.1.1 as the DNS server.

This issue might have something to do with this bug.
I have installed the isc-dhcp-client package from 13.04, but that did not do the trick. If this bug still exist in Ubuntu 12.04 LTS (and 13.04), I would like to know a work around.

Edit #1

The OP posted the contents of the file: /etc/dhcp/dhclient.conf:

# Configuration file for /sbin/dhclient, which is included in Debian's
#   dhcp3-client package.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
#   man page for more information about the syntax of this file
#   and a more comprehensive list of the parameters understood by
#   dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
#   not leave anything out (like the domain name, for example), then
#   few changes must be made to this file, if any.
#

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name "<hostname>";
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
    domain-name, domain-name-servers, domain-search, host-name,
    netbios-name-servers, netbios-scope, interface-mtu,
    rfc3442-classless-static-routes, ntp-servers,
    dhcp6.domain-search, dhcp6.fqdn,
    dhcp6.name-servers, dhcp6.sntp-servers;
#require subnet-mask, domain-name-servers;
#timeout 60;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/etc/dhcp3/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;

#alias {
#  interface "eth0";
#  fixed-address 192.5.5.213;
#  option subnet-mask 255.255.255.255;
#}

#lease {
#  interface "eth0";
#  fixed-address 192.33.137.200;
#  medium "link0 link1";
#  option host-name "andare.swiftmedia.com";
#  option subnet-mask 255.255.255.0;
#  option broadcast-address 192.33.137.255;
#  option routers 192.33.137.250;
#  option domain-name-servers 127.0.0.1;
#  renew 2 2000/1/12 00:00:01;
#  rebind 2 2000/1/12 00:00:01;
#  expire 2 2000/1/12 00:00:01;
#}
share|improve this question
    
Alain, it is to me unclear what you try to achieve in the end. Do you want to be able to access something like http://homeserver/you_pages from your windows machines and is that not working? In other words, how do you want to use that hostname and which machine/box is not resolving it (and I think that it is not the router not knowing that bothers you). –  Anthon May 21 '13 at 10:24
    
I think it would help if you posted the contents of /etc/dhcp/dhclient.conf. Also, how are you managing the connection? Are you using a GUI like NetworkManager or wicd or doing it via /etc/network/interfaces? –  Joseph R. May 21 '13 at 11:05
    
@Anthon: I updated my question with the requested information (Please say so if this comment is unnecessary for notifying you of any changes in the question. I am relatively new here.) –  Alain May 21 '13 at 11:32
    
@Joseph R.: I am managing the server using SSH only. I will post you the contents of /etc/dhcp/dhclient.conf later. –  Alain May 21 '13 at 11:34
1  
@Joseph R.: Please find the the contents of /etc/dhcp/dhclient.conf on this PasteBin. –  Alain May 21 '13 at 20:44
show 4 more comments

2 Answers 2

If your DHCP server supports it you might want to try and have your client send the desired hostname that it wants. Add the following to the file /etc/dhcp/dhclient.conf:

send host-name 'your-hostname-here';

If you want to send a fully qualified domain name (fqdn) - myhost.mydomain.com instead of just myhost you need to add these lines too:

send fqdn.fqdn "myhost.mydomain.com.";
send fqdn.encoded on;
send fqdn.server-update off;
also request fqdn, dhcp6.fqdn;

Edit #1

The OP was asked to try the following commands and report back:

dig <hostname> @<router ip>

The OP reported that this worked so it was determined to try adding the router's IP explicitly to his dhclient.conf file.

Edit #2

It was suggested to try adding the following to the /etc/dhcp/dhclient.conf file:

prepend domain-name-servers 192.168.2.1;

Edit #3

Given you're able to now ping servers using your router's DNS server when you added 192.168.2.1, but not the internet, I would suggest you add some external DNS servers as well using the above prepend option like so:

prepend domain-name-servers 192.168.2.1, 8.8.8.8, 8.8.4.4;

This will add your router as a DNS resolver along with Google's DNS servers.

share|improve this answer
    
Thank you for your suggestion. However, the following line already exists in the default /etc/dhcp/dhclient.conf of Ubuntu 12.04 LTS: send host-name "<hostname>"; Where <hostname> is substituted by the contents of /etc/hostname To rule things out; I have also explicitly configured the hostname without effect. –  Alain May 21 '13 at 13:33
    
The hostnames of all Windows PC's do show up correctly on the router and can be pinged from each other. Does it make any sense to use the dig command from the server to any of the Windows PC's or does it have to be a Linux machine as well? –  Alain May 21 '13 at 13:51
    
I was able to resolve the IP address of a Windows PC using the dig <hostname> @<router ip> command as indicated. I also used the command with the hostname of the server. The router actually answered with the correct IP address! I am clueless... –  Alain May 21 '13 at 20:32
1  
That's actually good news. So the router's DHCP server is getting the hostname and associating it w/ the IP address it's assigning to it. So the issue might be that the server's /etc/resolv.conf file doesn't include the router's IP address as the first DNS server to query against. Did the dig command work on the Linux server too? –  slm May 21 '13 at 20:35
    
@Alain You may also want to note whether the changes you make to /etc/resolv.conf are persistent after reboot because they may be overwritten by NetworkManager or similar software unless you define your connection in /etc/network/interfaces. –  Joseph R. May 21 '13 at 23:02
show 13 more comments

In addition to the useful recommendations in the other answers, the avahi suite (aka Zeroconf aka Apple Bonjour) is useful in passing around and resolving local mDNS information.

Having avahi-daemon running on my home network hosts allows me to

ping tallguy.local

which required zero configuration beyond establishing a hostname tallguy.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.