Files
systemd/test/test-network/conf/25-dhcp-server-static-hostname.network
T
Chris Down 7f9c0c31d2 sd-dhcp-server: Add Hostname= option to static leases
This adds a new `Hostname=` option to the [DHCPServerStaticLease]
section in .network files, allowing an administrator to assign a
specific hostname to a client receiving a static lease.

We automatically select the correct DHCP option to use based on the
format of the provided string:

- Single DNS labels are sent as Option 12.
- Names with multiple DNS labels are sent as Option 81 in wire format.

Fixes: #39634
2025-11-14 07:50:13 +09:00

28 lines
550 B
SYSTEMD

# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=veth-peer
[Network]
Address=10.1.1.1/24
DHCPServer=yes
IPv6AcceptRA=no
[DHCPServer]
PoolOffset=100
PoolSize=50
DefaultLeaseTimeSec=60
# Scenario 1: Option 12
# Matches veth99's default MAC (from 25-veth.netdev)
[DHCPServerStaticLease]
MACAddress=12:34:56:78:9a:bc
Address=10.1.1.200
Hostname=simple-host
# Scenario 2: Option 81
# Matches the MAC set by 25-dhcp-client-fqdn-hostname.network
[DHCPServerStaticLease]
MACAddress=92:12:01:87:11:19
Address=10.1.1.201
Hostname=fqdn.example.com