View previous topic :: View next topic |
Author |
Message |
Princess Nell l33t
Joined: 15 Apr 2005 Posts: 916
|
Posted: Tue Nov 01, 2016 8:52 pm Post subject: Networkmanager fails to set correct hostname |
|
|
I recently noticed that networkmanager changes the hostname when I'm connecting wirelessly.
Back in the day, I set the hostname in NetworkManager.conf via the keyfile plugin, but this is now deprecated. According to the Gentoo wiki, if networkmanager was built with USE=dhclient, the hostname can be set via /etc/dhcp/dhclient.conf. I have all that and the hostname still gets changed to "myhostname-6205". In fact, the NM-created config file for dhclient under /var/lib/NetworkManager shows that the "send host-name" option has been merged correctly.
nmcli show for the wireless connection says ipv4.dhcp-send-hostname = yes, but ipv4.dhcp-hostname is unset, so I went ahead and explicitly set ipv4.dhcp-hostname for this connection. This is being ignored.
With the current, 1.4 version of NM, what is a correct and working method to lock down the hostname? I find it really annoying that I need to set the hostname in many different places because NM doesn't play nice with the Gentoo default of /etc/conf.d/hostname. |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2034 Location: United Kingdom
|
Posted: Wed Nov 02, 2016 9:03 pm Post subject: |
|
|
I am using NetworkManager 1.4.0-r1 with dhclient on my laptop running Gentoo Stable, and the hostname is specified in the following files:
Code: | # cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=keyfile
rc-manager=none
dhcp=dhclient
no-auto-default=*
[keyfile]
hostname=myhostname |
Code: | # cat /etc/hosts
127.0.0.1 myhostname localhost
::1 myhostname localhost |
Code: | # cat /etc/dhcp/dhclient.conf
send host-name "myhostname";
supersede host-name "myhostname"; |
This works fine. _________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.
Fitzcarraldo's blog |
|
Back to top |
|
|
Princess Nell l33t
Joined: 15 Apr 2005 Posts: 916
|
Posted: Wed Nov 02, 2016 11:00 pm Post subject: |
|
|
Check out NetworkManager.conf(5). The hostname key is deprecated and has no effect. Your setup works because of the settings in dhclient.conf (https://wiki.gentoo.org/wiki/NetworkManager).
I fixed my problem, it was caused by the dhcp server config. It only became a problem when the hostname key got deprecated. I'm guessing this happened in 1.2. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|