rhel5-dhcp服务和dhcp中继代理

29_李炜

一、安装dhcp服务
yum install dhcp
二、配置dhcp配置文件
复制模板文件
cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

vim /etc/dhcpd.conf
#全局配置项
ddns-update-style interim;
ignore client-updates;
default-lease-time 21600;
max-lease-time 43200;
#172.17.29.0作用域配置
subnet 172.17.29.0 netmask 255.255.255.0 {
option routers 172.17.29.1;
option subnet-mask 255.255.255.0;
option time-offset -18000;
#ip地址池
range dynamic-bootp 172.17.29.10 172.17.29.250;
#保留ip地址
host print {
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 172.17.29.254;
}
}
#配置192.168.29.0作用域
subnet 192.168.29.0 netmask 255.255.255.0 {
option routers 192.168.29.254;
option subnet-mask 255.255.255.0;
option time-offset -18000;

range dynamic-bootp 192.168.29.3 192.168.29.250;

}
#配置192.168.69.0作用域
subnet 192.168.69.0 netmask 255.255.255.0 {
option routers 192.168.69.254;
option subnet-mask 255.255.255.0;
option time-offset -18000;

range dynamic-bootp 192.168.69.10 192.168.69.250;

}
三、配置dhcp服务器网卡ip地址
ip地址:172.17.29.2
网关:172.17.29.1
子网掩码:255.255.255.0
四、启动dhcp服务
service dhcpd start
#查看dhcp端口
cat /etc/service |grep bootps
#查看dhcp状态
service dhcpd status
五、配置中继代理服务器
#中继代理有三块网卡,ip地址分别为:
eth0:172.17.29.1
eth1:192.168.29.1
eth2:192.168.69.1
#网卡重新启动
service network restart
#中继代理配置文件
vim /etc/sysconfig/dhcrelay
# Command line options here
INTERFACES="eth0 eth1 eth2"
DHCPSERVERS="172.17.29.2"
#启动dhcp中继代理服务
service dhcrelay start
#启用网卡转发功能
echo 1 > /proc/sys/net/ipv4/ip_forward
六、客户端测试

 

你可能感兴趣的:(DHCP)