NetworkManager: Disable Sending Hostname to DHCP Server

Edit /etc/NetworkManager/NetworkManager.conf file to contain the following default settings for new connections:
[connection]
ipv4.dhcp-send-hostname=false
ipv6.dhcp-send-hostname=false
Disable sending hostname to DHCP server for already existing connections:
nmcli -t -f uuid connection | while read uuid; do
 nmcli connection modify $uuid \
 ipv4.dhcp-send-hostname false \
 ipv6.dhcp-send-hostname false
done
Restart NetworkManager to apply the settings:
systemctl restart NetworkManager

2 comments:

  1. Editing default settings in NetworkManager.conf only works for certain properties (those mentioned in `man NetworkManager.conf`). It doesn't work for dhcp-send-hostname for example.

    Restarting NetworkManager is almost always wrong too. To reload NetworkManager.conf do `killall -SIGHUP NetworkManager`. To re-apply configuration changes re-activate the connection in question (`nmcli connection up`, `nmcli device connect`, or `nmcli device reapply`).

    ReplyDelete
  2. Thanks Thomas! What would be the best way to disable dhcp-send-hostname for new connections by default?

    ReplyDelete