對于一些準備考CCNA和CCNP的人來說,配置一條靜態路由和使用思科的命令IP default-network的區別是一個令人迷惑的地方。
初一看,他們都是一樣的。結果都是配置一個目的地,使得路由器知道如果一個包在路由表中沒有指定的路由的話,這個包將會被發往何地。
他們之間的主要區別是:配置一條靜態缺省路由僅是為你在配置的路由器定義一條路由,而ip default-network將通過使用的路由協議進行傳播。
下面,我們在一個星形網絡(hub-and-spoke network)中來試驗ip default-network命令。R1為中心,R2和R3葉子。他們通過網絡172.12.123.0/24連接起來,而且每臺路由器都根據它的路由器號碼被配置了32位掩碼的LOOPBACK地址(1.1.1.1/32,等等)。路由協議使用RIP協議,LOOPBACK地址在網絡中被廣播。
R1路由器配置有一個串口,地址為10.1.1.1/24,這個網絡被通過使用命令ip default-network 10.0.0.0命令,配置為一條缺省網絡。它還沒有被RIP廣播。
接下來,路由協議廣播了這條路由。使用RIP,缺省網絡被廣播為0.0.0.0(如果使用了IGRP,它會顯示網絡號,但是被標識成IGRP的外部路由)。這個路由被指定為R1的一條缺省的路由,正如我們在下面看到的。
R1#show ip route
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
R 2.0.0.0/8 [120/1] via 172.12.123.2, 00:00:11, Serial0
R 3.0.0.0/8 [120/1] via 172.12.123.3, 00:00:11, Serial0
172.12.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.12.21.0/30 is directly connected, BRI0
C 172.12.123.0/24 is directly connected, Serial0
* 10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1
在R2和R3上,缺省的RIP路由也將出現:
R2#show ip route
Gateway of last resort is 172.12.123.1 to network 0.0.0.0
R 1.0.0.0/8 [120/1] via 172.12.123.1, 00:00:00, Serial0.213
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
R 3.0.0.0/8 [120/2] via 172.12.123.1, 00:00:00, Serial0.213
172.12.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.12.21.0/30 is directly connected, BRI0
C 172.12.123.0/24 is directly connected, Serial0.213
R* 0.0.0.0/0 [120/1] via 172.12.123.1, 00:00:00, Serial0.213
R3#show ip route
Gateway of last resort is 172.12.123.1 to network 0.0.0.0
R 1.0.0.0/8 [120/1] via 172.12.123.1, 00:00:27, Serial0.31
R 2.0.0.0/8 [120/2] via 172.12.123.1, 00:00:28, Serial0.31
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
172.12.0.0/24 is subnetted, 1 subnets
C 172.12.123.0 is directly connected, Serial0.31
R* 0.0.0.0/0 [120/1] via 172.12.123.1, 00:00:28, Serial0.31
所以缺省路由起了使用:如果我們在R2和R3上PING10.1.1.1,即使他們在路由表中沒有配置的路由,他們會使用缺省路由。
R2#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 68/68/68 ms
R3#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 68/68/68 ms
當決定是使用缺省路由還是使用default network時,要記信:如果想路由協議廣播這條路由,那么使用default-network命令,否則使用缺省路由就可以了。
|
新聞熱點
疑難解答