dhclient exit hooks

Posted on

I'm trying to fix some DHCP issues with an AWS instance of RHEL 7 (and will probably need to do the same on RHEL 8 soon). The AWS documentation for the DHCP options set for this servers states:

"Enter a domain name (such as example.com). Some Linux operating systems accept multiple domain names separated by spaces. However, Windows and other Linux operating systems treat the value as a single domain. To avoid unexpected behavior in a VPC that has instances with multiple operating systems, specify only one domain name."

There are two domains and they get concatenated when setting the hostname in the resolve.conf. The previous administrator set up a kludgy hack to update the resolv.conf and restart Network Manager.

In trying to find a better way to do it, I was trying to set up DHCP exit hooks in /etc/dhcp/dhclient-exit-hooks.d. I added the script at https://netbeez.net/blog/linux-dhcp-hooks-network-engineers/ to take a look at the variables passed to the hooks, but I don't get any output file. I double checked the file and everything looks okay. Is there any way to tell whether this is being called and if there are an errors trying to process it?

Also, is there any other way to go about this? Some way in systemd?