环境

Client: 网卡1 系统:debian10

Server:
三网卡IP: 10.10.100.254
IP: 172.16.100.254
IP:192.16.100.254

实施步骤

安装

1
apt install -y isc-dhcp-server

设置监听网卡

如果是三网卡或者多网卡的情况下,请选择你要下发IP的网卡

1
nano /etc/defaults/isc-dhcp-server

修改配置文件

配置格式:

1
2
3
4
5
6
7
8
9
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;
}

重启服务

1
systemctl restart isc-dhcp-server

Client网卡修改

将网卡设置为dhcp模式并重启网络服务