How to manage hostnames via DHCP?
Niki Kovacs
contact at kikinovak.net
Wed Mar 9 07:43:12 UTC 2011
Hi,
I'm just trying to figure out how to handle hostnames via DHCP on a
small LAN. I know how to do it with CentOS, so I'll describe the process
on my CentOS machines.
On the server side, I have a dhcpd.conf that looks like this:
--8<---------- /etc/dhcpd.conf ---------------------------------
# Options globales
ddns-update-style interim;
authoritative;
default-lease-time 86400; # un jour
max-lease-time 86400; # un jour
# Données du réseau local
option broadcast-address 192.168.1.255;
option subnet-mask 255.255.255.0;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.252;
option domain-name "presbytere.montpezat";
# Plage d'adresses dynamiques
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.250;
}
host babasse {
hardware ethernet 00:0d:61:ae:6b:8f;
fixed-address 192.168.1.1;
option host-name "babasse";
}
host bernadette {
hardware ethernet 00:0d:61:a6:e7:1e;
fixed-address 192.168.1.2;
option host-name "bernadette";
}
host raymonde {
hardware ethernet 00:20:ed:b8:e8:ec;
fixed-address 192.168.1.3;
option host-name "raymonde";
}
...
--8<------------------------------------------------
Then on the client side, every machine that gets its network
configuration via DHCP is configured like this:
--8<---------- /etc/sysconfig/network --------------
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
--8<------------------------------------------------
--8<---------- /etc/sysconfig/network-scripts/ifcfg-eth0 -
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
--8<------------------------------------------------
--8<---------- /etc/hosts --------------------------
127.0.0.1 localhost.localdomain localhost
--8<------------------------------------------------
In this example, no machine has a "static" hostname configuration.
Everything is managed centrally on the server. The 'hostname' and
'hostname --fqdn' commands work correctly, in that they return something
like 'raymonde' or 'raymonde.presbytere.montpezat'.
Now, how can I do the same thing on a 100 % Ubuntu network, version
10.04 on server and desktops?
Cheers from the sunny South of France,
Niki
More information about the ubuntu-users
mailing list