2

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

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
rogaloo
  • 21
  • 2
  • I think it is far more likely, that it pushes, only your virtual machine ignores it. A tcpdump + wireshark can show to you, exactly what is being sent by the dhcpd. – peterh Apr 15 '21 at 12:23
  • Thank you @peterh. Indeed, it seems like it is being sent to the host. Any idea why the host does not recognize/use it? – rogaloo Apr 15 '21 at 16:40
  • It depends on, how your VM is autoconfiguring your network interface. Probably it is using NetworkManager for the task. If yes, then this NetworkManager is enough smart to autoconfigure the network interface based on the dhcp response, but it is not enough smart to set up also the default domain name. – peterh Apr 15 '21 at 17:47

1 Answers1

0

The domain-name in ISC DHCP is used for DNS configuration (as also domain-name-servers option), not for configuring the local hostname. This option causes that DNS lookups from the client could omit the domain, so

host mywebsite

is interpreted as

host mywebsite.example.local

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.

Fjor
  • 76
  • 4