Router 作为 DHCP 服务器:
1、配置 Router 地址:
    Route> enable                                                
Router# configure terminal
    Router(config)# no ip domain lookup                                //关闭域名查询功能;
    Router(config)# hostname GateWay                                 //路由器命名为GateWay;
    GateWay(config)# interface gi0/1                                   //进入gi0/1端口;
    GateWay(config-if)# no shutdown                                   //开启端口;
    GateWay(config-if)# ip address 192.168.1.254 255.255.255.0         //端口配置IP地址;
2、配置 DHCP 地址池:
   GateWay(config)# ip dhcp pool A                                 //建立名为A的DHCP地址池;
   GateWay(dhcp-config)# network 192.168.1.0 255.255.255.0         //DHCP自动分配IP的范围;
   GateWay(dhcp-config)# default-router 192.168.1.254                //配置自动分配IP的网关;
   GateWay(dhcp-config)# dns-server 8.8.8.8                         //配置自动分配的DNS地址;
3、启动 DHCP 服务 :
  GateWay(config)# service dhcp 
4、配置 DHCP 客户端 :
     点击 - ”DHCP“ ;
5、验证命令:
       在服务器端的验证命令:
                   GateWay# show ip dhcp binding 
                   GateWay# show running-config 
       在客户端的验证:
                    运行--> cmd ---> ipconfig /all       
6、特殊地址处理:
    内网有业务服务器,编址如下:
          web - 192.168.1.20    /24
          email  - 192.168.1.75  /24
          FTP - 192.168.1.88    /24 
          OA - 192.168.1.166    /24 
    DHCP 地址排除命令:
      GateWay(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10
                                            (low地址)   (high地址)
         注意:
            low 地址与 high 地址不同,则表示一段连续的IP;如果相同,则表示”排除一个地址“;
如果要执行这一步操作的时候,先排除地址,再在路由器上启动DHCP服务。
=============================================================
  
Switch 作为 DHCP 服务器:
1、配置交换机的IP地址: 
(二层交换机上端口不可配置地址,所以我们地址配置在VLAN1上)
Switch> enable
Switch# configure termainal
  Switch(config)# hostname SW1
  SW1(config)# interface vlan 1                                 //进入VLAN1 的端口;
  SW1(config-if)# no shutdown                                  //开始端口;
  SW1(config-if)# ip address 192.168.1.250 255.255.255.0        //为端口配置IP地址;
2、配置 DHCP 地址池 :
  SW1(config)# ip dhcp pool B                                 //建立名为B的DHCP地池;  
SW1(dhcp-config)# network 192.168.1.0 255.255.255.0 //DHCP自动分配IP的范围; SW1(dhcp-config)# default-router 192.168.1.1 //配置自动分配IP的网关;
SW1(dhcp-config)# dns-server 8.8.8.8 //配置自动分配的DNS地址;
3、启动 DHCP 服务 :
  SW1(config)# service dhcp
4、配置 DHCP 客户端 ; 
5、验证:
    SW1# show ip interface brief  // 查看交换机接口IP地址配置;
    SW1# show running-config     //查看 DHCP 的相关配置命令;
    SW1# show ip dhcp binding //查看DHCP服务器分配成功的IP地址;
=============================================================
服务器上配置DHCP:
  
       
原文:http://13395140.blog.51cto.com/13385140/1972966