dhcp端口号67
修改dhcp的配置文件
可以是先把里面的注释删除掉
subnet 192.168.88.0 netmusk 255.255.255.0 {
option routers 192.168.88.2;
option domain - name - servers 192.168.88.2 ;
range 192.168.88.100 192.168.88.100;
}
修改完配置文件后,启动dhcp:systemctl start shcpd
查看端口号:netstat -lutnp |grep :67
(停止服务:systemctl stop dhcpd,卸载安装的包rpm -e dhcpd)
写一个dhcp安装的脚本:
rpm -q dhcp &> /dev/null
if [ $? -ne 0 ]
then
yum install dhcp
fi
echo "subnet 192.168.88.0 netmusk 255.255.255.0 {
option routers 192.168.88.2;
option domain - name - servers 192.168.88.2 ;
range 192.168.88.100 192.168.88.100;
}
" >/etc/dhcp/dhcpd.conf
systemctl start dhcpd
退出脚本先给脚本加执行权限:chmod +x dhcp.sh