BGP选路实验

R1

int g0/0/0

ip address 12.0.0.1 24

int g0/0/1

ip address 13.0.0.1 24

int g0/0/2

ip address 15.0.0.1 24

int l0

ip address 1.1.1.1 32

int l1

ip address 192.168.100.1 24

R2

int g0/0/0

ip address 24.0.0.2 24

int g0/0/1

ip address 12.0.0.2 24

int l0

ip address 2.2.2.2 32

int l1

ip address 192.168.20.1 24

R3

int g0/0/0

[r3-GigabitEthernet0/0/0]ip address 34.0.0.3 24

int g0/0/1

[r3-GigabitEthernet0/0/1]ip address 13.0.0.3 24

int l0

[r3-LoopBack0]ip address 3.3.3.3 32

int l1

[r3-LoopBack1]ip address 192.168.30.1 24

R4

int g0/0/0

[r4-GigabitEthernet0/0/0]ip address 24.0.0.4 24

int g0/0/1

[r4-GigabitEthernet0/0/1]ip address 34.0.0.4 24

int l0

[r4-LoopBack0]ip address 192.168.1.1 24

int l1

[r4-LoopBack1]ip address 192.168.2.1 24

int l2

[r4-LoopBack2]ip address 192.168.3.1 24

R5

int g0/0/0

[r5-GigabitEthernet0/0/0]ip address 15.0.0.5 24

int l0

[r5-LoopBack0]ip address 192.168.10.1 24

int l1

[r5-LoopBack1]IP address 192.168.11.1 24

int l2

[r5-LoopBack2]ip address 192.168.12.1 24

OSPF

r1

ospf 1 router-id 1.1.1.1

a 0

network 1.1.1.1 0.0.0.0

network 192.168.100.0 0.0.0.255

network 12.0.0.1 0.0.0.0

network 13.0.0.1 0.0.0.0

network 15.0.0.1 0.0.0.0

r2

ospf 1 router-id 2.2.2.2

a 0

network 24.0.0.2 0.0.0.0

network 12.0.0.2 0.0.0.0

network 2.2.2.2 0.0.0.0

network 192.168.20.0 0.0.0.255

r3

ospf 1 router-id 3.3.3.3

a 0

network 13.0.0.3 0.0.0.0

network 34.0.0.3 0.0.0.0

network 3.3.3.3 0.0.0.0

network 192.168.30.0 0.0.0.255

BGP

r1

bgp 123

router-id 1.1.1.1

peer 12.0.0.2 as-number 123

peer 12.0.0.2 connect-interface l 0

peer 13.0.0.3 as-number 123

peer 13.0.0.3 connect-interface l 0

peer 15.0.0.5 as-number 500

peer 15.0.0.5 connect-interface l 0

bgp 123

network 192.168.100.0 24

r2

bgp 123

router-id 2.2.2.2

peer 12.0.0.1 as-number 123

peer 12.0.0.1 connect-interface l 0

peer 24.0.0.4 as-number 400

peer 24.0.0.4 connect-interface l 0

bgp 123

network 192.168.20.0 24

r3

bgp 123

router-id 3.3.3.3

peer 13.0.0.1 as-number 123

peer 13.0.0.1 connect-interface l 0

peer 34.0.0.4 as-number 400

peer 34.0.0.4 connect-interface l 0

bgp 123

network 192.168.30.0 24

r4

bgp 400

router-id 4.4.4.4

peer 24.0.0.2 as-number 123

peer 34.0.0.3 as-number 123\

q

bgp 400

network 192.168.1.0 24

network 192.168.2.0 24

network 192.168.3.0 24

r5

bgp 500

router-id 5.5.5.5

peer 15.0.0.1 as-number 123

bgp 500

network 192.168.10.0 24

network 192.168.11.0 24

network 192.168.12.0 24

使用preval策略

r4

ip ip-prefix PV permit 192.168.10.0 24

route-policy PV permit node 10

if-match ip-prefix PV

apply preferred-value 100

q

route-policy PV permit node 20

bgp 400

peer 24.0.0.2 route-policy PV import

使用AS_PATH策略

r4

route-policy AS permit node 11

if-match ip-prefix AS

apply as-path 400 123 overwrite

q

route-policy AS permit node 21

q

bgp 400

peer 34.0.0.3 route-policy AS export

使用MED策略

r3

ip ip-prefix MED permit 192.168.12.0 24

route-policy MED permit node 10[r3-route-policy]if-match ip-prefix MED

apply cost 20

route-policy MED permit node 20

bgp 123

peer 34.0.0.4 route-policy MED export

r4

bgp 400

default med 10

使用Local Preference策略

r1

ip ip-prefix LP permit 192.168.1.0 24

route-policy LP permit node 10

if-match ip-prefix LP

apply local-preference 200

route-policy LP permit node 20

bgp 123

peer 12.0.0.2 route-policy LP import

q

ip ip-prefix LP2 permit 192.168.2.0 24

route-policy LP2 permit node 11

if-match ip-prefix LP2

apply local-preference 200

route-policy LP2 permit node 21

bgp 123

peer 13.0.0.3 route-policy LP2 import

配置负载均衡

r1

bgp 123

maximum load-balancing 2

load-balancing as-path-ignore使用AS策略

使用AS策略

r1

ip as-path-filter 1 deny _123$

ip as-path-filter 1 permit .*

bgp 123

peer 15.0.0.5 as-path-filter 1 export

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值