如果我理解这个“问题” (systemd-networkd DHCP 服务器忽略 SendOptions #15780),则可以配置 SystemD 来处理网络启动。但是,我无法找到有关该功能的更多信息。
我目前使用的是配置最少的 DHCPD 服务器,如果可以将其移动到 DHCPD 服务器就好了systemd-networkd
,它可以处理我的环境中的所有其他网络功能。
# /etc/dhcpd.conf
allow booting; # How is this defined in systemd-networkd?
allow bootp; # How is this defined in systemd-networkd?
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative; # How is this defined in systemd-networkd?
option architecture code 93 = unsigned integer 16; # I think this corresponds to SendOption=93:uint16:architecture
host client_computer {
hardware ethernet a1:b2:c3:d4:e5:f6; # This should be captured with [Match] MACAddress=a1:b2:c3:d4:e5:f6
fixed-address 192.168.1.101; # I think this corresponds to something like SendOption=???:ipv4address:192.168.1.101
next-server 192.168.1.100; # This should be defines as [Network] Address?
option host-name "clientname"; # I think this corresponds to something like SendOption=12:string:clientname
option root-path "/srv/tftp"; # I think this corresponds to something like SendOption=17:string:/srv/tftp
if option architecture = 00:07 {
filename "grub/x86_64-efi/core.efi"; # I think this corresponds to SendOption=67:string:grub/x86_64-efi/core.efi
}
else {
filename "grub/i396-pc/core.0"; # I think this corresponds to SendOption=67:string:grub/i396-pc/core.0
}
}
看来我需要“选项”代码,但是在哪里可以找到它们?有规格吗? - 找到他们 :)
SystemD NetworkD文档。
到目前为止我所拥有的:
#allow booting; = ? # Not necessary?
#allow bootp; = ? # Not necessary?
#authoritative; = ? # Not necessary?
[Match]
MACAddress=a1:b2:c3:d4:e5:f6
[Network]
DHCP=no
DHCPServer=true
Address=192.168.1.100/24 # DHCP server IP
[DHCPv4]
ClientIdentifier=mac
[DHCPServer]
PoolOffset=3
PoolSize=7
BootServerAddress=192.168.1.100/24
#SendOption=93:uint16:architecture # Failed to parse DHCP uint16 data, ignoring assignment: architecture # Not necessary?
#SendOption=???:ipv4address:192.168.1.101
SendOption=12:string:clientname # 12 "Hostname"
SendOption=17:string:/srv/tftp # 17 "Root Path"
# BootFilename=grub/i396-pc/core.0 # Sane as code 67
# SendOption=67:string:grub/x86_64-efi/core.efi
SendOption=67:string:grub/i396-pc/core.0
[DHCPServerStaticLease]
MACAddress=a1:b2:c3:d4:e5:f6
Address=192.168.1.101
更新#1
使用tcpdump -i <INTERFACE> -nn -s0 -v -A udp port 67
我可以看到 SystemD NetworkD DCHP 服务器正在与客户端交互!
但是,系统无法启动,问题似乎是未将预期的静态 IP 地址分配给客户端。
该[DHCPServerStaticLease]
部分似乎没有效果。我在 <= 253 中发现了一些有关错误的信息systemctl --version
,并添加了解决方法ClientIdentifier=mac
。不过,这应该不是必需的,因为我运行的是 255 版本。
哦,我添加了Pool*
参数,但 DHCP 服务器仍然分配相同的 IP (192.168.1.242)。