路由器配置DHCP服務(wù)器實例解析
路由器配置要求:
企業(yè)內(nèi)部計算機(jī)使用DHCP的方式獲得IP 地址設(shè)置 DHCP 的地址為192.168.1.0/24 網(wǎng)絡(luò)地址設(shè)置默認(rèn)網(wǎng)關(guān)為 192.168.1.1,域名為ewao.cn,DNS 服務(wù)為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 //需要排除路由器的接口既網(wǎng)關(guān)地址
- Router(config)#ip dhcp pool DHCP //創(chuàng)建DHCP池
- Router(dhcp-config)#network 192.168.1.0 /24 //宣告可分配網(wǎng)段
- Router(dhcp-config)#default-Router 192.168.1.1 //設(shè)置客戶端的默認(rèn)網(wǎng)關(guān)
- Router(dhcp-config)#dns-server 61.128.114.133 //設(shè)置客戶端DNS地址
- Router(dhcp-config)#lease 2 //地址租期
- Router(dhcp-config)#domain-name ewao.cn //客戶端所在域
- Router(dhcp-config)#end
客戶端配置:
路由器配置之IPV6的DHCP服務(wù)器配置:
- 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技術(shù)也需要在客戶端做相應(yīng)配置。
路由器配置之驗證:
- 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
由于我們測試的設(shè)備開啟了IPv4到IPv6的tunnel技術(shù),即能夠訪問IPv6的網(wǎng)絡(luò)也能同時訪問IPv4網(wǎng)絡(luò)的技術(shù),所以在show ip dhcp binding時,會看到一些IPv6的地址被分配出來了。
路由器配置之故障排除:
- > ipconfig … 顯示信息
- > ipconfig /all … 顯示詳細(xì)信息
- > ipconfig /renew … 更新所有適配器
- > ipconfig /renew EL* … 更新所有名稱以 EL 開頭的連接
- > ipconfig /release *Con* … 釋放所有匹配的連接,
- 例如 “Local Area Connection 1″ 或
- ”Local Area Connection 2″
- > ipconfig /allcompartments … 顯示有關(guān)所有分段的信息
- > ipconfig /allcompartments /all … 顯示有關(guān)所有分段的詳細(xì)信息
路由器配置的全過程就是如上所述的這些內(nèi)容,關(guān)于DHCP服務(wù)器的配置,這是路由器配置中一個比較經(jīng)典和常用的配置,所以網(wǎng)管員時一定要學(xué)會的了。