Score:0

Dynamic DNS updates via DHCP on CentOS

in flag

I'm running mostly Ubuntu VMs in an vSphere cluster where a VLAN is managed by a Windows DHCP and DNS. From the Ubuntu VMs I can update the DNS records in the Windows DNS to point the dynamic IP to its hostname (set in /etc/hostname) with dhcp-identifier: mac addition in /etc/netplan/00-installer-config.yaml:

cat /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens160:
      dhcp4: true
      dhcp-identifier: mac
  version: 2

After these modification a call to dhclient -r also updates the DNS record to point to the newly dhcp-assigned IP address.

But now I want to achieve the same DNS update functionality in a CentOS 7 VM. First I setted /etc/hostname to myhost.example.tld and rebooted the machine. After that I tried to change serveral variables in /etc/sysconfig/network-scripts/ifcfg-ens192:

  • Setting MACADDR to either preserve or permanent
  • Setting DHCP_HOSTNAME to myhost but not DHCP_FQDN
  • Setting DHCP_FQDN to myhost.example.tld but not DHCP_HOSTNAME

Every change to ifcfg-ens192 were followed by the invocation of dhclient -r ens192; dhclient ens192 and a reboot.

Score:0
in flag

I just found the solution. One needs to create /etc/dhcp/dhclient.conf and add send fqdn.fqdn = gethostname(); to it. After that, a dhclient -r; dhclient sends the hostname in the DHCP* message.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.