View previous topic :: View next topic |
Author |
Message |
Jhedron n00b
Joined: 07 Jun 2005 Posts: 45 Location: Michigan, USA
|
Posted: Tue Aug 05, 2014 3:17 am Post subject: [SOLVED] Ignore hostname from DHCP server. |
|
|
Long story short: my shiny, new wireless router has some issues so I've had to fall back on the routing capabilities of the Zyxel P-660H-D1 provided by my ISP. This is the first time I've had to use the routing capabilities of the device. Unlike every other home router I've had, the Zyxel is trying to assign hostnames to all of my devices via DHCP. It's getting annoying because hostnames like "dhcppc3" aren't all that useful to me. Since I apparently don't have access to the settings which control these hostnames, is there a way to tell Network Manager to ignore the DHCP hostname and stick with the hostname I've defined for the machine?
Relevant lines from my log:
Code: | Aug 04 22:31:33 alexandra NetworkManager[307]: <info> (lan0): DHCPv4 state changed preinit -> reboot
Aug 04 22:31:33 alexandra NetworkManager[307]: <info> address x.x.x.x
Aug 04 22:31:33 alexandra NetworkManager[307]: <info> prefix 24 (255.255.255.0)
Aug 04 22:31:33 alexandra NetworkManager[307]: <info> gateway x.x.x.x
Aug 04 22:31:33 alexandra NetworkManager[307]: <info> hostname 'dhcppc0'
Aug 04 22:31:33 alexandra NetworkManager[307]: <info> nameserver 'x.x.x.x'
Aug 04 22:31:33 alexandra NetworkManager[307]: <info> nameserver 'x.x.x.x'
Aug 04 22:31:33 alexandra NetworkManager[307]: <info> domain name ''
Aug 04 22:31:33 alexandra NetworkManager[307]: nm_ip4_config_add_domain: assertion 'strlen (domain) > 0' failed
Aug 04 22:31:33 alexandra NetworkManager[307]: <info> domain name ''
Aug 04 22:31:33 alexandra NetworkManager[307]: nm_ip4_config_add_domain: assertion 'strlen (domain) > 0' failed
Aug 04 22:31:33 alexandra NetworkManager[307]: <info> Activation (lan0) Stage 5 of 5 (IPv4 Configure Commit) scheduled...
Aug 04 22:31:33 alexandra NetworkManager[307]: <info> Activation (lan0) Stage 5 of 5 (IPv4 Commit) started...
Aug 04 22:31:34 alexandra NetworkManager[307]: <info> (lan0): device state change: ip-config -> secondaries (reason 'none') [70 90 0]
Aug 04 22:31:34 alexandra NetworkManager[307]: <info> Activation (lan0) Stage 5 of 5 (IPv4 Commit) complete.
Aug 04 22:31:34 alexandra NetworkManager[307]: <info> (lan0): device state change: secondaries -> activated (reason 'none') [90 100 0]
Aug 04 22:31:34 alexandra NetworkManager[307]: <info> NetworkManager state is now CONNECTED_GLOBAL
Aug 04 22:31:34 alexandra NetworkManager[307]: <info> Policy set 'Wired connection 1' (lan0) as default for IPv4 routing and DNS.
Aug 04 22:31:34 alexandra NetworkManager[307]: <info> Setting system hostname to 'dhcppc0' (from DHCPv4) |
And here's the hostname information for the same machine:
Code: | $ hostnamectl
Static hostname: alexandra
Transient hostname: dhcppc0
Icon name: computer-desktop
Chassis: desktop
Machine ID: xxxxxxxxxx
Boot ID: xxxxxxxxxx
Operating System: Gentoo/Linux
Kernel: Linux 3.15.8-gentoo
Architecture: x86-64 |
Last edited by Jhedron on Wed Aug 06, 2014 3:10 am; edited 1 time in total |
|
Back to top |
|
|
wraeth Developer
Joined: 08 May 2007 Posts: 72 Location: Australia
|
Posted: Tue Aug 05, 2014 2:01 pm Post subject: |
|
|
If you use dhcpcd as your DHCP client backend, the you should be able to set something up in /etc/dhcpcd.conf.
Code: | #
# Options for interface enp2s10 only
#
# This interface only below this point
interface enp2s10
# Send this hostname to the DHCP server
hostname cerberus2
|
See man dhcpcd.conf for more configuration options.
You should also double-check that your local hostname is configured correctly in the appropriate locations - /etc/conf.d/hostname for OpenRC and by using the command hostnamectl for systemd. |
|
Back to top |
|
|
Jhedron n00b
Joined: 07 Jun 2005 Posts: 45 Location: Michigan, USA
|
Posted: Wed Aug 06, 2014 3:10 am Post subject: |
|
|
wraeth wrote: | If you use dhcpcd as your DHCP client backend, the you should be able to set something up in /etc/dhcpcd.conf.
Code: | #
# Options for interface enp2s10 only
#
# This interface only below this point
interface enp2s10
# Send this hostname to the DHCP server
hostname cerberus2
|
See man dhcpcd.conf for more configuration options. |
Thanks for pointing me to dhcpcd.conf. I forgot that NetworkManager doesn't handle the DHCP stuff itself. I first tried setting the hostname explicitly, as in your example:
Code: | # Should send the current system hostname, but didn't work...
#hostname
# ...so set the hostname explicitly.
hostname alexandra |
When that didn't work, I noticed the following line:
Code: | option domain_name_servers, domain_name, domain_search, host_name |
After reading what the man page had to say about it, I tried removing host_name. That seemed to do the trick. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
Jhedron n00b
Joined: 07 Jun 2005 Posts: 45 Location: Michigan, USA
|
Posted: Fri Aug 08, 2014 9:49 pm Post subject: |
|
|
UberLord wrote: | OR, if you don't want a DHCP derivated hostname, set one! local setting > DHCP always |
I thought I did have a hostname set. I use systemd, so I ran the following when I setup my machine:
Code: | # hostnamectl set-hostname alexandra |
And I have this:
Code: | $ cat /etc/hostname
alexandra
$ hostnamectl
Static hostname: alexandra
Icon name: computer-desktop
Chassis: desktop
Machine ID: xxxxxxxxxx
Boot ID: xxxxxxxxxx
Operating System: Gentoo/Linux
Kernel: Linux 3.15.8-gentoo
Architecture: x86-64
|
Is there something else I need to do to make sure I have a hostname set? |
|
Back to top |
|
|
dE_logics Advocate
Joined: 02 Jan 2009 Posts: 2253 Location: $TERM
|
Posted: Sun Aug 02, 2015 6:54 am Post subject: |
|
|
Dhcpcd can't ignore the hostname sent by the server. I would call this a vulnerability. Time to dump dhcpcd. _________________ My blog |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
dE_logics Advocate
Joined: 02 Jan 2009 Posts: 2253 Location: $TERM
|
Posted: Sun Aug 02, 2015 2:23 pm Post subject: |
|
|
I'll get it back on board next time.
Thanks for that. _________________ My blog |
|
Back to top |
|
|
|