路由策略3_Distribute-list3
原创
©著作权归作者所有:来自51CTO博客作者810105851的原创作品,请联系作者获取转载授权,否则将追究法律责任
拓扑图:
基本配置:
R1,R2 192.168.12.0/24
R2,R3 192.168.23.0/24
R1:
interface Loopback0
ip
address 1.1.1.1 255.255.255.0
ip
ospf network point-to-point
!
interface Loopback1
ip
address 10.10.10.10 255.255.255.0
ip
ospf network point-to-point //指定OSPF网络类型避免loopback接口问题
在没有配置分发列表前各路由器的路由表:
R1:
r1#sh ip rou
C
192.168.12.0/24 is directly connected, Serial0/0
1.0.0.0/24 is subnetted, 1 subnets
C
1.1.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C
10.10.10.0 is directly connected, Loopback1
O
192.168.23.0/24 [110/128] via 192.168.12.2, 00:01:45, Serial0/0
r1#
R2:
r2#sh ip rou
C
192.168.12.0/24 is directly connected, Serial0/0
1.0.0.0/24 is subnetted, 1 subnets
O
1.1.1.0 [110/65] via 192.168.12.1, 00:01:32, Serial0/0
10.0.0.0/24 is subnetted, 1 subnets
O
10.10.10.0 [110/65] via 192.168.12.1, 00:01:32, Serial0/0
C
192.168.23.0/24 is directly connected, Serial0/1
r2#
R3:
r3#sh ip rou
O
192.168.12.0/24 [110/128] via 192.168.23.1, 00:01:14, Serial0/0
1.0.0.0/24 is subnetted, 1 subnets
O
1.1.1.0 [110/129] via 192.168.23.1, 00:01:14, Serial0/0
10.0.0.0/24 is subnetted, 1 subnets
O
10.10.10.0 [110/129] via 192.168.23.1, 00:01:14, Serial0/0
C
192.168.23.0/24 is directly connected, Serial0/0
r3#
可以看到各路由器都学习到了全网的路由。下面配置分发列表:
配置参数:
r2(config)#acc 1 den 10.10.10.0
r2(config)#acc 1 per an
r2(config)#router os 1
r2(config-router)#distrib 1 in s0/0
查看配置效果:
r2#sh ip rou
C
192.168.12.0/24 is directly connected, Serial0/0
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/65] via 192.168.12.1,
00:00:26, Serial0/0
C
192.168.23.0/24 is directly connected, Serial0/1
r2#
可以看到R2的路由表中没有10.10.10.0/24的路由了,但R3的路由表中还是有的,
R3:
r3#clear ip route *
r3#sh ip rou
O 192.168.12.0/24 [110/128] via 192.168.23.1,
00:00:01, Serial0/0
1.0.0.0/24 is subnetted, 1 subnets
O
1.1.1.0 [110/129] via 192.168.23.1, 00:00:01, Serial0/0
10.0.0.0/24 is subnetted, 1 subnets
O 10.10.10.0 [110/129] via 192.168.23.1,
00:00:01, Serial0/0
C
192.168.23.0/24 is directly connected, Serial0/0
r3#
因为OSPF是链路状态路由协议,是通过LSA来更新路由表的。下面可以在R2查看10.10.10.0/24的LSA.
r2#show ip ospf database
OSPF Router with ID (192.168.23.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.10.10.10
10.10.10.10 339 0x80000004 0x00C3DC 4
192.168.23.1 192.168.23.1 346
0x80000004 0x00D194 4
192.168.23.2 192.168.23.2 382
0x80000002 0x000416 2
r2#
r2#show ip os database router 10.10.10.10
OSPF Router with ID (192.168.23.1) (Process ID 1)
Router Link States (Area 0)
LS
age: 368
Options: (No TOS-capability, DC)
LS
Type: Router Links
Link State ID: 10.10.10.10
Advertising Router: 10.10.10.10
LS
Seq Number: 80000004
Checksum: 0xC3DC
Length: 72
Number of Links: 4
Link connected to: a Stub Network
(Link ID)
Network/subnet number: 10.10.10.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 1.1.1.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 1
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 192.168.23.1
(Link Data) Router Interface address: 192.168.12.1
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.12.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
r2#
可以得出分发列表的IN方向在OSPF中只能到本路由器有作用!!!
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Vue3 路由传参
Vue3 路由传参
Vue路由传参 query params -
路由策略3_Distribute-list2
预备知识:分发列表可根据下列因素过渡更新:l 入站接口inl 出站接口outl 从另一种路由协议生分发如果后面不接接口,默认对所有运行该路由协议的接口起作用!
路由器 rip gns3 distribute-list 分发列表 -
CCNP路由-12 路由策略3 Distribute-list prefix-list
CCNP路由-12 路由策略3 Distribute-list prefix-list
CCNP 路由策略 Distribute-list pref -
路由策略3_Distribute-list6(在双点双向重分发中的应用)
路由策略3_Distribute-list6(在双点双向重分发中的应用)如上图,在R2和R4上配置双点双向重发布,在配置双点双向重发布时,小AD重发布进大AD时是没问题的,但是大AD重发布进小AD时,就会出现问题,例如次优路径,环路等,如上图,如果是R2先学习到RIP网络的路由,那么在R4的路由表中,RIP网络的路由将是通过OSPF学习到的,这样就产生了次优路径(不是最优的路由)!可以配置分发列表来避免次优路径!下面先不配置分发列表,查看各路由器的路由表,接下来好做实验:
ospf 路由器 gns3 distribute-list 分发列表 ccpn -
路由策略专题(二)之分发列表(Distribute-List)
在众多的路由策略工具中分发列表是我们比较常见的之一。本文结合具体实例讲述分发列表的具体使用
路由策略 分发列表 distribute-list 路由交换 思科(Cisco)