7.优选MED属性值最小的路由
![图片[1]-7.6 BGP路由优选规则-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片66.png)
1)基本配置同上,修改MED属性
[R2]ip ip-prefix 1 index 10 permit 2.2.2.2 32
[R2]route-policy dsrw.com permit node 10
[R2-route-policy]if-match ip-prefix 1
[R2-route-policy]apply cost 1000
[R2]bgp 200
[R2-bgp]peer 12.1.1.1 route-policy dsrw.com export
2)查看路由表
<R1>display bgp routing-table 2.2.2.2
BGP local router ID : 12.1.1.1
Local AS number : 13
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 2.2.2.2/32:
From: 3.3.3.3 (3.3.3.3)
Route Duration: 00h47m08s
Relay IP Nexthop: 13.1.1.3
Relay IP Out-Interface: GigabitEthernet0/0/2
Original nexthop: 3.3.3.3
Qos information : 0x0
AS-path 200, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255, IGP cost 1
Advertised to such 1 peers:
12.1.1.2
BGP routing table entry information of 2.2.2.2/32:
From: 12.1.1.2 (2.2.2.2)
Route Duration: 00h01m15s
Direct Out-interface: GigabitEthernet0/0/0
Original nexthop: 12.1.1.2
Qos information : 0x0
AS-path 200, origin igp, MED 1000, pref-val 0, valid, external, pre 255, not preferred for MED
Not advertised to any peer yet
8.优选从EBGP对等体学来的路由(EBGP路由优先级高于IBGP路由)
![图片[2]-7.6 BGP路由优选规则-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片66-1.png)
1)基本配置
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 13.1.1.0 0.255.255.255
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 13.1.1.0 0.255.255.255
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
2)配置BGP
[R1]bgp 13
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 3.3.3.3 as-number 13
[R1-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R1-bgp]peer 3.3.3.3 next-hop-local
[R1-bgp]peer 12.1.1.2 as-number 200
[R2]bgp 200
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 12.1.1.1 as-number 13
[R2-bgp]peer 23.1.1.3 as-number 13
[R2-bgp]network 2.2.2.2 32
[R3]bgp 13
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 1.1.1.1 as-number 13
[R3-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R3-bgp]peer 1.1.1.1 next-hop-local
[R3-bgp]peer 23.1.1.2 as-number 200
3)查看BGP路由表,EBGP通告优于IBGP
<R1>dis bgp routing-table
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 2.2.2.2/32 12.1.1.2 0 0 200i
* i 3.3.3.3 0 100 0 200i
<R1>dis bgp routing-table 2.2.2.2
BGP local router ID : 12.1.1.1
Local AS number : 13
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 2.2.2.2/32:
From: 12.1.1.2 (2.2.2.2)
Route Duration: 00h01m00s
Direct Out-interface: GigabitEthernet0/0/0
Original nexthop: 12.1.1.2
Qos information : 0x0
AS-path 200, origin igp, MED 0, pref-val 0, valid, external, best, select, active, pre 255
Advertised to such 1 peers:
3.3.3.3
BGP routing table entry information of 2.2.2.2/32:
From: 3.3.3.3 (3.3.3.3)
Route Duration: 00h52m18s
Relay IP Nexthop: 13.1.1.3
Relay IP Out-Interface: GigabitEthernet0/0/2
Original nexthop: 3.3.3.3
Qos information : 0x0
AS-path 200, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 1, not preferred for peer type
Not advertised to any peer yet
9.优选Next_Hop的IGP度量值最小的路由
![图片[3]-7.6 BGP路由优选规则-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片67.png)
1)基本配置
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 24.1.1.0 0.255.255.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.255.255.255
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.255.255.255
[R4-ospf-1-area-0.0.0.0]network 24.1.1.0 0.255.255.255
2)BGP配置
[R1]bgp 100
[R1-bgp]peer 12.1.1.2 as-number 234
[R1-bgp]peer 13.1.1.3 as-number 234
[R1-bgp]network 1.1.1.1 32
[R2]bgp 234
[R2-bgp]peer 4.4.4.4 as-number 234
[R2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R2-bgp]peer 4.4.4.4 next-hop-local
[R2-bgp]peer 12.1.1.1 as-number 100
[R3]bgp 234
[R3-bgp]peer 4.4.4.4 as-number 234
[R3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R3-bgp]peer 4.4.4.4 next-hop-local
[R3-bgp]peer 13.1.1.1 as-number 100
[R4]bgp 234
[R4-bgp]peer 2.2.2.2 as-number 234
[R4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R4-bgp]peer 3.3.3.3 as-number 234
[R4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
3)查看BGP路由表
[R4-bgp]display bgp routing-table
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 2.2.2.2 0 100 0 100i
* i 3.3.3.3 0 100 0 100i
[R4-bgp]display bgp routing-table 1.1.1.1
BGP local router ID : 4.4.4.4
Local AS number : 234
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 1.1.1.1/32:
From: 2.2.2.2 (2.2.2.2)
Route Duration: 00h06m49s
Relay IP Nexthop: 24.1.1.2
Relay IP Out-Interface: GigabitEthernet0/0/1
Original nexthop: 2.2.2.2
Qos information : 0x0
AS-path 100, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255, IGP cost 1
Not advertised to any peer yet
BGP routing table entry information of 1.1.1.1/32:
From: 3.3.3.3 (34.1.1.3)
Route Duration: 00h06m40s
Relay IP Nexthop: 34.1.1.3
Relay IP Out-Interface: GigabitEthernet0/0/0
Original nexthop: 3.3.3.3
Qos information : 0x0
AS-path 100, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 1, not preferred for router ID
Not advertised to any peer yet
4)修改R2的lo接口COST值,查看R4的BGP路由表
[R2]interface LoopBack 0
[R2-LoopBack0]ospf cost 9
<R4>dis bgp routing-table
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 1.1.1.1/32 3.3.3.3 0 100 0 100i
* i 2.2.2.2 0 100 0 100i
<R4>dis bgp routing-table 1.1.1.1
BGP local router ID : 4.4.4.4
Local AS number : 234
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 1.1.1.1/32:
From: 3.3.3.3 (34.1.1.3)
Route Duration: 00h12m37s
Relay IP Nexthop: 34.1.1.3
Relay IP Out-Interface: GigabitEthernet0/0/0
Original nexthop: 3.3.3.3
Qos information : 0x0
AS-path 100, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255, IGP cost 1
Not advertised to any peer yet
BGP routing table entry information of 1.1.1.1/32:
From: 2.2.2.2 (2.2.2.2)
Route Duration: 00h12m46s
Relay IP Nexthop: 24.1.1.2
Relay IP Out-Interface: GigabitEthernet0/0/1
Original nexthop: 2.2.2.2
Qos information : 0x0
AS-path 100, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 10, not preferred for IGP cost
Not advertised to any peer yet
10.优选Cluster_List最短的路由
![图片[4]-7.6 BGP路由优选规则-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片68.png)
1)基本配置
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.255.255.255
[R1-ospf-1-area-0.0.0.0]network 13.1.1.0 0.255.255.255
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.255.255.255
[R2-ospf-1-area-0.0.0.0]network 25.1.1.0 0.255.255.255
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 13.1.1.0 0.255.255.255
[R3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.255.255.255
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.255.255.255
[R4-ospf-1-area-0.0.0.0]network 45.1.1.0 0.255.255.255
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 25.1.1.0 0.255.255.255
[R5-ospf-1-area-0.0.0.0]network 45.1.1.0 0.255.255.255
2)创建GBP
[R1]bgp 12345
[R1-bgp]peer 2.2.2.2 as-number 12345
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R1-bgp]peer 3.3.3.3 as-number 12345
[R1-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R1-bgp]network 11.11.11.11 32
[R2]bgp 12345
[R2-bgp]peer 1.1.1.1 as-number 12345
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 5.5.5.5 as-number 12345
[R2-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R2-bgp]peer 1.1.1.1 reflect-client
[R3]bgp 12345
[R3-bgp]peer 1.1.1.1 as-number 12345
[R3-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R3-bgp]peer 4.4.4.4 as-number 12345
[R3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R3-bgp]peer 1.1.1.1 reflect-client
[R4]bgp 12345
[R4-bgp]peer 3.3.3.3 as-number 12345
[R4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R4-bgp]peer 5.5.5.5 as-number 12345
[R4-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R4-bgp]peer 3.3.3.3 reflect-client
[R5]bgp 12345
[R5-bgp]peer 2.2.2.2 as-number 12345
[R5-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R5-bgp]peer 4.4.4.4 as-number 12345
[R5-bgp]peer 4.4.4.4 connect-interface LoopBack 0
3)查看BGP路由表
[R5]display bgp routing-table
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 11.11.11.11/32 1.1.1.1 0 100 0 i
* i 1.1.1.1 0 100 0 i
[R5]display bgp routing-table 11.11.11.11
BGP local router ID : 45.1.1.5
Local AS number : 12345
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 11.11.11.11/32:
From: 2.2.2.2 (2.2.2.2)
Route Duration: 00h01m20s
Relay IP Nexthop: 25.1.1.2
Relay IP Out-Interface: GigabitEthernet0/0/2
Original nexthop: 1.1.1.1
Qos information : 0x0
AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, best, select, active, pre 255, IGP cost 2
Originator: 1.1.1.1
Cluster list: 2.2.2.2
Not advertised to any peer yet
BGP routing table entry information of 11.11.11.11/32:
From: 4.4.4.4 (4.4.4.4)
Route Duration: 00h01m20s
Relay IP Nexthop: 25.1.1.2
Relay IP Out-Interface: GigabitEthernet0/0/2
Original nexthop: 1.1.1.1
Qos information : 0x0
AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 2, not preferred for Cluster List
Originator: 1.1.1.1
Cluster list: 4.4.4.4, 3.3.3.3
Not advertised to any peer yet
11.优选Router-ID最小的设备通过的路由
![图片[5]-7.6 BGP路由优选规则-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片69.png)
1)基本配置
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.255.255.255
[R1-ospf-1-area-0.0.0.0]network 13.1.1.0 0.255.255.255
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.255.255.255
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 13.1.1.0 0.255.255.255
2)配置BGP
[R1]bgp 123
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.2.2 as-number 123
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R1-bgp]peer 3.3.3.3 as-number 123
[R1-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R1-bgp]network 11.11.11.11 32
[R2]bgp 123
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 1.1.1.1 as-number 123
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 1.1.1.1 next-hop-local
[R2-bgp]peer 24.1.1.4 as-number 400
[R3]bgp 123
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 1.1.1.1 as-number 123
[R3-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R3-bgp]peer 1.1.1.1 next-hop-local
[R3-bgp]peer 34.1.1.4 as
[R3-bgp]peer 34.1.1.4 as-number 400
[R4]bgp 400
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 24.1.1.2 as-number 123
[R4-bgp]peer 34.1.1.3 as-number 123
2)查看BGP路由表
<R4>dis bgp routing-table
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 11.11.11.11/32 24.1.1.2 0 123i
* 34.1.1.3 0 123i
[R4]display bgp routing-table 11.11.11.11
BGP local router ID : 4.4.4.4
Local AS number : 400
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 11.11.11.11/32:
From: 24.1.1.2 (2.2.2.2)
Route Duration: 00h01m27s
Direct Out-interface: GigabitEthernet0/0/1
Original nexthop: 24.1.1.2
Qos information : 0x0
AS-path 123, origin igp, pref-val 0, valid, external, best, select, active, pre 255
Advertised to such 2 peers:
34.1.1.3
24.1.1.2
BGP routing table entry information of 11.11.11.11/32:
From: 34.1.1.3 (3.3.3.3)
Route Duration: 00h03m37s
Direct Out-interface: GigabitEthernet0/0/0
Original nexthop: 34.1.1.3
Qos information : 0x0
AS-path 123, origin igp, pref-val 0, valid, external, pre 255, not preferred for router ID
Not advertised to any peer yet
12.优选具有最小IP地址的对等体通告的路由
![图片[6]-7.6 BGP路由优选规则-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片70.png)
1)配置BGP
[R1]bgp 100
[R1-bgp]peer 12.1.1.2 as-number 200
[R1-bgp]peer 21.1.1.2 as-number 200
[R1-bgp]network 1.1.1.1 32
[R2]bgp 200
[R2-bgp]peer 12.1.1.1 as-number 100
[R2-bgp]peer 21.1.1.1 as-number 100
2)查看BGP路由表
[R2]display bgp routing-table 1.1.1.1
BGP local router ID : 2.2.2.2
Local AS number : 200
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 1.1.1.1/32:
From: 12.1.1.1 (1.1.1.1)
Route Duration: 00h00m30s
Direct Out-interface: GigabitEthernet0/0/1
Original nexthop: 12.1.1.1
Qos information : 0x0
AS-path 100, origin igp, MED 0, pref-val 0, valid, external, best, select, active, pre 255
Advertised to such 2 peers:
12.1.1.1
21.1.1.1
BGP routing table entry information of 1.1.1.1/32:
From: 21.1.1.1 (1.1.1.1)
Route Duration: 00h00m29s
Direct Out-interface: GigabitEthernet0/0/0
Original nexthop: 21.1.1.1
Qos information : 0x0
AS-path 100, origin igp, MED 0, pref-val 0, valid, external, pre 255, not preferred for peer address
Not advertised to any peer yet
1 2
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
请登录后查看评论内容