四、路由策略实验

      AR1、AR2、AR3路由器运行OSPF协议,AR2为ABR路由器,AR1连接3个网段,要求3.0网段不能发布给AREA1区域。通过在ABR上部署路由策略,控制在AREA1区域不接收3.0网段实现需求。

AR1:
[AR1]int lo 1
[AR1-LoopBack1]ip add 192.168.1.1 24
[AR1-LoopBack1]int lo 2
[AR1-LoopBack2]ip add 192.168.2.1 24
[AR1-LoopBack2]int lo 3
[AR1-LoopBack3]ip add 192.168.3.1 24
[AR1-LoopBack3]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 10.1.1.1 30

//配置OSPF
[AR1]ospf 100
[AR1-ospf-100]area 0
[AR1-ospf-100-area-0.0.0.0]net 10.1.1.0 0.0.0.3
[AR1-ospf-100-area-0.0.0.0]net 192.168.1.0 0.0.0.255
[AR1-ospf-100-area-0.0.0.0]net 192.168.2.0 0.0.0.255
[AR1-ospf-100-area-0.0.0.0]net 192.168.3.0 0.0.0.255

AR2:
[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 10.1.1.2 255.255.255.252
[AR2-GigabitEthernet0/0/0]int g0/0/1
[AR2-GigabitEthernet0/0/1]ip add 10.1.1.5 30

//配置OSPF
[AR2]ospf 100
[AR2-ospf-100]area 0
[AR2-ospf-100-area-0.0.0.0]net 10.1.1.0 0.0.0.3
[AR2-ospf-100]area 1
[AR2-ospf-100-area-0.0.0.1]net 10.1.1.4 0.0.0.3

//在ABR上配置路由策略,OSPF是链路状态协议,在ABR上配置。
配置ACL列表也行、配置Ip-prefix前缀也行,两者可选。

//配置ACL
[AR2]acl number 2000
[AR2-acl-basic-2000]rule deny source 192.168.3.0 0.0.0.255
[AR2-acl-basic-2000]rule permit source any
//配置前缀
[AR2]ip ip-prefix 3guolv deny 192.168.3.0 24
[AR2]ip ip-prefix 3guolv permit 192.168.2.0 24
[AR2]ip ip-prefix 3guolv permit 192.168.1.0 24

[AR2]ip ip-prefix 3guolv permit 172.16.0.0 16
//配置策略并应用,以下两者和上面呼应即可。

[AR2]ospf 100
[AR2-ospf-100]area 1
[AR2-ospf-100-area-0.0.0.1]filter 2000 import //引用ACL进行路由策略的配置。注意这里是在区域1,区域0的路由进入区域1,所以方向也是import

[AR2]ospf 100
[AR2-ospf-100]area 0
[AR2-ospf-100-area-0.0.0.1]filter ip-prefix 3guolv import //引用地址前缀路由策略的配置。

AR3:
[AR3]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip add 10.1.1.6 30
[AR3-GigabitEthernet0/0/0]ospf 100
[AR3-ospf-100]area 1
[AR3-ospf-100-area-0.0.0.1]net 10.1.1.6 0.0.0.3

    在AR1与AR2和AR3建立EBGP,AR2/3/4建立IBGP,AS200的IGP协议OSPF。192.168.1.1/24网段为路由器引入网段,配置不同的MED属性策略,使AR4优先学习到AR2的192.168.1.0/24路由。

AR1:

interface LoopBack0
ip address 1.1.1.1 255.255.255.255

interface LoopBack1
ip address 192.168.1.1 255.255.255.0

interface GigabitEthernet0/0/0
ip address 10.1.1.1 255.255.255.252

interface GigabitEthernet0/0/1
ip address 10.1.1.5 255.255.255.252

//配置EBGP。

bgp 100
group ex external
peer 10.1.1.2 as-number 200
peer 10.1.1.2 group ex
peer 10.1.1.6 as-number 200
peer 10.1.1.6 group ex
ipv4-family unicast
network 192.168.1.0
maximum load-balancing 2

AR2:

interface LoopBack0
ip address 2.2.2.2 255.255.255.255

interface GigabitEthernet0/0/0
ip address 10.1.1.2 255.255.255.252

interface GigabitEthernet0/0/1
ip address 10.1.1.9 255.255.255.252

//配置OSPF
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.1.1.0 0.0.0.3
network 10.1.1.8 0.0.0.3

//配置BGP
bgp 200
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
group ex external
peer 10.1.1.1 as-number 100
peer 10.1.1.1 group ex
group in internal
ipv4-family unicast
import-route ospf 1
peer 4.4.4.4 next-hop-local

AR3:

interface GigabitEthernet0/0/0
ip address 10.1.1.13 255.255.255.252

interface GigabitEthernet0/0/1
ip address 10.1.1.6 255.255.255.252

interface LoopBack0
ip address 3.3.3.3 255.255.255.255

//配置OSPF

ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.1.1.4 0.0.0.3
network 10.1.1.12 0.0.0.3

//配置BGP
bgp 200
group ex external
peer 10.1.1.5 as-number 100
peer 10.1.1.5 group ex
group in internal
peer 4.4.4.4 as-number 200
peer 4.4.4.4 group in
peer 4.4.4.4 connect-interface LoopBack0

ipv4-family unicast
import-route ospf 1
peer 4.4.4.4 next-hop-local

AR4:

interface LoopBack0
ip address 4.4.4.4 255.255.255.255

interface LoopBack1
ip address 192.168.100.1 255.255.255.0

interface GigabitEthernet0/0/0
ip address 10.1.1.10 255.255.255.252

interface GigabitEthernet0/0/1
ip address 10.1.1.14 255.255.255.252

//配置OSPF

ospf 1
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 10.1.1.8 0.0.0.3
network 10.1.1.12 0.0.0.3
network 192.168.100.0 0.0.0.255

//配置BGP

bgp 200
group ex external
group in internal
peer 2.2.2.2 as-number 200
peer 2.2.2.2 group in
peer 2.2.2.2 connect-interface LoopBack0
peer 3.3.3.3 as-number 200
peer 3.3.3.3 group in
peer 3.3.3.3 connect-interface LoopBack0

ipv4-family unicast
import-route ospf 1
maximum load-balancing 2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值