Hostname configuration on DHCP/DNS server: /etc/hosts vs. /etc/hostname

Niki Kovacs contact at kikinovak.net
Sun Mar 27 16:16:59 UTC 2011


Le 27/03/2011 16:29, Tom H a écrit :
>
> You're welcome. The contents of "/etc/hostname" and "/etc/hosts" (both
> the "127.0.0.1" and "127.0.1.1" lines) are pretty much religious
> arguments. You just have to use what works.
>

Yeah. I'm not the Sisyphus type, so I'll just flip a coin :o)

BTW, another DHCP-related question comes to my mind. Take my sample 
dhcpd.conf:

--8<---------------------------------------
authoritative;
default-lease-time 86400;
max-lease-time 86400;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1;
option domain-name "presbytere.montpezat";

subnet 192.168.1.0 netmask 255.255.255.0 {
	range 192.168.1.2 192.168.1.250;
}

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<---------------------------------------

You can see that some hosts have fixed IP addresses defined according to 
their respective MAC address. These addresses are within the range 
defined above, e. g. "range 192.168.1.2 192.168.1.250;". But sometimes I 
see configurations where these fixed addresses are given *outside* that 
range, and the configuration still seems to work.

As far as I understand, "range 192.168.1.2 192.168.1.250;" gives the 
full range of address to be handled by the DHCP server, and that 
*includes* those fixed addresses allocated according to the hardware MAC 
addresses. Correct me if I'm wrong.

Cheers,

Niki





More information about the ubuntu-users mailing list