DHCP作业

   1       
server1作为DHCP中继代理,添加三块网卡,server2作为DHCP服务器为三个网段的客户机分配ip地址另外增加一台windows一台linux一台网络打印机
   2
在server1上设置三块网卡
ip分配:eth0:172.17.17.1
        eth1:192.168.1.1
        eth2:192.168.2.1
   3
在server1上配置中继
   (1)
vi /etc/sysctl.conf
echo 1 > /proc/sys/net/ipv4/conf/all/bootp_relay
echo 1 > /proc/sys/net/ipv4/ip_forward
    (2)
 vi /etc/sysconfig/dhcrelay
 INTERFACES="eth0 eth1 eth2"
 DHCPSERVERS="172.17.17.2"
    (3)
chkconfig --level 2345 dhcrelay on
/etc/init.d/dhcrelay start

 

 

 


Server2作为DHCP服务器:
设置IP地址:
eth0:172.17.17.2
 
  
# vi /etc/dhcpd.conf

ddns-update-style none;
ignore client-updates;
default-lease-time 36000;
max-lease-time 86400;
option time-offset  -18000;


subnet 172.17.17.0 netmask 255.255.255.0 {

    option routers   172.17.17.1;
    option subnet-mask  255.255.255.0;
    option domain-name-servers 172.17.17.1;
    range 172.17.17.100 172.17.17.200;
    host printer {
    hardware ethernet 00:12:fc:78:AB:CD;
    fixed-address 172.17.17.250;
  }
 }


 subnet 192.168.1.0 netmask 255.255.255.0 {


    option routers   192.168.1.1;
    option subnet-mask  255.255.255.0;
    option domain-name-servers 192.168.1.1;
    range 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;
     option domain-name-servers 192.168.2.1;
     range 192.168.2.100 192.168.2.200;
}

   
   vi /etc/sysconfig/dhcpd
DHCPDARGS="eth0,eth1,eth2"       声明一下哪块网卡具有DHCP功能
 
   
  server dhcpd start   启动一下服务

你可能感兴趣的:(DHCP)