23-李雷

server1的配置

ifconfig eth0 172.17.17.23 netmask 255.255.255.0
route add default getway 172.17.17.1  
yum install 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;       
option time-offset -12000; 
default-lease-time 24000;  
max-lease-time 43200;       

subnet 172.17.17.0 netmask 255.255.255.0
{     
        option routers                  172.17.17.1;
        option subnet-mask              255.255.255.0;
        range dynamic-bootp 172.17.17.100 172.17.17.200;
        host print
     {     
                hardware ethernet 12:34:56:78:AB:CD;
                fixed-address 172.17.17.101;
            }
}
subnet 192.168.1.0 netmask 255.255.255.0
{   
 option routers                  192.168.1.1;
        option subnet-mask              255.255.255.0;
        range dynamic-bootp 192.168.1.100 192.168.1.200;
}
subnet 192.168.2.0 netmask 255.255.255.0
{   
        option routers                  192.168.2.1;
        option subnet-mask              255.255.255.0;
        range dynamic-bootp 192.168.2.100 192.168.2.200;
}


/etc/init.d/dhcpd start    


dhcp中继代理server1的配置
yum install dhcp-*    

 vim /etc/sysconfig/dhcrelay      

 
INTERFACES="eth0 eth1 eth2" 
DHCPSERVERS="172.17.17.23" 

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

service dhcrelay start  


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