一、路由器上的配置
R1上的配置
Router>en
Router#conf t
粘貼上常用的路由基本命令
Router(config)#enable password cisco
Router(config)#no ip domain-lookup
Router(config)#line con 0
Router(config-line)# exec-timeout 0 0
Router(config-line)# logging synchronous
Router(config-line)#
Router(config-line)#line aux 0
Router(config-line)# exec-timeout 0 0
Router(config-line)# logging synchronous
Router(config-line)#line vty 0 4
Router(config-line)#
Router(config-line)#
Router(config-line)# exec-timeout 0 0
Router(config-line)# password cisco
Router(config-line)#
Router(config-line)# login
Router(config-line)#
Router(config-line)#
Router(config-line)#alias exec a sh ip int bri
Router(config)#alias exec b sh ip route
Router(config)#alias exec c sh ip route rip
Router(config)#alias exec d sh run
設置名稱,建立幾條虛鏈路來連接到R2,等下用來驗證彙總信息
Router(config)#hostname R1
R1(config)#interface loopback 1
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface loopback 2
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface loopback 3
R1(config-if)#ip address 10.1.2.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface loopback 4
R1(config-if)#ip address 10.1.3.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface loopback 5
R1(config-if)#ip address 10.1.4.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface loopback 6
R1(config-if)#ip address 10.1.5.1 255.255.255.0
R1(config)#interface e0/0
R1(config-if)#ip address 172.16.10.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface s1/0
R1(config-if)#ip address 172.16.2.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R1(config-if)#exit
R上的配置
Router(config)#hostname R2
R2(config)#interface s1/0
R2(config-if)#ip address 172.16.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface s1/1
R2(config-if)#ip address 172.16.3.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#exit
R3上的配置
outer(config)#hostname R3
R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#exit
R3(config)#interface e0/0
R3(config-if)#ip address 172.16.10.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface s1/1
R3(config-if)#ip address 172.16.3.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
二、好了,到這裏可以開始配置RIP了,注意要升級到V2版本,再給每個路由器配置RIP
R1上的配置
R1(config)#router rip
R1(config-router)#version 2
注意在這裏與RIP的不同,要加上一個Version 2
R1(config-router)#network 1.0.0.0
R1(config-router)#network 10.0.0.0
R1(config-router)#network 172.16.2.0
R1(config-router)#network 172.16.10.0
R2上的配置
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 172.16.2.0
R2(config-router)#network 172.16.3.0
R3上的配置
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 3.0.0.0
R3(config-router)#network 172.16.3.0
R3(config-router)#network 172.16.10.0
三、查看路由表
R1的路由表
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback1
R 3.0.0.0/8 [120/1] via 172.16.10.2, 00:00:04, Ethernet0/0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
C 172.16.2.0 is directly connected, Serial1/0
R 172.16.3.0 [120/1] via 172.16.2.2, 00:00:25, Serial1/0
[120/1] via 172.16.10.2, 00:00:04, Ethernet0/0
10.0.0.0/24 is subnetted, 5 subnets
C 10.1.3.0 is directly connected, Loopback4
C 10.1.2.0 is directly connected, Loopback3
C 10.1.1.0 is directly connected, Loopback2
C 10.1.5.0 is directly connected, Loopback6
C 10.1.4.0 is directly connected, Loopback5
R2上的路由表
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
R 1.0.0.0/8 [120/1] via 172.16.2.1, 00:00:10, Serial1/0
R 3.0.0.0/8 [120/1] via 172.16.3.2, 00:00:13, Serial1/1
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.10.0 [120/1] via 172.16.2.1, 00:00:10, Serial1/0
[120/1] via 172.16.3.2, 00:00:13, Serial1/1
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Serial1/1
R 10.0.0.0/8 [120/1] via 172.16.2.1, 00:00:10, Serial1/0
R3上的路由表
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
R 1.0.0.0/8 [120/1] via 172.16.10.1, 00:00:05, Ethernet0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
R 172.16.2.0 [120/1] via 172.16.10.1, 00:00:05, Ethernet0/0
[120/1] via 172.16.3.1, 00:00:03, Serial1/1
C 172.16.3.0 is directly connected, Serial1/1
R 10.0.0.0/8 [120/1] via 172.16.10.1, 00:00:05, Ethernet0/0
R3#
由於RIPV2默認啓動路由彙總的,在R2的路由表上可以看到它已經彙總了路由表.
四、在R1上去掉自動路由彙總,然後再查看下路由表
去掉路由自動彙總的命令是:no auto-summary
R1(config)#router rip
R1(config-router)#no auto-summary
查看下R1上的路由表
R1#show ip route
*Mar 1 01:00:00.451: %SYS-5-CONFIG_I: Configured from console by console
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback1
R 3.0.0.0/8 [120/1] via 172.16.10.2, 00:00:03, Ethernet0/0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
C 172.16.2.0 is directly connected, Serial1/0
R 172.16.3.0 [120/1] via 172.16.2.2, 00:00:22, Serial1/0
[120/1] via 172.16.10.2, 00:00:03, Ethernet0/0
10.0.0.0/24 is subnetted, 5 subnets
C 10.1.3.0 is directly connected, Loopback4
C 10.1.2.0 is directly connected, Loopback3
C 10.1.1.0 is directly connected, Loopback2
C 10.1.5.0 is directly connected, Loopback6
C 10.1.4.0 is directly connected, Loopback5
R2上的路由表
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 172.16.2.1, 00:00:02, Serial1/0
R 1.0.0.0/8 [120/1] via 172.16.2.1, 00:00:28, Serial1/0
R 3.0.0.0/8 [120/1] via 172.16.3.2, 00:00:21, Serial1/1
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.10.0 [120/1] via 172.16.2.1, 00:00:02, Serial1/0
[120/1] via 172.16.3.2, 00:00:21, Serial1/1
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Serial1/1
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
R 10.1.3.0/24 [120/1] via 172.16.2.1, 00:00:02, Serial1/0
R 10.1.2.0/24 [120/1] via 172.16.2.1, 00:00:02, Serial1/0
R 10.1.1.0/24 [120/1] via 172.16.2.1, 00:00:02, Serial1/0
R 10.0.0.0/8 [120/1] via 172.16.2.1, 00:00:32, Serial1/0
R 10.1.5.0/24 [120/1] via 172.16.2.1, 00:00:06, Serial1/0
R 10.1.4.0/24 [120/1] via 172.16.2.1, 00:00:06, Serial1/0
R3上的路由表
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
R 1.0.0.0/8 [120/1] via 172.16.10.1, 00:00:43, Ethernet0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
R 172.16.2.0 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
[120/1] via 172.16.3.1, 00:00:10, Serial1/1
C 172.16.3.0 is directly connected, Serial1/1
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
R 10.1.3.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
R 10.1.2.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
R 10.1.1.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
R 10.0.0.0/8 [120/1] via 172.16.10.1, 00:00:43, Ethernet0/0
R 10.1.5.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
R 10.1.4.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
注意觀察R2上的路由表的變化,當我們去掉R1上的路由自動彙總後,R1傳給R2的路由已經不再是彙總的了.
現在讓我們在R1上設置手動彙總,觀察手動彙總的結果.
手動彙總的命令是:ip summary-address rip
R1(config)#int s1/0
R1(config-if)#ip summary-address rip 10.1.0.0 255.255.0.0
觀察路由表
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback1
R 1.0.0.0/8 [120/2] via 172.16.10.2, 00:00:15, Ethernet0/0
[120/2] via 172.16.2.2, 00:00:08, Serial1/0
R 3.0.0.0/8 [120/1] via 172.16.10.2, 00:00:15, Ethernet0/0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
C 172.16.2.0 is directly connected, Serial1/0
R 172.16.3.0 [120/1] via 172.16.2.2, 00:00:08, Serial1/0
[120/1] via 172.16.10.2, 00:00:15, Ethernet0/0
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C 10.1.3.0/24 is directly connected, Loopback4
C 10.1.2.0/24 is directly connected, Loopback3
C 10.1.1.0/24 is directly connected, Loopback2
R 10.0.0.0/8 [120/2] via 172.16.10.2, 00:00:15, Ethernet0/0
[120/2] via 172.16.2.2, 00:00:08, Serial1/0
C 10.1.5.0/24 is directly connected, Loopback6
C 10.1.4.0/24 is directly connected, Loopback5
R2上的路由表
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 172.16.2.1, 00:00:21, Serial1/0
R 1.0.0.0/8 [120/2] via 172.16.3.2, 00:00:08, Serial1/1
R 3.0.0.0/8 [120/1] via 172.16.3.2, 00:00:08, Serial1/1
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.10.0 [120/1] via 172.16.2.1, 00:00:21, Serial1/0
[120/1] via 172.16.3.2, 00:00:08, Serial1/1
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Serial1/1
10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks
R 10.1.3.0/24 is possibly down,
routing via 172.16.2.1, Serial1/0
R 10.1.2.0/24 is possibly down,
routing via 172.16.2.1, Serial1/0
R 10.1.1.0/24 is possibly down,
routing via 172.16.2.1, Serial1/0
R 10.0.0.0/8 [120/2] via 172.16.3.2, 00:00:08, Serial1/1
R 10.1.0.0/16 [120/1] via 172.16.2.1, 00:00:21, Serial1/0
R 10.1.5.0/24 is possibly down,
routing via 172.16.2.1, Serial1/0
R 10.1.4.0/24 is possibly down,
routing via 172.16.2.1, Serial1/0
再次觀察R2上的路由表與手動彙總之前的不同,可以看到手動彙總已經起了作用.可能這裏是用模擬器做的實驗,手動彙總的結果顯示得比較慢吧.實驗上多多少少已經在上起到作用的了.再等幾分鐘再看下路由表,果然如此,呵呵
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 172.16.2.1, 00:00:19, Serial1/0
R 1.0.0.0/8 [120/2] via 172.16.3.2, 00:00:06, Serial1/1
R 3.0.0.0/8 [120/1] via 172.16.3.2, 00:00:06, Serial1/1
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.10.0 [120/1] via 172.16.2.1, 00:00:19, Serial1/0
[120/1] via 172.16.3.2, 00:00:06, Serial1/1
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Serial1/1
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 10.0.0.0/8 [120/2] via 172.16.3.2, 00:00:06, Serial1/1
R 10.1.0.0/16 [120/1] via 172.16.2.1, 00:00:19, Serial1/0
最後看下R3的路由表
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
R 1.0.0.0/8 [120/2] via 172.16.3.1, 00:00:02, Serial1/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
R 172.16.2.0 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
[120/1] via 172.16.3.1, 00:00:02, Serial1/1
C 172.16.3.0 is directly connected, Serial1/1
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
R 10.1.3.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
R 10.1.2.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
R 10.1.1.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
R 10.0.0.0/8 [120/2] via 172.16.3.1, 00:00:02, Serial1/1
R 10.1.5.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
R 10.1.4.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
五、實驗總結
通過試驗RIPV2的屬性,可以看到VLSM的特徵.同時,使用關閉自動彙總屬性也看到了RIPV2的特點.