构建DHCP服务器

 DHCP(动态主机设置协议,Dynamic Host Configuration Protocol)服务可以为大量客户机自动分配地址,提供集中管理,减轻管理和维护成本、提高网络配置效率,其基于C/S结构模式。

yum 安装DHCP服务器

yum -y install dhcp

建立配置文件
[root@mail Server]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
 

[root@mail ~]# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
option domain-name "benet.com";
option domain-name-servers 202.106.0.20;
default-lease-time 21600;
max-lease-time 43200;

subnet 192.168.20.0 netmask 255.255.255.0 {
option routers 192.168.20.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.20.10 192.168.20.100;
}
subnet 192.168.30.0 netmask 255.255.255.0 {
option routers 192.168.30.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.30.10 192.168.30.100;
}
subnet 192.168.40.0 netmask 255.255.255.0 {
option routers 192.168.40.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.40.10 192.168.40.100;
}
2. 配置中继服务器,安装dhcp软件包
[root@mail ~]#vi /etc/sysctl.conf
Net.ipv4.ip_forward = 1
[root@mail ~]#sysctl -p
[root@mail ~]#vi /etc/sysconfig/dhcrelay
INTERFACES = "eth0 eth1 eth2"
DHCPSERVERS = "192.168.20.1"
[root@mail ~]#serviice dhcrelay start
[root@mail ~]#chkconfig --level 35 dhcrelay on

 

你可能感兴趣的:(DHCP)