BGP策略实验

要求分析

修改r4上的192.168.10.0/24网段的值,将pv值改成大于0。将r3上的该属性变为空列表。修改r2r3的med属性默认值使r2>r3。修改r1的默认值和最大路由条目。打上路径标签,进行过滤。r2r3开启社团属性

配置

r1

[r1]int l 0
[r1-LoopBack0]ip add 1.1.1.1 32
[r1-LoopBack0]int l 1
[r1-LoopBack1]ip add 192.168.100.1 24
[r1-LoopBack1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[r1-GigabitEthernet0/0/0]int g 0/0/1
[r1-GigabitEthernet0/0/1]ip add 13.0.0.2 24
[r1-GigabitEthernet0/0/1]int g 0/0/2
[r1-GigabitEthernet0/0/2]ip add 15.0.0.1 24

ospf

[r1]ospf 1 rou 1.1.1.1
[r1-ospf-1]a 0
[r1-ospf-1-area-0.0.0.0]net 1.1.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]net 12.0.0.2 0.0.0.0
[r1-ospf-1-area-0.0.0.0]net 13.0.0.2 0.0.0.0
[r1-ospf-1-area-0.0.0.0]net 192.168.100.1 0.0.0.0

改环回接口类型

[r1]int l 1    
[r1-LoopBack1]ospf network-type broadcast 

bgp

[r1]bgp 123
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 2.2.2.2 as 123
[r1-bgp]peer 2.2.2.2 con l0
[r1-bgp]peer 2.2.2.2 next-hop-local
[r1-bgp]peer 3.3.3.3 as 123
[r1-bgp]peer 3.3.3.3 con l0
[r1-bgp]peer 3.3.3.3 next-hop-local
[r1-bgp]peer 15.0.0.2 as 500
[r1]bgp 123
[r1-bgp]net 192.168.100.0 24

local preference

[r1]ip ip-prefix lp1 permit 192.168.1.0 24
[r1]route-policy lp1 permit node 10
Info: New Sequence of this List.
[r1-route-policy]if-match ip-prefix lp1
[r1-route-policy]apply local-preference 200
[r1-route-policy]q
[r1]route-policy lp1 permit node 100
Info: New Sequence of this List.
[r1-route-policy]q
[r1]bgp 123
[r1-bgp]peer 2.2.2.2 route-policy lp1 import
[r1]ip ip-prefix lp2 permit 192.168.2.0 24
[r1]route-policy lp2 permit node 10
Info: New Sequence of this List.
[r1-route-policy]if-match ip-prefix lp2
[r1-route-policy]apply local-preference 200
[r1-route-policy]q
[r1]route-policy lp2 permit node 100
Info: New Sequence of this List.
[r1-route-policy]q
[r1]bgp 123
[r1-bgp]peer 3.3.3.3 route-policy lp2 import

均衡负载

[r1]bgp 123
[r1-bgp]maximum load-balancing 2

r2

[r2]int l 0
[r2-LoopBack0]ip add 2.2.2.2 32
[r2-LoopBack0]int l 1
[r2-LoopBack1]ip add 192.168.20.1 24
[r2-LoopBack1]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 24.0.0.2 24
[r2-GigabitEthernet0/0/0]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add 12.0.0.1 24

ospf

[r2]ospf 1 rou 2.2.2.2
[r2-ospf-1]a 0
[r2-ospf-1-area-0.0.0.0]net 2.2.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]net 192.168.20.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]net 12.0.0.1 0.0.0.0

改环回接口类型

[r2]int l 1
[r2-LoopBack1]ospf network-type broadcast 

bgp

[r2]bgp 123
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 24.0.0.1 as 400
[r2-bgp]peer 1.1.1.1 as 123
[r2-bgp]peer 1.1.1.1 con l0
[r2-bgp]peer 1.1.1.1 next-hop-local

[r2]bgp 123
[r2-bgp]net 192.168.20.0 24

自定义社区

[r2]bgp 123
[r2-bgp]peer 1.1.1.1 advertise-community

[r2]ip community-filter 1 permit 400:111
[r2]route-policy com permit node 10
Info: New Sequence of this List.
[r2-route-policy]if-match community-filter 1
[r2-route-policy]apply community no-export additive
[r2-route-policy]q
[r2]route-policy com permit node 100
Info: New Sequence of this List.
[r2-route-policy]q

[r2]bgp 123
[r2-bgp]peer 24.0.0.1 route-policy com import

r3

[r3]int l 0
[r3-LoopBack0]ip add 3.3.3.3 32
[r3-LoopBack0]int l 1
[r3-LoopBack1]ip add 192.168.30.1 24
[r3-LoopBack1]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 34.0.0.2 24
[r3-GigabitEthernet0/0/0]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip add 13.0.0.1 24

ospf

[r3]ospf 1 rou 3.3.3.3
[r3-ospf-1]a 0
[r3-ospf-1-area-0.0.0.0]net 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]net 192.168.30.1 0.0.0.0
[r3-ospf-1-area-0.0.0.0]net 13.0.0.1 0.0.0.0

改环回接口类型

[r3]int l 1
[r3-LoopBack1]ospf network-type broadcast

 bgp
[r3]bgp 123
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 34.0.0.1 as 400
[r3-bgp]peer 1.1.1.1 as 123
[r3-bgp]peer 1.1.1.1 con l0
[r3-bgp]peer 1.1.1.1 next-hop-local
[r3]bgp 123
[r3-bgp]net 192.168.30.0 24

自定义社区

[r3]bgp 123
[r3-bgp]peer 1.1.1.1 advertise-community

[r3]ip community-filter 1 permit 400:111
[r3]route-policy com permit node 10
Info: New Sequence of this List.
[r3-route-policy]if-match community-filter 1
[r3-route-policy]apply community no-export additive
[r3-route-policy]q
[r3]route-policy com permit node 100
Info: New Sequence of this List.
[r3-route-policy]q

[r3]bgp 123
[r3-bgp]peer 34.0.0.1 route-policy com import

r4

[r4]int l 0
[r4-LoopBack0]ip add 192.168.1.1 24
[r4-LoopBack0]int l 1
[r4-LoopBack1]ip add 192.168.2.1 24
[r4-LoopBack1]int l 2
[r4-LoopBack2]ip add 192.168.3.1 24
[r4-LoopBack2]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 24.0.0.1 24
[r4-GigabitEthernet0/0/0]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip add 34.0.0.1 24

bgp

[r4]bgp 400
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 24.0.0.2 as 123
[r4-bgp]peer 34.0.0.2 as 123

[r4]bgp 400
[r4-bgp]net 192.168.1.0 24
[r4-bgp]net 192.168.2.0 24
[r4-bgp]net 192.168.3.0 24

preva1

[r4]ip ip-prefix pv permit 192.168.10.0 24
[r4]route-policy pv permit node 10
Info: New Sequence of this List.
[r4-route-policy]if-match ip-prefix pv
[r4-route-policy]apply preferred-value 100
[r4-route-policy]q
[r4]route-policy pv permit node 100
Info: New Sequence of this List.
[r4-route-policy]q
[r4]bgp 400
[r4-bgp]peer 24.0.0.2 route-policy pv import

aspath

[r4]ip ip-prefix ap permit 192.168.11.0 24
[r4]route-policy pv permit node 20
Info: New Sequence of this List.
[r4-route-policy]if-match ip-prefix ap
[r4-route-policy]apply as-path 123 additive

med

[r4]ip ip-prefix med permit 192.168.12.0 24
[r4]route-policy pv permit node 30
Info: New Sequence of this List.
[r4-route-policy]if-match ip-prefix med
[r4-route-policy]apply cost 20

自定义社区

[r4]route-policy com-1 permit node 10
Info: New Sequence of this List.
[r4-route-policy]apply community 400:111
[r4-route-policy]q
[r4]bgp 400
[r4-bgp]net 192.168.3.0 24 route-policy com-1
[r4-bgp]peer 24.0.0.2 advertise-community
[r4-bgp]peer 34.0.0.2 advertise-community

r5

[r5]int l 0
[r5-LoopBack0]ip add 192.168.10.1 24
[r5-LoopBack0]int l 1
[r5-LoopBack1]ip add 192.168.11.1 24
[r5-LoopBack1]int l 2
[r5-LoopBack2]ip add 192.168.12.1 24
[r5-LoopBack2]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 15.0.0.2 24

bgp

[r5]bgp 500
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 15.0.0.1 as 123

[r5]bgp 500
[r5-bgp]net 192.168.10.0 24
[r5-bgp]net 192.168.11.0 24
[r5-bgp]net 192.168.12.0 24

as策略

[r5]ip as-path-filter 1 deny _123$
[r5]ip as-path-filter 1 permit .*
[r5]bgp 500
[r5-bgp]peer 15.0.0.1 as-path-filter 1 import

验证

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值