Page MenuHomeVyOS Platform

DHCP server can not start
Closed, DuplicatePublicBUG

Description

Faced issue when update from 1.2.8 to 1.3-epa1. The DHCP server can not run and do it silently

set interfaces ethernet eth1 address '198.51.100.254/24'
set interfaces ethernet eth1 address '192.168.100.254/24'

set service dhcp-server shared-network-name HOME-LAN subnet 198.51.100.0/24 default-router '198.51.100.254'
set service dhcp-server shared-network-name HOME-LAN subnet 198.51.100.0/24 range MAIN start '198.51.100.100'
set service dhcp-server shared-network-name HOME-LAN subnet 198.51.100.0/24 range MAIN stop '198.51.100.200'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 default-router '192.168.100.254'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 domain-search 'example.com'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 lease '86400'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 name-server '1.1.1.1'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 range 0 start '192.168.100.10'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 range 0 stop '192.168.100.150'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 static-mapping device1 ip-address '192.168.100.13'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 static-mapping device1 mac-address '50:00:00:0f:00:00'

CLI commit command does not return any warning or errors when shared-network-name HOME-LAN2 has IP range from the secondary IP address on the interface.
But when I configure only striped part without shared-network-name HOME-LAN , CLI return error message

set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 default-router '192.168.100.254'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 domain-search 'example.com'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 lease '86400'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 name-server '192.168.100.254'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 range 0 start '192.168.100.10'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 range 0 stop '192.168.100.150'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 static-mapping device1 ip-address '192.168.100.13'
set service dhcp-server shared-network-name HOME-LAN2 subnet 192.168.100.0/24 static-mapping device1 mac-address '2c:cc:cc:cc:cc:cc'
[email protected]# commit
[ service dhcp-server ]
None of the configured subnets have an appropriate primary IP address on any
broadcast interface configured, nor was there an explicit listen-address
configured for serving DHCP relay packets!

[[service dhcp-server]] failed
Commit failed

Details

Difficulty level
Normal (likely a few hours)
Version
1.3-epa1
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

Not sure why we should check the primary ip address, but to fix it possible to change:

if is_subnet_connected(subnet, primary=False)

It was described there T3610 and requires more tests.

The difference in why it works in 1.2 and not in 1.3
1.3 Uses "test" configuration before apply. https://github.com/vyos/vyos-1x/blob/e687502b1cf4a3e15c562a3662afcbe0776b1fe7/src/conf_mode/dhcp_server.py#L284
So there is no a partly configuring service.
Mayve we should to check in verify section.

All subnets that share the same physical network should be declared within a shared-network declaration

Oct 18 22:24:01 r1-roll dhcpd[4985]: Interface eth2 matches multiple shared networks