扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
目的:通过汇总减少路由器由于路由表中的路由条目过多产生的负担
路由器的基本配置:
r1#sho run
!
interface Loopback0
ip address 199.172.16.1 255.255.255.0
!
interface Loopback1
ip address 199.172.17.1 255.255.255.0
!
interface Loopback2
ip address 199.172.18.1 255.255.255.0
!
interface Loopback3
ip address 199.172.19.1 255.255.255.0
!
interface FastEthernet0/0
ip address 12.0.0.1 255.255.255.0
duplex half
!
router ospf 110
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 12
!
!
End
r2#sho run
!
interface FastEthernet0/0
ip address 12.0.0.2 255.255.255.0
duplex half
!
interface Serial2/2
ip address 23.0.0.2 255.255.255.0
serial restart-delay 0
!
router ospf 110
log-adjacency-changes
area 12 range 199.172.16.0 255.255.252.0 //路由汇总
network 12.0.0.0 0.0.0.255 area 12
network 23.0.0.0 0.0.0.255 area 0
!
End
r3#sho run
!
interface Serial2/1
ip address 23.0.0.3 255.255.255.0
serial restart-delay 0
!
interface Serial2/2
ip address 34.0.0.3 255.255.255.0
serial restart-delay 0
!
router ospf 110
log-adjacency-changes
network 23.0.0.0 0.0.0.255 area 0
network 34.0.0.0 0.0.0.255 area 34
!
End
r4#sho run
!
interface Loopback0
ip address 151.100.32.1 255.255.255.0
!
interface Loopback1
ip address 151.100.33.1 255.255.255.0
!
interface Loopback2
ip address 151.100.34.1 255.255.255.0
!
interface Loopback3
ip address 151.100.35.1 255.255.255.0
!
interface Serial2/1
ip address 34.0.0.4 255.255.255.0
serial restart-delay 0
!
router ospf 110
log-adjacency-changes
summary-address 151.100.32.0 255.255.252.0
//路由汇总把区域外的路由条目汇总成一条,
redistribute connected subnets route-map hhh
//把域外的路由条目重分布到域内
network 34.0.0.0 0.0.0.255 area 34
!
route-map hhh permit 10
match interface Loopback0 Loopback1 Loopback2 Loopback3
!
End
查看路由表:
r1#sho ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
34.0.0.0/24 is subnetted, 1 subnets
O IA 34.0.0.0 [110/129] via 12.0.0.2, 00:11:38, FastEthernet0/0
23.0.0.0/24 is subnetted, 1 subnets
O IA 23.0.0.0 [110/65] via 12.0.0.2, 00:11:38, FastEthernet0/0
C 199.172.18.0/24 is directly connected, Loopback2
C 199.172.19.0/24 is directly connected, Loopback3
C 199.172.16.0/24 is directly connected, Loopback0
C 199.172.17.0/24 is directly connected, Loopback1
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, FastEthernet0/0
151.100.0.0/22 is subnetted, 1 subnets
O E2 151.100.32.0 [110/20] via 12.0.0.2, 00:03:40, FastEthernet0/0
//经过汇总后重分布到域内的路由条目
r2#sho ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
34.0.0.0/24 is subnetted, 1 subnets
O IA 34.0.0.0 [110/128] via 23.0.0.3, 00:11:17, Serial2/2
23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial2/2
199.172.18.0/32 is subnetted, 1 subnets
O 199.172.18.1 [110/2] via 12.0.0.1, 00:11:17, FastEthernet0/0
199.172.19.0/32 is subnetted, 1 subnets
O 199.172.19.1 [110/2] via 12.0.0.1, 00:11:17, FastEthernet0/0
199.172.16.0/32 is subnetted, 1 subnets
O 199.172.16.1 [110/2] via 12.0.0.1, 00:11:17, FastEthernet0/0
199.172.17.0/32 is subnetted, 1 subnets
O 199.172.17.1 [110/2] via 12.0.0.1, 00:11:17, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, FastEthernet0/0
151.100.0.0/22 is subnetted, 1 subnets
O E2 151.100.32.0 [110/20] via 23.0.0.3, 00:04:38, Serial2/2
//经过汇总后重分布到域内的路由条目
O 199.172.16.0/22 is a summary, 00:11:28, Null0
//经过汇总后的路由条目
r3#sho ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
34.0.0.0/24 is subnetted, 1 subnets
C 34.0.0.0 is directly connected, Serial2/2
23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial2/1
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.0.0.0 [110/65] via 23.0.0.2, 00:13:25, Serial2/1
151.100.0.0/22 is subnetted, 1 subnets
O E2 151.100.32.0 [110/20] via 34.0.0.4, 00:05:06, Serial2/2
//经过汇总后重分布到域内的路由条目
O IA 199.172.16.0/22 [110/66] via 23.0.0.2, 00:11:57, Serial2/1
//经过汇总后的路由条目
r4#sho ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
34.0.0.0/24 is subnetted, 1 subnets
C 34.0.0.0 is directly connected, Serial2/1
23.0.0.0/24 is subnetted, 1 subnets
O IA 23.0.0.0 [110/128] via 34.0.0.3, 01:06:25, Serial2/1
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.0.0.0 [110/129] via 34.0.0.3, 00:25:26, Serial2/1
151.100.0.0/16 is variably subnetted, 5 subnets, 2 masks
C 151.100.35.0/24 is directly connected, Loopback3
C 151.100.34.0/24 is directly connected, Loopback2
C 151.100.33.0/24 is directly connected, Loopback1
O 151.100.32.0/22 is a summary, 00:05:41, Null0
C 151.100.32.0/24 is directly connected, Loopback0
O IA 199.172.16.0/22 [110/130] via 34.0.0.3, 00:12:31, Serial2/1
///经过汇总后的路由条目
r1#ping 151.100.32.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 151.100.32.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 296/440/564 ms
PING测试
r4#ping 199.172.19.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 199.172.19.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 264/446/576 ms
由于路由条目过多,给路由器很大负担,因此通过汇总,减少路由器的负担。
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者