拓扑如图↓
配好ip/协议后,各设备路由如图↓
FW1 H>* 1.1.1.1/32 [0/0/1] is local address, loopback1 C>* 10.1.1.0/30 is directly connected, ethernet0/1 H>* 10.1.1.1/32 [0/0/1] is local address, ethernet0/1 C>* 20.1.1.0/30 is directly connected, ethernet0/2 H>* 20.1.1.1/32 [0/0/1] is local address, ethernet0/2 C>* 192.168.1.0/24 is directly connected, ethernet0/0 H>* 192.168.1.1/32 [0/0/1] is local address, ethernet0/0 RT1 C 10.1.1.0/30 is directly connected, GigaEthernet0/5 R 20.1.1.0/30 [120,1] via 10.1.1.1(on GigaEthernet0/5) C 30.1.1.0/30 is directly connected, GigaEthernet0/4 O 40.1.1.0/30 [110,2] via 50.1.1.2(on GigaEthernet0/3) [110,2] via 30.1.1.2(on GigaEthernet0/4) C 50.1.1.0/30 is directly connected, GigaEthernet0/3 R 192.168.1.0/24 [120,1] via 10.1.1.1(on GigaEthernet0/5) RT2 R 10.1.1.0/30 [120,1] via 20.1.1.1(on GigaEthernet0/5) C 20.1.1.0/30 is directly connected, GigaEthernet0/5 O 30.1.1.0/30 [110,2] via 50.1.1.1(on GigaEthernet0/3) [110,2] via 40.1.1.2(on GigaEthernet0/4) C 40.1.1.0/30 is directly connected, GigaEthernet0/4 C 50.1.1.0/30 is directly connected, GigaEthernet0/3 R 192.168.1.0/24 [120,1] via 20.1.1.1(on GigaEthernet0/5) RT3 C 30.1.1.0/30 is directly connected, GigaEthernet0/4 C 40.1.1.0/30 is directly connected, GigaEthernet0/3 O 50.1.1.0/30 [110,2] via 40.1.1.1(on GigaEthernet0/3) [110,2] via 30.1.1.1(on GigaEthernet0/4)
在RT1上和RT2上双向路由引入,查看路由表
RT1 C 10.1.1.0/30 is directly connected, GigaEthernet0/5 R 20.1.1.0/30 [120,1] via 10.1.1.1(on GigaEthernet0/5) C 30.1.1.0/30 is directly connected, GigaEthernet0/4 O 40.1.1.0/30 [110,2] via 50.1.1.2(on GigaEthernet0/3) [110,2] via 30.1.1.2(on GigaEthernet0/4) C 50.1.1.0/30 is directly connected, GigaEthernet0/3 R 192.168.1.0/24 [120,1] via 10.1.1.1(on GigaEthernet0/5) RT2 R 10.1.1.0/30 [120,1] via 20.1.1.1(on GigaEthernet0/5) C 20.1.1.0/30 is directly connected, GigaEthernet0/5 O 30.1.1.0/30 [110,2] via 50.1.1.1(on GigaEthernet0/3) [110,2] via 40.1.1.2(on GigaEthernet0/4) C 40.1.1.0/30 is directly connected, GigaEthernet0/4 C 50.1.1.0/30 is directly connected, GigaEthernet0/3 R 192.168.1.0/24 [120,1] via 20.1.1.1(on GigaEthernet0/5)
查看RT1和RT2的LSDB表
RT1 AREA: 0 Router Link States Link ID ADV Router Age Seq Num Checksum Link Count 1.1.1.1 1.1.1.1 332 0x80000008 0x6df9 2 2.2.2.2 2.2.2.2 319 0x80000008 0xd475 2 3.3.3.3 3.3.3.3 1120 0x80000005 0x3935 2 Net Link States Link ID ADV Router Age Seq Num Checksum 40.1.1.1 2.2.2.2 1160 0x80000003 0x1bda 30.1.1.1 1.1.1.1 1289 0x80000003 0x996e 50.1.1.1 1.1.1.1 1289 0x80000003 0x6295 ASE Link States Link ID ADV Router Age Seq Num Checksum Tag 20.1.1.0 1.1.1.1 331 0x80000001 0xbe7a 0x00000000 192.168.1.0 2.2.2.2 322 0x80000001 0x12cb 0x00000000 192.168.1.0 1.1.1.1 331 0x80000001 0x30b1 0x00000000 10.1.1.0 2.2.2.2 327 0x80000001 0x231c 0x00000000 RT2 AREA: 0 Router Link States Link ID ADV Router Age Seq Num Checksum Link Count 2.2.2.2 2.2.2.2 430 0x80000008 0xd475 2 1.1.1.1 1.1.1.1 445 0x80000008 0x6df9 2 3.3.3.3 3.3.3.3 1231 0x80000005 0x3935 2 Net Link States Link ID ADV Router Age Seq Num Checksum 30.1.1.1 1.1.1.1 1402 0x80000003 0x996e 40.1.1.1 2.2.2.2 1270 0x80000003 0x1bda 50.1.1.1 1.1.1.1 1402 0x80000003 0x6295 ASE Link States Link ID ADV Router Age Seq Num Checksum 10.1.1.0 2.2.2.2 438 0x80000001 0x231c 192.168.1.0 2.2.2.2 433 0x80000001 0x12cb 192.168.1.0 1.1.1.1 444 0x80000001 0x30b1 20.1.1.0 1.1.1.1 444 0x80000001 0xbe7a
此时可以发现RT1/RT2通过路由引入将192.168.1.0/24这条路由信息传给了RT2/RT1,因为ospf路由引入的优先级为150,所以会选择通过RIP协议传过来的路由信息,RIP优先级为120。此时的拓扑没有环路。
再加上一台运行了ospf的设备↓
做好ospf后,把LSW1的L0引入到ospf内
查看RT1,FW1,RT2的路由表↓
RT1 R 1.1.1.1/32 [120,2] via 10.1.1.1(on GigaEthernet0/5) C 10.1.1.0/30 is directly connected, GigaEthernet0/5 R 20.1.1.0/30 [120,1] via 10.1.1.1(on GigaEthernet0/5) C 30.1.1.0/30 is directly connected, GigaEthernet0/4 O 40.1.1.0/30 [110,2] via 50.1.1.2(on GigaEthernet0/3) [110,2] via 30.1.1.2(on GigaEthernet0/4) C 50.1.1.0/30 is directly connected, GigaEthernet0/3 O 60.1.1.0/30 [110,2] via 50.1.1.2(on GigaEthernet0/3) R 192.168.1.0/24 [120,1] via 10.1.1.1(on GigaEthernet0/5) FW1 R>* 1.1.1.1/32 [120/2/1] via 20.1.1.2, ethernet0/2, 00:02:09 C>* 10.1.1.0/30 is directly connected, ethernet0/1 H>* 10.1.1.1/32 [0/0/1] is local address, ethernet0/1 C>* 20.1.1.0/30 is directly connected, ethernet0/2 H>* 20.1.1.1/32 [0/0/1] is local address, ethernet0/2 R>* 30.1.1.0/30 [120/2/1] via 20.1.1.2, ethernet0/2, 00:26:54 R>* 40.1.1.0/30 [120/2/1] via 10.1.1.2, ethernet0/1, 00:27:21 R>* 60.1.1.0/30 [120/2/1] via 10.1.1.2, ethernet0/1, 00:05:20 C>* 192.168.1.0/24 is directly connected, ethernet0/0 H>* 192.168.1.1/32 [0/0/1] is local address, ethernet0/0 RT2 R 1.1.1.1/32 [120,2] via 20.1.1.1(on GigaEthernet0/5) R 10.1.1.0/30 [120,1] via 20.1.1.1(on GigaEthernet0/5) C 20.1.1.0/30 is directly connected, GigaEthernet0/5 O 30.1.1.0/30 [110,2] via 50.1.1.1(on GigaEthernet0/3) [110,2] via 40.1.1.2(on GigaEthernet0/4) C 40.1.1.0/30 is directly connected, GigaEthernet0/4 C 50.1.1.0/30 is directly connected, GigaEthernet0/3 C 60.1.1.0/30 is directly connected, GigaEthernet0/6 R 192.168.1.0/24 [120,1] via 20.1.1.1(on GigaEthernet0/5)
此时可以发现环路了。因为LSW1把路由传给RT2(优先级150),RT2传给RT1(优先级150)、FW1(通过路由引入,优先级为120),RT1传给FW1(优先级120),FW1传给RT2(优先级为120),所以RT2去往1.1.1.1下一跳为FW1。
解决方法↓
-
在RT2上修改ospf外部路由优先级使外部路由优先级为x(x<120)
router ospf 1 distance ospf external 100
-
在RT2上使用ACL/Prefix-list 匹配1.1.1.1/32路由,在rip视图下使用过滤工具进行过滤
ip prefix-list 1 seq 10 deny 1.1.1.1/32 ip prefix-list 1 seq 20 permit any ---------------------or--------------------- ip access-list standard 1 deny 1.1.1.1 255.255.255.255 permit any router rip filter gigaEthernet 0/5 in access-list/prefix-list 1
0 条评论