HCIP-2.3 路由策略配置
路由策略配置

1.如图1,配置各个接口的IP地址(略)
2.启用OSPF协议(略)
ospf默认1Gbps链路开销为1(经过几个链路开销就是几)
R1到4.4.4.4的上下两条路径的开销都为3,如图2

改变下边接口的开销来影响流量的路径
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ospf cost 2
3.路由过滤(路由策略配置)
配置要求:
R1后边的网段不能访问7.7.7.7
R2、R3可以访问7.7.7.7
R1配置命令:
[R1]acl 2023
[R1-acl-basic-2023]rule 5 deny source 7.7.7.0 0.0.0.255
[R1-acl-basic-2023]rule 10 per
[R1-acl-basic-2023]qu
[R1]ospf 1
[R1-ospf-1]filter-policy 2023 import
此时,PC1、PC2无法访问7.7.7.7,R2、R3可以正常访问
PC>ping 7.7.7.7
Ping 7.7.7.7: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
Request timeout!
Request timeout!
Request timeout!
--- 7.7.7.7 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
<R2>ping -a 2.2.2.2 7.7.7.7
PING 7.7.7.7: 56 data bytes, press CTRL_C to break
Reply from 7.7.7.7: bytes=56 Sequence=1 ttl=127 time=20 ms
Reply from 7.7.7.7: bytes=56 Sequence=2 ttl=127 time=20 ms
Reply from 7.7.7.7: bytes=56 Sequence=3 ttl=127 time=20 ms
Reply from 7.7.7.7: bytes=56 Sequence=4 ttl=127 time=30 ms
Reply from 7.7.7.7: bytes=56 Sequence=5 ttl=127 time=20 ms
--- 7.7.7.7 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/22/30 ms
<R3>ping -a 3.3.3.3 7.7.7.7
PING 7.7.7.7: 56 data bytes, press CTRL_C to break
Reply from 7.7.7.7: bytes=56 Sequence=1 ttl=127 time=20 ms
Reply from 7.7.7.7: bytes=56 Sequence=2 ttl=127 time=20 ms
Reply from 7.7.7.7: bytes=56 Sequence=3 ttl=127 time=30 ms
Reply from 7.7.7.7: bytes=56 Sequence=4 ttl=127 time=20 ms
Reply from 7.7.7.7: bytes=56 Sequence=5 ttl=127 time=20 ms
--- 7.7.7.7 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/22/30 ms
*更多路由策略内容详见后续更新的BGP相关知识
发表评论