java怎么拦截某个对象
284
2022-09-25
Cisco ❀ 双向双点重发布
双向双点重发布的基础应用实验
我们下面要做的是解决次优路径与环路问题:1、IP地址具体规划: 该拓扑的IPV4地址如下(IP地址可以自行设定): R1的loopback 1的IPV4地址为1.1.1.1/32 R2的loopback 1的IPV4地址为2.2.2.2/32 R3的loopback 1的IPV4地址为3.3.3.3/32 R4的loopback 1的IPV4地址为4.4.4.4/32 R1-R2的S1/1接口的IPV4地址为12.1.1.1/24 R2-R1的S1/0接口的IPV4地址为12.1.1.2/24 R2-R3的S1/1接口的IPV4地址为23.1.1.1/24 R3-R2的S1/0接口的IPV4地址为23.1.1.2/24 R3-R4的S1/1接口的IPV4地址为34.1.1.1/24 R4-R3的S1/0接口的IPV4地址为34.1.1.2/24 R1-R4的E0/0接口的IPV4地址为14.1.1.1/24 R4-R1的E0/0接口的IPV4地址为14.1.1.2/24
2、给接口配置IPV4地址:
R1(config)#int l1R1(config-if)#ip aadd R1(config-if)#ip address 1.1.1.1 255.255.255.255R1(config-if)#no shutdown//环回接口可以不使用,链路接口必须开启R1(config-if)#exit
首先对所有路由器进行配置:
Router>enRouter#conf tRouter(config)#line c 0Router(config-line)#exec-t 0 0Router(config-line)#logg synchronous Router(config-line)#no ip domain-loRouter(config)#ho RX //RX为路由器编号,例如R1/R2/R3/R4
3、搭建RIP环境 R1的RIP V2配置:
R1(config)#router rip R1(config-router)#version 2R1(config-router)#no auto-summary//建议关闭自动汇总R1(config-router)#network 1.0.0.0R1(config-router)#network 12.0.0.0R1(config-router)#network 14.0.0.0R1(config-router)#exit
R2的RIP V2配置:
R2(config)#router rip R2(config-router)#version 2R2(config-router)#no auto-summary R2(config-router)#network 2.0.0.0R2(config-router)#network 12.0.0.0 R2(config-router)#exit
R3的RIP V2配置:
R4(config)#router ripR4(config-router)#version 2R4(config-router)#no auto-summary R4(config-router)#network 14.0.0.0R4(config-router)#exit
4、搭建OSPF环境: R2的OSPF配置:
R2(config)#router ospf 100R2(config-router)#router-id 2.2.2.2 (OSPF的router-id具有本地唯一性)R2(config-router)#network 23.1.1.0 0.0.0.255 area 0 (骨干区域为area 0)R2(config-router)#exit
R3的OSPF配置:
R3(config)#router ospf 100R3(config-router)#router-id 3.3.3.3R3(config-router)#network 3.3.3.0 0.0.0.255 area 0R3(config-router)#network 23.1.1.0 0.0.0.255 area 0R3(config-router)#network 34.1.1.0 0.0.0.255 area 0R3(config-router)#exit
R4的OSPF配置:
R4(config-if)#router os 100R4(config-router)#router-id 4.4.4.4R4(config-router)#network 4.4.4.0 0.0.0.255 area 0R4(config-router)#network 34.1.1.0 0.0.0.255 area 0R4(config-router)#exit
配置完成后可以在R1与R3上查看路由,R1上存在R2的loopback 1路由,R3上存在R4的loopback 1路由:
R1(config)#do show ip route rip 2.0.0.0/32 is subnetted, 1 subnetsR 2.2.2.2 [120/1] via 12.1.1.2, 00:00:27, Serial1/1
R3(config)#do show ip route ospf 4.0.0.0/32 is subnetted, 1 subnetsO 4.4.4.4 [110/65] via 34.1.1.2, 00:00:18, Serial1/1
5、在R2/R4上进行双向重发布配置: R2的配置:
R2(config)#router rip R2(config-router)#redistribute ospf 100 metric 1//将OSPF中的静态路由重发布到RIP V2中,其metric为1R2(config-router)#exit R2(config)#router ospf 100R2(config-router)#redistribute rip subnets//将RIP V2的路由重发布到OSPF中
R4的配置:
R4(config)#router rip R4(config-router)#redistribute ospf 100 metric 1R4(config-router)#exit R4(config)#router ospf 100R4(config-router)#redistribute rip subnets
可以使用此命令刷新路由表
R1#clear ip route *
6、此时R1/R2/R3/R4上将会产生次优路径:
(1)修改R4上的次优路径:
R4#show ip route 34.0.0.0/24 is subnetted, 1 subnetsC 34.1.1.0 is directly connected, Serial1/0 1.0.0.0/32 is subnetted, 1 subnetsR 1.1.1.1 [120/1] via 14.1.1.1, 00:00:04, FastEthernet0/0 2.0.0.0/32 is subnetted, 1 subnetsO E2 2.2.2.2 [110/20] via 34.1.1.1, 00:01:27, Serial1/0 3.0.0.0/32 is subnetted, 1 subnetsO 3.3.3.3 [110/65] via 34.1.1.1, 00:01:27, Serial1/0 4.0.0.0/32 is subnetted, 1 subnetsC 4.4.4.4 is directly connected, Loopback1 23.0.0.0/24 is subnetted, 1 subnetsO 23.1.1.0 [110/128] via 34.1.1.1, 00:01:27, Serial1/0 12.0.0.0/24 is subnetted, 1 subnetsO E2 12.1.1.0 [110/20] via 34.1.1.1, 00:00:11, Serial1/0 14.0.0.0/24 is subnetted, 1 subnetsC 14.1.1.0 is directly connected, FastEthernet0/0
此时OE 2的路由均为次优路由 次优路由的产生原因:2.2.2.2/32的路由由RIP V2发布,其AD值为120,在R2上进行重发布到OSPF中,此时的OSPF中2.2.2.2/32路由类型为OE2,其路由的AD值为110,由于路由选择先考虑其AD值,AD值越小路由越优,所以此时路由表会加载OSPF OE2的路由,造成了次优路径的问题(12.1.1.0/24与此相同)
解决办法: 在OSPF中直接修改个别重发布路由的AD值或者修改其所有重发布路由的AD值
R4(config)#router ospf 100R4(config-router)#distance 121 2.2.2.2 0.0.0.0//此意思为router-id为2.2.2.2的路由器所发布的OSPF路由的AD值为121
121为修改后的AD值;2.2.2.2为修改的router-id;0.0.0.0为反掩码
修改完成后,此时还会存在次优路径
2.0.0.0/32 is subnetted, 1 subnetsO E2 2.2.2.2 [121/20] via 34.1.1.1, 00:01:20, Serial1/0
由于AD值为121,证明上面的修改AD值已经生效,此时仍为次优路径的原因是:R4在收到R2所发布的AD值为121的2.2.2.2/32路由时将其重发布给R1,当R1从F0/0接口接收到AD值为121的2.2.2.2/32路由,并且R1从S1/1接口接收到AD值为120的2.2.2.2/32路由时,R1不会将S1/1收到的AD值为120的2.2.2.2/32路由从F0/0转发给R4
解决方法:在R1上使用ACL抓取感兴趣流量(2.2.2.2/32路由),并且在RIP V2中使用offset-list进行加mitric来修改选路
R1(config)#access-list 1 permit 2.2.2.0 0.0.0.255R1(config)#router rip R1(config-router)#offset-list 1 in 3 f0/0
完成之后,对路由表进行刷新
34.0.0.0/24 is subnetted, 1 subnetsC 34.1.1.0 is directly connected, Serial1/0 1.0.0.0/32 is subnetted, 1 subnetsR 1.1.1.1 [120/1] via 14.1.1.1, 00:00:03, FastEthernet0/0 2.0.0.0/32 is subnetted, 1 subnetsR 2.2.2.2 [120/2] via 14.1.1.1, 00:00:03, FastEthernet0/0 3.0.0.0/32 is subnetted, 1 subnetsO 3.3.3.3 [110/65] via 34.1.1.1, 00:03:40, Serial1/0 4.0.0.0/24 is subnetted, 1 subnetsC 4.4.4.0 is directly connected, Loopback1 23.0.0.0/24 is subnetted, 1 subnetsO 23.1.1.0 [110/128] via 34.1.1.1, 00:03:40, Serial1/0 12.0.0.0/24 is subnetted, 1 subnetsR 12.1.1.0 [120/1] via 14.1.1.1, 00:00:03, FastEthernet0/0 14.0.0.0/24 is subnetted, 1 subnetsC 14.1.1.0 is directly connected, FastEthernet0/0
此时R4的路由表全为最优路由
(2)修改R2的次优路径:
R2#show ip route 34.0.0.0/24 is subnetted, 1 subnetsO 34.1.1.0 [110/128] via 23.1.1.2, 00:05:18, Serial1/1 1.0.0.0/32 is subnetted, 1 subnetsO E2 1.1.1.1 [110/20] via 23.1.1.2, 00:05:18, Serial1/1 2.0.0.0/32 is subnetted, 1 subnetsC 2.2.2.2 is directly connected, Loopback1 3.0.0.0/32 is subnetted, 1 subnetsO 3.3.3.3 [110/65] via 23.1.1.2, 00:05:18, Serial1/1 4.0.0.0/8 is variably subnetted, 2 subnets, 2 masksO 4.4.4.4/32 [110/129] via 23.1.1.2, 00:05:18, Serial1/1R 4.4.4.0/24 [120/2] via 12.1.1.1, 00:00:06, Serial1/0 23.0.0.0/24 is subnetted, 1 subnetsC 23.1.1.0 is directly connected, Serial1/1 12.0.0.0/24 is subnetted, 1 subnetsC 12.1.1.0 is directly connected, Serial1/0 14.0.0.0/24 is subnetted, 1 subnetsO E2 14.1.1.0 [110/20] via 23.1.1.2, 00:05:19, Serial1/1
其中OE 2类型的OSPF路由均为次优路由 解决办法: 在OSPF中直接修改个别重发布路由的AD值或者修改其所有重发布路由的AD值
R4(config)#router ospf 100R4(config-router)#distance 121 4.4.4.4 0.0.0.0
完成之后刷新路由表:
34.0.0.0/24 is subnetted, 1 subnetsO 34.1.1.0 [110/128] via 23.1.1.2, 00:00:02, Serial1/1 1.0.0.0/32 is subnetted, 1 subnetsR 1.1.1.1 [120/1] via 12.1.1.1, 00:00:00, Serial1/0 2.0.0.0/32 is subnetted, 1 subnetsC 2.2.2.2 is directly connected, Loopback1 3.0.0.0/32 is subnetted, 1 subnetsO 3.3.3.3 [110/65] via 23.1.1.2, 00:00:02, Serial1/1 4.0.0.0/8 is variably subnetted, 2 subnets, 2 masksO 4.4.4.4/32 [121/129] via 23.1.1.2, 00:00:02, Serial1/1R 4.4.4.0/24 [120/2] via 12.1.1.1, 00:00:00, Serial1/0 23.0.0.0/24 is subnetted, 1 subnetsC 23.1.1.0 is directly connected, Serial1/1 12.0.0.0/24 is subnetted, 1 subnetsC 12.1.1.0 is directly connected, Serial1/0 14.0.0.0/24 is subnetted, 1 subnetsR 14.1.1.0 [120/1] via 12.1.1.1, 00:00:01, Serial1/0
此时R2的路由表全为最优路由
(3)修改R1的次优路径:
R1#show ip route 34.0.0.0/24 is subnetted, 1 subnetsR 34.1.1.0 [120/1] via 14.1.1.2, 00:00:00, FastEthernet0/0 [120/1] via 12.1.1.2, 00:00:00, Serial1/1 1.0.0.0/32 is subnetted, 1 subnetsC 1.1.1.1 is directly connected, Loopback1 2.0.0.0/32 is subnetted, 1 subnetsR 2.2.2.2 [120/1] via 12.1.1.2, 00:00:00, Serial1/1 3.0.0.0/32 is subnetted, 1 subnetsR 3.3.3.3 [120/1] via 14.1.1.2, 00:00:00, FastEthernet0/0 [120/1] via 12.1.1.2, 00:00:00, Serial1/1 4.0.0.0/8 is variably subnetted, 2 subnets, 2 masksR 4.4.4.4/32 [120/1] via 12.1.1.2, 00:00:00, Serial1/1R 4.4.4.0/24 [120/1] via 14.1.1.2, 00:00:00, FastEthernet0/0 23.0.0.0/24 is subnetted, 1 subnetsR 23.1.1.0 [120/1] via 14.1.1.2, 00:00:01, FastEthernet0/0 [120/1] via 12.1.1.2, 00:00:01, Serial1/1 12.0.0.0/24 is subnetted, 1 subnetsC 12.1.1.0 is directly connected, Serial1/1 14.0.0.0/24 is subnetted, 1 subnetsC 14.1.1.0 is directly connected, FastEthernet0/0
7、设置负载均衡 由于R1-R3的路径可以负载均衡,其余的负载均衡都是不正确的路由
解决方法:使用ACL抓取感兴趣流量(23.1.1.0/24与34.1.1.0/24),使用offset-list进行加metric进行修改
R1(config)#access-list 5 permit 23.1.1.0 0.0.0.255R1(config)#access-list 10 permit 34.1.1.0 0.0.0.255R1(config)#router rip R1(config-router)#ofR1(config-router)#offset-list 5 in 3 f0/0R1(config-router)#offset-list 10 in 3 s1/1
完成之后,刷新路由表:
34.0.0.0/24 is subnetted, 1 subnetsR 34.1.1.0 [120/1] via 14.1.1.2, 00:00:02, FastEthernet0/0 1.0.0.0/32 is subnetted, 1 subnetsC 1.1.1.1 is directly connected, Loopback1 2.0.0.0/32 is subnetted, 1 subnetsR 2.2.2.2 [120/1] via 12.1.1.2, 00:00:02, Serial1/1 3.0.0.0/32 is subnetted, 1 subnetsR 3.3.3.3 [120/1] via 14.1.1.2, 00:00:02, FastEthernet0/0 [120/1] via 12.1.1.2, 00:00:02, Serial1/1 4.0.0.0/32 is subnetted, 1 subnetsR 4.4.4.4 [120/1] via 14.1.1.2, 00:00:02, FastEthernet0/0 23.0.0.0/24 is subnetted, 1 subnetsR 23.1.1.0 [120/1] via 12.1.1.2, 00:00:02, Serial1/1 12.0.0.0/24 is subnetted, 1 subnetsC 12.1.1.0 is directly connected, Serial1/1 14.0.0.0/24 is subnetted, 1 subnetsC 14.1.1.0 is directly connected, FastEthernet0/0
此时的R1路由表全为最优路由
(4)修改R3的次优路由:
R3#show ip route 34.0.0.0/24 is subnetted, 1 subnetsC 34.1.1.0 is directly connected, Serial1/1 1.0.0.0/32 is subnetted, 1 subnetsO E2 1.1.1.1 [110/20] via 34.1.1.2, 00:08:29, Serial1/1 [110/20] via 23.1.1.1, 00:08:29, Serial1/0 2.0.0.0/32 is subnetted, 1 subnetsO E2 2.2.2.2 [110/20] via 34.1.1.2, 00:08:29, Serial1/1 [110/20] via 23.1.1.1, 00:08:29, Serial1/0 3.0.0.0/32 is subnetted, 1 subnetsC 3.3.3.3 is directly connected, Loopback1 4.0.0.0/32 is subnetted, 1 subnetsO 4.4.4.4 [110/65] via 34.1.1.2, 00:07:26, Serial1/1 23.0.0.0/24 is subnetted, 1 subnetsC 23.1.1.0 is directly connected, Serial1/0 12.0.0.0/24 is subnetted, 1 subnetsO E2 12.1.1.0 [110/20] via 34.1.1.2, 00:08:30, Serial1/1 [110/20] via 23.1.1.1, 00:08:30, Serial1/0 14.0.0.0/24 is subnetted, 1 subnetsO E2 14.1.1.0 [110/20] via 34.1.1.2, 00:08:30, Serial1/1 [110/20] via 23.1.1.1, 00:08:30, Serial1/0
由于R3-R1的路由可以负载均衡,其余的负载均衡全是不正确的路由
解决方法: 使用route-map进行修改(在重发布的位置进行调用) 可以修改OSPF路由类型(优先级:OE 1 > OE 2) 可以修改metric(默认OE 2类型metric为20)
使用ACL抓取感兴趣流量(2.2.2.2/32与12.1.1.0/24、14.1.1.0/24)
R2(config)#access-list 5 permit 2.2.2.0 0.0.0.255R2(config)#access-list 5 permit 12.1.1.0 0.0.0.255R2(config)#access-list 10 permit 14.1.1.0 0.0.0.255R2(config)#route-map ccie permit 10R2(config-route-map)#match ip address 5R2(config-route-map)#set metric 19 (修改ACL 5抓取的流量metric为19)R2(config)#route-map ccie permit 20 R2(config-route-map)#match ip address 10R2(config-route-map)#set metric-type type-1 (修改ACL 10抓取的流量类型为OE 1)R2(config-route-map)#exit R2(config)#route-map ccie permit 30 (空语句,route-map内含拒绝所有)R2(config-route-map)#exit
调用route-map来修改R3的路由
R2(config)#router ospf 100R2(config-router)#redistribute rip subnets route-map ccie
完成之后,刷新路由表:
34.0.0.0/24 is subnetted, 1 subnetsC 34.1.1.0 is directly connected, Serial1/1 1.0.0.0/32 is subnetted, 1 subnetsO E2 1.1.1.1 [110/20] via 34.1.1.2, 00:00:04, Serial1/1 [110/20] via 23.1.1.1, 00:00:04, Serial1/0 2.0.0.0/32 is subnetted, 1 subnetsO E2 2.2.2.2 [110/19] via 23.1.1.1, 00:00:04, Serial1/0 3.0.0.0/32 is subnetted, 1 subnetsC 3.3.3.3 is directly connected, Loopback1 4.0.0.0/32 is subnetted, 1 subnetsO 4.4.4.4 [110/65] via 34.1.1.2, 00:00:04, Serial1/1 23.0.0.0/24 is subnetted, 1 subnetsC 23.1.1.0 is directly connected, Serial1/0 12.0.0.0/24 is subnetted, 1 subnetsO E2 12.1.1.0 [110/19] via 23.1.1.1, 00:00:05, Serial1/0 14.0.0.0/24 is subnetted, 1 subnetsO E1 14.1.1.0 [110/84] via 23.1.1.1, 00:00:05, Serial1/0
此时R3的路由表全为最优路由
创作者:Eric· Charles
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~