在 Debian 上运行 DHCP 服务(通常是 ISC DHCP Server,即 isc-dhcp-server)时,要让老旧的客户端设备(如老打印机、老交换机、老嵌入式设备、老 BIOS PXE 等)正常获取 IP,通常需要在配置上做一些“兼容性”调整。
下面按常见原因 + 对应配置方法说明。
Debian 默认常用:
apt install isc-dhcp-server
配置文件:
/etc/dhcp/dhcpd.conf
现象
packet too large解决:限制 DHCP 包大小
option dhcp-max-message-size 576;
或在全局配置里:
max-lease-time 7200;
default-lease-time 3600;
现象
解决:精简 option
避免乱加:
option domain-search "example.com";
option ntp-servers 192.168.1.1;
老设备只给最基础的:
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
}
现象
解决:关闭 RFC 4361 / 客户端 ID 兼容
deny duplicates;
ignore client-updates;
对老设备可用 MAC 绑定:
host old-pc {
hardware ethernet 00:11:22:33:44:55;
fixed-address 192.168.1.50;
}
解决:缩短租期(测试用)
default-lease-time 600;
max-lease-time 1800;
解决:确保广播正常
option broadcast-address 192.168.1.255;
并且:
authoritative 误用现象
解决:忽略 Option 82
option agent.circuit-id ignore;
option agent.remote-id ignore;
authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
default-lease-time 3600;
max-lease-time 7200;
}
host old-printer {
hardware ethernet 00:1a:2b:3c:4d:5e;
fixed-address 192.168.1.30;
}
journalctl -u isc-dhcp-server
tcpdump -i eth0 port 67 or port 68
看:
兼容旧设备的关键原则:
✅ 报文小
✅ Option 少
✅ 用广播
✅ 不用高级特性
✅ MAC 绑定最稳
如果你能告诉我:
我可以给你针对性配置。