我使用的是 systemd 网络版本 253.1。我的 Linux 5.15 机器上有 2 个以太网端口,我想在第二个端口上设置一个 DHCP 服务器。我已成功完成此操作,并为 eth1 进行了以下配置。
工作 DHCP 服务器配置:
[Match]
Name=eth1
Type=ether
[DHCPV4]
DUIDType=link-layer
ClientIdentifier=mac
[Network]
Address=172.1.17.1/24
DHCPServer=yes
#IPMasquerade=ipv4
[DHCPServer]
PoolOffset=1
PoolSize=8
现在,我想要将范围更改为以下内容:
[Match]
Name=eth1
Type=ether
[DHCPV4]
DUIDType=link-layer
ClientIdentifier=mac
[Network]
#
# 10.1.193.24/29
#
# Network Address: 10.1.193.24
# Usable IP Range: 10.1.193.25 - 10.1.193.30
# Broadcast Address: 10.1.193.31
#
Address= 10.1.193.24/29
DHCPServer=yes
#IPMasquerade=ipv4
[DHCPServer]
PoolOffset=2
PoolSize=5
但是,我收到如下所示的错误:
[root@machine ~]$ networkctl status eth1 -l
* 3: eth1
Link File: n/a
Network File: /etc/systemd/network/eth1.network
State: routable (failed)
Online state: online
Type: ether
Path: platform-30bf0000.ethernet
Hardware Address: 00:01:c0:37:6d:56 (Company, Ltd.)
MTU: 1500 (min: 46, max: 9000)
QDisc: mq
IPv6 Address Generation Mode: eui64
Number of Queues (Tx/Rx): 8/8
Auto negotiation: yes
Speed: 1Gbps
Duplex: full
Port: tp
Address: 10.1.193.24
fe80::201:c0ff:fe37:6d56
Activation Policy: up
Required For Online: yes
DHCP6 Client DUID: DUID-EN/Vendor:0000ab1180dd9f24e9435b570000
Offered DHCP leases: none
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Received new foreign route (configured): dst: 10.1.193.24/29, src: n/a, gw: n/a, prefsrc: 10.1.193.24, scope: link, table: main(254), proto: kernel, type: unicast, nexthop: 0, priority: 0, flags: n/a
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Addresses set
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: link_check_ready(): dynamic addresses or routes are not configured.
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Configuring DHCP Server.
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Failed to configure address pool for DHCPv4 server instance: Numerical result out of range
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Failed to configure DHCP server: Numerical result out of range
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: Failed
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: State changed: configuring -> failed
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: LLDP Rx: Stopping LLDP client
Aug 12 14:33:07 machine systemd-networkd[654]: eth1: NDISC: Stopping IPv6 Router Solicitation client
我检查了各种 CIDR 计算器,我相信我的配置文件参数是有效的。
为什么 networkd 不接受我的配置文件?