Page MenuHomeVyOS Platform

Bad hostnames in /etc/hosts with static-mapping in dhcp server config
Closed, ResolvedPublicBUG

Description

Issue description:

Using static mappings in the dhcp server config section allows to hand the same "reserved" IP to the same hosts whenever they connect. If service dhcp-server hostfile-update is set, the /etc/hosts will get updated with the hostname and IP address upon successful connection.

However, since the DHCP configuration also has a shared-network-name, this name, followed by an underscore, will preceed the host name and thus break resolution.

Example:

set service dhcp-server hostfile-update
set service dhcp-server shared-network-name WIFI subnet 192.168.XX.YY/24 static-mapping myhost ip-address 192.168.XX.ZZ
set service dhcp-server shared-network-name WIFI subnet 192.168.XX.YY/24 static-mapping myhost mac-address 00:11:22:33:44:55
set service dhcp-server shared-network-name WIFI subnet 192.168.XX.YY/24 domain-name mydomain.local
set service dhcp-server shared-network-name WIFI subnet 192.168.XX.YY/24 domain-search mydomain.local
commit

Resulting entries in /etc/hosts:

192.168.XX.YY	WIFI_myhost.mydomain.local.mydomain.local
192.168.XX.YY	WIFI_myhost.mydomain.local

Expected behavior:

There should only be one additional entry in /etc/hosts:

192.168.XX.YY	myhost.mydomain.local

Workaround:

Disable hostfile updates:

delete service dhcp-server hostfile-update
commit && save

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.3-rolling-202004111646 (self-built, d64011558e3257-dirty)
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

rps claimed this task.
rps added a subscriber: rps.

A work-around for this was added in 1.2.6 and I verified it's working in 1.3.0-rc1

https://phabricator.vyos.net/T103

If you want static binding hostnames to not include the shared-network-name prefix you need to also enable:

set service dhcp-server host-decl-name

A larger review of DHCP and DNS service configuration in the future is probably needed and is taking place in https://phabricator.vyos.net/T659 but for this specific issue I think we can close out this bug.

erkin set Issue type to Bug (incorrect behavior).Aug 30 2021, 7:05 AM
erkin removed a subscriber: Active contributors.