在Debian上使用DHCP中继可按以下步骤操作:
安装软件包
执行命令:sudo apt update && sudo apt install isc-dhcp-relay。
配置中继参数
编辑配置文件 /etc/default/isc-dhcp-relay,设置关键参数:
INTERFACES:指定监听的网络接口(如 eth0)。RELAY_ADDRESS:填写DHCP服务器的IP地址。RELAY_PORT:通常为67(UDP端口),可指定多个端口(如 67:68)。INTERFACES="eth0"
RELAY_ADDRESS="192.168.1.100"
RELAY_PORT="67"
```。
启动并启用服务
执行命令:
sudo systemctl start isc-dhcp-relay
sudo systemctl enable isc-dhcp-relay。
验证配置
sudo systemctl status isc-dhcp-relay。sudo journalctl -u isc-dhcp-relay。配置防火墙(可选)
若启用防火墙,需允许DHCP流量(UDP 67/68端口):
sudo ufw allow in on eth0 to any port 67 proto udp
sudo ufw allow in on eth0 to any port 68 proto udp。
说明:
INTERFACESv6 和 RELAY_ADDRESS(IPv6地址)。参考来源: