How to get hostnames via DHCP with a "classic" network configuration ?

Nicolas Kovacs info at microlinux.fr
Mon Oct 31 15:36:01 UTC 2011


Hi,

I've just setup a small LAN consisting of a server running Ubuntu 10.04 
Server and a bunch of clients running Ubuntu 11.10.

On the server I installed dhcp3-server, and here's the relevant 
configuration :

--8<----- /etc/dhcp3/dhcpd.conf ----------------------------------
# /etc/dhcp3/dhcpd.conf
authoritative;
default-lease-time          86400;
max-lease-time              86400;
option broadcast-address    192.168.2.255;
option subnet-mask          255.255.255.0;
option routers              192.168.2.1;
option domain-name-servers  192.168.2.1;
option domain-name          "presbytere.montpezat";

subnet 192.168.2.0 netmask 255.255.255.0 {
   range 192.168.2.100 192.168.2.200;
}

host alphamule {
   hardware ethernet 00:19:DB:44:C5:94;
   fixed-address 192.168.2.2;
   option host-name "alphamule";
}

host bernadette {
   hardware ethernet 00:0D:61:A6:E7:1E;
   fixed-address 192.168.2.3;
   option host-name "bernadette";
}

host raymonde {
   hardware ethernet 00:20:Ed:B8:E8:EC;
   fixed-address 192.168.2.4;
   option host-name "raymonde";
}

host balthazar {
   hardware ethernet 00:19:E0:83:3A:C1;
   fixed-address 192.168.2.5;
   option host-name "balthazar";
}

host lifebook {
   hardware ethernet 00:0B:5D:46:F2:10;
   fixed-address 192.168.2.6;
   option host-name "lifebook";
}

host bebette {
   hardware ethernet 00:27:19:F1:BC:3A;
   fixed-address 192.168.2.7;
   option host-name "bebette";
}
--8<--------------------------------------------------------------

On a stock Ubuntu install on the client side, I simply remove any 
hardcoded hostname reference, e. g.:

# rm /etc/hostname

And then I edit /etc/hosts down to a one-liner that looks like this:

127.0.0.1 localhost.localdomain localhost

This setup works very nice.

Now until Ubuntu 10.04, I could easily remove NetworkManager and use the 
"classic" network configuration with /etc/network/interfaces, like this:

# apt-get autoremove --purge network-manager*
# rm -rf /var/lib/NetworkManager

And then add an according stanza in /etc/network/interfaces:

auto eth0
iface eth0 inet dhcp

And that was it. Clients would get their hostnames very well in this setup.

Only starting from Ubuntu 10.10 (or 11.04?), things changed, and when I 
replace NetworkManager by a "classic" setup, I can't get client machines 
to get their hostnames from the server.

This is quite annoying, since more often than not, I have to setup 
networks in schools or public libraries, where it's much better to 
manage everything centrally.

Any idea how I could get this to work?

Cheers from France,

Niki Kovacs

-- 
Microlinux - Solutions informatiques 100% Linux et logiciels libres
7, place de l'église - 30730 Montpezat
Web  : http://www.microlinux.fr
Mail : info at microlinux.fr
Tél. : 04 66 63 10 32




More information about the ubuntu-users mailing list