CentOS 6.5下DHCP服务器搭建与配置
CentOS 6.5下DHCP服务器搭建与配置
一、安装配置dhcp
[root@localhost ~]# yum -y install dhcp
[root@localhost ~]# cd /usr/share/doc/dhcp-4.1.1/
[root@localhost dhcp-4.1.1]# cp -ra dhcpd.conf.sampl /etc/dhcp/dhcpd.conf
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
option domain-name "wxw.com"; DNS服务器域名
option domain-name-servers 192.168.1.24; DNS服务器的IP地址
default-lease-time 360000; 默认租约时间
max-lease-time 720000; 最大租约时间
ddns-update-style none;
log-facility local7;
#地址池配置
subnet 192.168.1.0 netmask 255.255.255.0 { 分配的网段192.168.1.0/24
range 192.168.1.100 192.168.1.230; 分配的ip地址区间;
option routers 192.168.1.1; 网关ip;
option broadcast-address 192.168.1.255; 广播地址;
}
#指定主机给其分配ip
host boss { boss为主机名,随便取;
hardware ethernet 00:0C:29:6C:A6:F8; 主机网卡的mac地址;
fixed-address 192.168.1.10; 给其分配的ip;
}
二、启动dhcpd服务器
[root@localhost ~]# /etc/init.d/dhcpd restart
关闭 dhcpd: [确定]
正在启动 dhcpd: [确定]
三、查看端口监听状态
[root@localhost ~]# netstat -ltunp |grep dhcpd
udp 0 0 0.0.0.0:67 0.0.0.0:* 5346/dhcpd