I have installed the DHCP server (isc-dhcp-server) on my Ubuntu 20.04. The client computer (also a Ubuntu 20.04 Desktop machine) gets assigned IP address, but id doesn't get the assigned domain-name (defined via option domain-name "example.local";
)
My dhcpd.conf file looks like this:
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# DHCP configuration for dynamic IP assignment:
subnet 192.168.5.0 netmask 255.255.255.0 {
option routers 192.168.5.3;
option subnet-mask 255.255.255.0;
option domain-search "example.local";
option domain-name-servers 8.8.8.8, 4.4.4.4;
option domain-name "example.local";
range 192.168.5.10 192.168.5.15;
}
# Static IP assignment
host moj-klient-so-statickou-ipeckou {
hardware ethernet 08:00:27:29:09:9F;
fixed-address 192.168.5.240;
server-name "myclient.example.local";
}
ddns-update-style none;
I have tried commenting out the static IP assignment to try if the dynamic IP assignment would fix the issue, but the result is always the same, specifically resulting in this output on the client machine (which proves that there is no domain-name assigned to the client machine):
client@client-VirtualBox:~$ hostname
client-VirtualBox
client@client-VirtualBox:~$ hostname -f
client-VirtualBox
client@client-VirtualBox:~$ hostname -A
client@client-VirtualBox:~$ domainname
(none)
client@client-VirtualBox:~$ dnsdomainname
client@client-VirtualBox:~$ ypdomainname
ypdomainname: Local domain name not set
client@client-VirtualBox:~$
Does anybody have any idea why is this happening?
Thank you
Best Answer
The
domain-name
in ISC DHCP is used for DNS configuration (as alsodomain-name-servers
option), not for configuring the local hostname. This option causes that DNS lookups from the client could omit the domain, sois interpreted as
AFAIK, there is no simple remote mechanism for changing the internal hostname of a host (stored for Linux/Unices in
/etc/hostname
and configured by the admin during installation). In any case, even if we added the domain in the hostname file, it is not used for internal processing. The other location where the hostname is specified in the operating system configuration is in the file/etc/hosts
, that is used to make static DNS resolution of hosts, and associates the IP local address of the host with the hostname.In some cases, the hosts report their own names to the DNS server for easier resolution/access from other hosts, but as this is an external, unsafe operation, and its prone to name duplication, it is discouraged (not in Windows AD, I think), and also not alters local config.