dhcp

server2的配置
设置server2的地址eth0 172.17.17.2
安装dhcp并启动
配置/etc/dhcpd.conf
ddns-update-style none;
default-lease-time 18800;
max-lease-time 37600;
ignore client-updates;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers  192.168.1.254;
        range   192.168.1.3 192.168.1.252;
}
subnet 192.168.2.0 netmask 255.255.255.0 {
        option routers  192.168.2.254;
        range   192.168.2.3 192.168.2.252
}
subnet 172.17.17.0 netmask 255.255.255.0 {
        option routers  172.17.17.254;
        range   172.17.17.3 172.17.17.252;  
             host print{
                          hardware ethernet 00:0C:29:74:D7:19
                          fixed-address 172.17.17.3
}
}


server1的配置
安装dhcp服务并启动
设置ip地址  eth0 172.17.17.1 eth1 192.168.18.1.1 eth2 192.168.18.2.1
vim /etc/sysconfig/dhcrelay 

 
INTERFACES="eth0 eth1 eth2"
DHCPSERVERS="172.17.17.2"

echo 1 >/proc/sys/net/ipv4/ip_forward

service dhcrelay start


客户端测试
linux利用dhclient 设备名称   获取IP地址
		dhclient -r      释放IP地址
windows设网卡为自动获取

你可能感兴趣的:(DHCP)