0x12 HCNP-R&S BGP路由策略实验(华为eNSP)

版权声明:本文为GJHe原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_35428201/article/details/82387815

实验拓扑

IP基本配置 

AR4

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys AR4
[AR4]inter l 1
[AR4-LoopBack1]ip add 192.168.1.1 24
[AR4-LoopBack1]inter l 2
[AR4-LoopBack2]ip add 192.168.2
[AR4]inter g0/0/0
[AR4-GigabitEthernet0/0/0]ip add 1.1.1.1 24
[AR4-GigabitEthernet0/0/0]inter g0/0/1
[AR4-GigabitEthernet0/0/1]ip add 2.2.2.1 24

AR1

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys AR1
[AR1]inter g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 1.1.1.2 24
[AR1-GigabitEthernet0/0/0]inter g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 3.3.3.1 24

AR2

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys AR2
[AR2]inter g0/0/0
[AR2-GigabitEthernet0/0/0]ip  add 2.2.2.2 24
[AR2-GigabitEthernet0/0/0]inte g0/0/1
[AR2-GigabitEthernet0/0/1]ip add 4.4.4.1 24

AR3

<Huawei>sys 
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys AR3
[AR3]inte g0/0/0
[AR3-GigabitEthernet0/0/0]ip add 3.3.3.2 24
[AR3-GigabitEthernet0/0/0]inter g0/0/1
[AR3-GigabitEthernet0/0/1]ip add 4.4.4.2 24
[AR3-GigabitEthernet0/0/1]inte l 1
[AR3-LoopBack1]ip add 172.16.1.1 24
[AR3-LoopBack1]inter l 2
[AR3-LoopBack2]ip ad 172.16.2.1 24

BGP基本配置

AR4

[AR4]bgp 100
[AR4-bgp]peer 1.1.1.2 as-number 200
[AR4-bgp]peer 2.2.2.2 as-number 200

AR1

[AR1]bgp 200
[AR1-bgp]peer 1.1.1.1 as-number 100
[AR1-bgp]peer 3.3.3.2 as-number 200
[AR1-bgp]peer 4.4.4.1 as-number 200

AR2

[AR2] bgp 200
[AR2-bgp]peer 2.2.2.1 as 100
[AR2-bgp]peer 3.3.3.1 as 200
[AR2-bgp]peer 4.4.4.2 as 200

AR3

[AR3]bgp 200
[AR3-bgp]peer 3.3.3.1 as 200
[AR3-bgp]peer 4.4.4.1 as 200

BGP引入

AR4

[AR4]bgp 100
[AR4-bgp]import-route direct 

AR1

[AR1]bgp 200
[AR1-bgp]import-route direct 

AR2

[AR2]bgp 200
[AR2-bgp]import-route direct 

AR3

[AR3]bg 200
[AR3-bgp]import-route direct 

查看BGP

display bgp peer

查看BGP路由表

display bgp routing-table 

配置路由策略

AR1

[AR1]acl 2001
[AR1-acl-basic-2001]rule permit source 192.168.1.0 0.0.0.255
[AR1-acl-basic-2001]quit
[AR1]acl 2002
[AR1-acl-basic-2002]rule permit source 192.168.2.0 0.0.0.255
AR1]route-policy yewu-1 permit node 10
	
[AR1-route-policy]if-match acl 2001	

[AR1-route-policy]apply local-preference 200 //本地优先级设置为200

AR1]route-policy yewu-1 permit node 20
	
[AR1-route-policy]if-match acl 2002	

[AR1-route-policy]apply local-preference 50 //本地优先级设置为50
[AR1]route-policy yewu-1 permit node 30//添加空节点
[AR1]bgp 200
[AR1-bgp]peer 3.3.3.2 route-policy yewu-1 export 

[AR2]acl 2001

[AR2-acl-basic-2001]rule permit source 192.168.1.0 0.0.0.255

[AR2-acl-basic-2001]q
[AR2]acl 2002	
[AR2-acl-basic-2002]rule permit source 192.168.2.0 0.0.0.255
[AR2-acl-basic-2002]qu

[AR2]route-policy yewu-2 permit node 10
Info: New Sequence of this List.

[AR2-route-policy]if-match acl 2001

[AR2-route-policy]apply local-preference 50
[AR2-route-policy]qu

[AR2]route-policy yewu-2 permit node 20
Info: New Sequence of this List.

[AR2-route-policy]if-match acl 2002

[AR2-route-policy]apply local-preference 200
[AR2-route-policy]route-policy yewu-2 permit node 30
Info: New Sequence of this List.
[AR2-route-policy]qu
[AR2]bgp 200

[AR2-bgp]peer 4.4.4.2 route-policy yewu-2 export 


[AR1]acl 2011
[AR1-acl-basic-2011]rule permit source 172.16.1.0 0.0.0.255
[AR1-acl-basic-2011]q

[AR1]acl 2012
[AR1-acl-basic-2012]rule permit source 172.16.2.0 0.0.0.255
[AR1-acl-basic-2012]qu	

[AR1]route-policy huawei-1 permit node 10
[AR1-route-policy]if-match acl 2011
[AR1-route-policy]apply cost 1000
[AR1-route-policy]quit

[AR1]route-policy huawei-1 permit node 20
[AR1-route-policy]if-match acl 2012
[AR1-route-policy]apply cost 200
[AR1-route-policy]qu

[AR1]route-policy huawei-1 permit node 30

[AR1]bgp 200
[AR1-bgp]peer 1.1.1.1 route-policy huawei-1 export 

[AR2]acl 2011
[AR2-acl-basic-2011]rule permit source 172.16.1.0 0.0.0.255
[AR2-acl-basic-2011]qu

[AR2]acl 2012
[AR2-acl-basic-2012]rule permit source 172.16.2.0 0.0.0.255
[AR2-acl-basic-2012]qu

[AR2]route-policy huawei-2 permit node 10
[AR2-route-policy]if-match acl 2011
[AR2-route-policy]apply cost 2000
[AR2-route-policy]qu

[AR2]route-policy huawei-2 permit node 20
[AR2-route-policy]if-match acl 2012
[AR2-route-policy]apply cost 1000
[AR2-route-policy]qu

[AR2]route-policy huawei-2 permit node 30

[AR2]bgp 200
[AR2-bgp]peer 2.2.2.1 route-policy huawei-2 export

猜你喜欢

转载自blog.csdn.net/qq_35428201/article/details/82387815
今日推荐