路由策略实验

avatar
作者
筋斗云
阅读量:0

实验拓扑

实验要求:路由选路最佳

1.如图配置IP地址

R1:

interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0 
interface GigabitEthernet0/0/1
ip address 15.1.1.2 255.255.255.0
interface LoopBack0
ip address 1.1.1.1 255.255.255.0 
R2:

interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0 
interface GigabitEthernet0/0/1
ip address 13.1.1.1 255.255.255.0
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
R3:

interface GigabitEthernet0/0/0
ip address 14.1.1.2 255.255.255.0 
interface GigabitEthernet0/0/1
ip address 15.1.1.1 255.255.255.0
interface LoopBack0
ip address 3.3.3.3 255.255.255.0
R4:

interface GigabitEthernet0/0/0
ip address 13.1.1.2 255.255.255.0 
interface GigabitEthernet0/0/1
ip address 14.1.1.1 255.255.255.0 
interface LoopBack0
ip address 4.4.4.4 255.255.255.0 
 2、抓取定向流量并在接口下执行策略

R1:

ip ip-prefix gl2 index 10 permit 3.3.3.0 24
ip ip-prefix gl2 index 30 permit 14.1.1.0 24
ip ip-prefix gl2 index 40 permit 4.4.4.4 32
ip ip-prefix gl3 index 10 permit 2.2.2.0 24
ip ip-prefix gl3 index 20 permit 13.1.1.0 24
interface GigabitEthernet0/0/0
rip metricin ip-prefix gl2 10    ——————执行名为gl2的策略,并把开销值改为10
interface GigabitEthernet0/0/1
rip metricin ip-prefix gl3 10    ——————执行名为gl3的策略,并把开销值改为10
R2:

ip ip-prefix gl index 20 deny 3.3.3.0 24
ip ip-prefix gl index 30 deny 15.1.1.0 24
ip ip-prefix gl index 40 permit 0.0.0.0 0 less-equal 32 ————前缀列表末尾隐含一条拒绝所有,在匹配前要放通所有
rip 1                       
filter-policy ip-prefix gl import GigabitEthernet0/0/0 —————在协议中调用,注意方向
R3:

ip ip-prefix gl index 20 deny 2.2.2.0 24
ip ip-prefix gl index 30 deny 12.1.1.0 24
ip ip-prefix gl index 40 deny 1.1.1.0 24
ip ip-prefix gl index 50 permit 0.0.0.0 0 less-equal 32 ————前缀列表末尾隐含一条拒绝所有,在匹配前要放通所有
rip 1                       
filter-policy ip-prefix gl import GigabitEthernet0/0/1 —————在协议中调用,注意方向

4、观察R1,R4的路由表

    广告一刻

    为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!