首先用mount 把光盘挂到/media目录下
安装rpm软件包
[root@mail Server]# rpm -ivh /media/Server/dhcp-3.0.5-23.el5.i386.rpm
建立配置文件
[root@mail Server]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
[root@mail ~]# vi /etc/dhcpd.conf //配置dhcp服务器
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;
}
中继服务器
安装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
如果客户端不能正确获取到IP就在dhcp服务器上添加两条路由记录
[root@mail ~]# route add -net 192.168.30.0/24 gw 192.168.20.2
[root@mail ~]# route add -net 192.168.40.0/24 gw 192.168.20.2