系统平台
系统为 Centos7.7 x86_64 ,已安装 rpm 和 yum 等工具
安装
查询是否已安装软件包,已安装可以跳过此步骤
rpm -q dhcp
如果未安装则通过 yum 安装
yum install -y dhcp
也可以搜索安装其他 dhcp 服务器软件包
yum search all dhcp
配置
配置网卡接口为静态 ip
ifconfig eth1 192.168.11.1
或者编辑网卡配置文件,设置静态 ip
vi /etc/sysconfig/network-scripts/ifcfg-eth1
配置 dhcp 服务器
vi /etc/dhcp/dhcpd.conf
# 写入如下配置
subnet 192.168.11.0 netmask 255.255.255.0 {
authoritative;
range 192.168.11.10 192.168.11.254;
option routers 192.168.11.1;
option broadcast-address 192.168.11.255;
option domain-name-servers 192.168.11.1;
option domain-name "test.cn";
default-lease-time 60;
max-lease-time 60;
}
# 静态 IP 绑定
host hostname {
hardware ethernet 00:90:4c:53:30:50;
fixed-address 192.168.11.100;
}
控制
开启 dhcp 服务
systemctl start dhcpd
关闭 dhcp 服务
systemctl stop dhcpd
开机自启动设置
systemctl enable dhcpd # 禁用自启动 systemctl disable dhcpd
评论列表 (0条):
加载更多评论 Loading...