DHCP是什么?
DHCP动态主机地址管理协议(Dynamic Host Configuration Protocol)是一种基于UDP协议且仅限用于局域网内使用的网络协议,最主要的用途是为局域网内部设备或网络供应商自动分配IP地址等网卡参数,通常会应用在大型的局域网环境中或局域网内存在比较多的移动办公设备。
安装与配置
[root@test88 ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[root@test88 ~]# uname -rm
2.6.32-504.el6.x86_64 x86_64
[root@test88 ~]# yum install -y dhcp
[root@test88 ~]# vim /etc/dhcp/dhcpd.conf
dns-update-style none;
ignore client-updates;
subnet 172.16.1.0 netmask 255.255.255.0 { range 172.16.1.50 172.16.1.150;
option subnet-mask 255.255.255.0;
option routers 172.16.1.88;
option domain-name-servers 172.16.1.88;
default-lease-time 21600;
max-lease-time 43200; }
[root@test88 ~]# /etc/init.d/dhcpd start
[root@test88 ~]# chkconfig dhcpd on
分配固定IP
[root@test88 ~]# vim /etc/dhcp/dhcpd.conf ddns-update-style none;
ignore client-updates;
subnet 172.16.1.0 netmask 255.255.255.0 { range 172.16.1.50 172.16.1.150;
option subnet-mask 255.255.255.0;
option routers 172.16.1.88;
option domain-name-servers 172.16.1.88;
default-lease-time 21600;
max-lease-time 43200; host test {
hardware ethernet 00:0c:29:b0:c3:bb;
fixed-address 172.16.1.100;
} } [root@test88 ~]# /etc/init.d/dhcpd restart