D*10-DHCP服务的搭建
- 需求:
- 为OutsideCli客户端网络分配地址,地址池范围:81.6.63.110-81.6.63.190/24
- 域名解析服务器:按照实际需求配置DNS服务器地址选项
- 网关:按照实际需求配置网关地址选项
安装dhcp服务:
apt-get install -y isc-dhcp-server
配置静态IP地址:
cat /etc/network/interfaces
添加:
auto ens33
iface ens33 inet static
address 81.6.63.100
netmask 255.255.255.0
gateway 81.6.63.254
重启网卡:
systemctl restart networking
查看ip地址配置:
ip add
修改监听网卡:
vim /etc/default/isc-dhcp-server
17 INTERFACESv4="ens33"
备份配置文件:
cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak
修改配置:
vim /etc/dhcp/dhcpd.conf
ddns-update-style none;
subnet ${子网:81.6.63.0} netmask ${子网掩码:255.255.255.0}{
range ${开始IP:81.6.63.110} ${81.6.63.190};
option subnet-mask ${子网掩码:255.255.255.0};
option routers ${网关地址:81.6.63.254};
option domain-name "${域名:kill.com}";
option domain-name-servers ${DNS服务器IP地址:81.6.63.100};
default-lease-time 3600;
max-lease-time 7200;
}
启动dhcp服务:
systemctl restart isc-dhcp-server
关闭虚拟网卡的dhcp服务:
debian10客户端测试,配置配置网卡信息:
cat /etc/network/interfaces
添加:
auto ens33
iface ens33 inet dhcp
查看客户端获取的ip:
ip add
大功告成!