路由器配置要求:
企业内部计算机使用DHCP的方式获得IP 地址设置 DHCP 的地址为192.168.1.0/24 网络地址设置默认网关为 192.168.1.1,域名为ewao.cn,DNS 服务为61.128.114.133 IP 地址有效期为2 天
路由器配置如下:
- Router(config)#int f0/0
- Router(config-if)#ip add 192.168.1.1 255.255.255.0
- Router(config-if)#no sh
- Router(config-if)#exit
- Router(config)#ip dhcp excluded-address 192.168.1.1 //需要排除路由器的接口既网关地址
- Router(config)#ip dhcp pool DHCP //创建DHCP池
- Router(dhcp-config)#network 192.168.1.0 /24 //宣告可分配网段
- Router(dhcp-config)#default-Router 192.168.1.1 //设置客户端的默认网关
- Router(dhcp-config)#dns-server 61.128.114.133 //设置客户端DNS地址
- Router(dhcp-config)#lease 2 //地址租期
- Router(dhcp-config)#domain-name ewao.cn //客户端所在域
- Router(dhcp-config)#end
客户端配置:
路由器配置之IPV6的DHCP服务器配置:
- Router(config)#ipv6 unicast-routing
- Router(config)#ipv6 cef
- Router(config)#ipv6 dhcp pool v6
- Router(config-dhcp)# prefix-delegation pool v6pool
- Router(config-dhcp)# dns-server 2001:470:20::2
- Router(config-dhcp)# domain-name ewao.cn
- Router(config-dhcp)#end
随之采用的IPV6技术也需要在客户端做相应配置。
路由器配置之验证:
- Router#show ip dhcp database
- Router#show ip dhcp binding
- Bindings from all pools not associated with VRF:
- IP address Client-ID/ Lease expiration Type
- Hardware address/
- User name
- 192.168.1.214 0100.e04c.3900.d1 Mar 07 2002 11:39 PM Automatic
- 192.168.1.215 01f0.def1.16c1.11 Mar 07 2002 07:27 PM Automatic
- 192.168.1.216 0100.26c7.6a28.1a Mar 07 2002 08:07 PM Automatic
- 192.168.1.219 01c4.4619.75b9.c0 Mar 07 2002 04:52 PM Automatic
- 192.168.1.221 0100.3018.b003.f1 Mar 07 2002 05:22 PM Automatic
- 192.168.1.222 0152.4153.2000.0c29. Mar 07 2002 04:48 PM Automatic
- 7ded.8700.0000.0000.
- 00
- 192.168.1.223 0152.4153.2000.0c29. Mar 07 2002 04:48 PM Automatic
- 7ded.8700.0001.0000.
- 00
- 192.168.1.224 0152.4153.2000.0c29. Mar 07 2002 04:48 PM Automatic
- 7ded.8700.0002.0000.
- 00
- 192.168.1.225 0152.4153.2000.0c29. Mar 07 2002 04:48 PM Automatic
- 7ded.8700.0003.0000.
- 00
- 192.168.1.226 0152.4153.2000.0c29. Mar 07 2002 04:48 PM Automatic
- 7ded.8700.0004.0000.
- 00
- 192.168.1.227 0152.4153.2000.0c29. Mar 07 2002 04:48 PM Automatic
- 7ded.8700.0005.0000.
- 00
- 192.168.1.228 0152.4153.2000.0c29. Mar 07 2002 04:48 PM Automatic
- 7ded.8700.0006.0000.
- 00
- 192.168.1.229 0152.4153.2000.0c29. Mar 07 2002 04:48 PM Automatic
- 7ded.8700.0007.0000.
- 00
- 192.168.1.230 0152.4153.2000.0c29. Mar 07 2002 04:48 PM Automatic
- 7ded.8700.0008.0000.
- 00
- 192.168.1.231 0152.4153.2000.0c29. Mar 07 2002 04:48 PM Automatic
- 7ded.8700.0009.0000.
- 00
- 192.168.1.232 0100.242c.54b5.9b Mar 07 2002 05:49 PM Automatic
- 192.168.1.235 018c.a982.9e8e.f8 Mar 08 2002 12:42 AM Automatic
- 192.168.1.236 01f0.def1.6045.74 Mar 07 2002 06:41 PM Automatic
- 192.168.1.241 0100.1f3c.0dee.82 Mar 08 2002 12:33 AM Automatic
- 192.168.1.242 0100.2710.f29b.20 Mar 08 2002 01:48 AM Automatic
- 192.168.1.244 0100.1b24.79ac.bc Mar 07 2002 10:56 PM Automatic
- 192.168.1.246 0188.ae1d.7426.51 Mar 07 2002 09:59 PM Automatic
- 192.168.1.249 0100.26c7.43ff.60 Mar 08 2002 01:19 AM Automatic
由于我们测试的设备开启了IPv4到IPv6的tunnel技术,即能够访问IPv6的网络也能同时访问IPv4网络的技术,所以在show ip dhcp binding时,会看到一些IPv6的地址被分配出来了。
路由器配置之故障排除:
- > ipconfig … 显示信息
- > ipconfig /all … 显示详细信息
- > ipconfig /renew … 更新所有适配器
- > ipconfig /renew EL* … 更新所有名称以 EL 开头的连接
- > ipconfig /release *Con* … 释放所有匹配的连接,
- 例如 “Local Area Connection 1″ 或
- ”Local Area Connection 2″
- > ipconfig /allcompartments … 显示有关所有分段的信息
- > ipconfig /allcompartments /all … 显示有关所有分段的详细信息
路由器配置的全过程就是如上所述的这些内容,关于DHCP服务器的配置,这是路由器配置中一个比较经典和常用的配置,所以网管员时一定要学会的了。