环境
Client: 网卡1 系统:debian10
Server:
三网卡IP: 10.10.100.254
IP: 172.16.100.254
IP:192.16.100.254
实施步骤
安装
apt install -y isc-dhcp-server
设置监听网卡
如果是三网卡或者多网卡的情况下,请选择你要下发IP的网卡
nano /etc/defaults/isc-dhcp-server
修改配置文件
配置格式:
subnet *${子网:10.10.100.0}* netmask *${子网掩码:255.255.255.0}*{
range *${开始IP:10.10.100.1} ${10.10.100.50}*;
option subnet-mask *${子网掩码:255.255.255.0}*;
option routers *${网关地址:10.10.100.2}*;
option domain-name "*${域名:dhcp.com}*";
option domain-name-servers *${DNS服务器IP地址:114.114.114.114}*;
default-lease-time 3600;
max-lease-time 7200;
}
重启服务
systemctl restart isc-dhcp-server
Client网卡修改
将网卡设置为dhcp模式并重启网络服务