08 BGP 华为官方文档 十一条选路原则

BGP 华为官方文档 十一条选路原则 

丢弃下一跳不可达的路由

1)比较“协议首选值-pref-val”属性,数值越大越好,默认值是0,只在本设备生效,不在网络中传递

2)比较“本地优先级-local_pref”属性,数值越大越好,默认值是100

3)比较:是本地始发的路由,还是从对等体学来的路由, 本地始发的BGP路由优于从其他对等体学习到的路由,**本地始发的路由优先级:优选手动聚合>自动聚合>network>import>**从对等体学到的。

4)比较“as-path” 属性-as号越短越好

5)比较“起源属性”-指的是已什么方式注入进BGP协议的

6)比较“MED”属性,指的是一个路由器去往一个BGP路由网段的距离,类似cost

7)比较EBGP邻居优先于IBGP邻居,-EBGP路由优先级高于IBGP路由

8)比较“去往BGP路由的下一跳IP地址”的cost开销值-越小越好

—如果前面8条选路规则无法选出最优的路由,我们就可以做负载均衡了

备注:AS号一致,  在要负载均衡的那台设备上开启负载均衡功能

9)比较“cluster-list”的长度,越短越好

10)比较Router ID(Orginator_ID)的大小,越小越好

11)比较“peer 后面的IP地址的大小”,越小越好

验证 下一跳是否可达

R1


<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]bg	
[R1]bgp  100
[R1-bgp]dis	
[R1-bgp]display  th	
[R1-bgp]display  this 
[V200R003C00]
#
bgp 100peer 10.10.2.2 as-number 100 peer 10.10.2.2 connect-interface LoopBack0peer 10.10.3.3 as-number 100 peer 10.10.3.3 connect-interface LoopBack0#ipv4-family unicastundo synchronizationpeer 10.10.2.2 enablepeer 10.10.3.3 enable
#
return
[R1-bgp]q
[R1]dis	
[R1]display  bg	
[R1]display  bgp  rou	
[R1]display  bgp  routing-table BGP Local router ID is 192.168.12.1 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 4Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>i  10.10.4.4/32       10.10.2.2       0          100        0      200i* i                     10.10.3.3       0          100        0      200i*>i  10.10.8.8/32       10.10.2.2       0          100        0      200i* i                     10.10.3.3       0          100        0      200i
[R1]dis	
[R1]display  ip	
[R1]display  ip roi	
[R1]display  ip ro	
[R1]display  ip routing-table  10.10.4.4
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface10.10.4.4/32  IBGP    255  0          RD   10.10.2.2       GigabitEthernet
0/0/0[R1]dis	
[R1]display  bg	
[R1]display  bgp  ro	
[R1]display  bgp  routing-table BGP Local router ID is 192.168.12.1 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 4Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>i  10.10.4.4/32       10.10.3.3       0          100        0      200ii                     192.168.24.4    0          100        0      200i*>i  10.10.8.8/32       10.10.3.3       0          100        0      200ii                     192.168.24.4    0          100        0      200i
[R1]dis	
[R1]display  bg	
[R1]display  bgp  ro	
[R1]display  bgp  routing-table BGP Local router ID is 192.168.12.1 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 4Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>i  10.10.4.4/32       10.10.3.3       0          100        0      200ii                     192.168.24.4    0          100        0      200i*>i  10.10.8.8/32       10.10.3.3       0          100        0      200ii                     192.168.24.4    0          100        0      200i
[R1]dis	
[R1]display  bg	
[R1]display  bgp  ro	
[R1]display  bgp  routing-table BGP Local router ID is 192.168.12.1 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 4Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>i  10.10.4.4/32       10.10.2.2       0          100        0      200i* i                     10.10.3.3       0          100        0      200i*>i  10.10.8.8/32       10.10.2.2       0          100        0      200i* i                     10.10.3.3       0          100        0      200i
[R1]

R2


<R2>dis	
<R2>display  bg	
<R2>display  bgp  r	
<R2>display  bgp  routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   10.10.4.4/32       192.168.24.4    0                     0      200i*>   10.10.8.8/32       192.168.24.4    0                     0      200i
<R2>Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R2>sys
Enter system view, return user view with Ctrl+Z.
[R2]bg	
[R2]bgp  100
[R2-bgp]dis	
[R2-bgp]display  th	
[R2-bgp]display  this 
[V200R003C00]
#
bgp 100router-id 2.2.2.2peer 10.10.1.1 as-number 100 peer 10.10.1.1 connect-interface LoopBack0peer 192.168.24.4 as-number 200 #ipv4-family unicastundo synchronizationpeer 10.10.1.1 enablepeer 10.10.1.1 next-hop-local peer 192.168.24.4 enable
#
return
[R2-bgp]un	
[R2-bgp]undo    peer 10.10.1.1 next-hop-local 
[R2-bgp]q
[R2]dis	
[R2]display  bg	
[R2]display  bgp  ro	
[R2]display  bgp  routing-table  BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   10.10.4.4/32       192.168.24.4    0                     0      200i*>   10.10.8.8/32       192.168.24.4    0                     0      200i
[R2]display bgp routing-table 10.10.4.4BGP local router ID : 2.2.2.2Local AS number : 100Paths:   1 available, 1 best, 1 selectBGP routing table entry information of 10.10.4.4/32:From: 192.168.24.4 (4.4.4.4)Route Duration: 00h13m43s  Direct Out-interface: GigabitEthernet0/0/1Original nexthop: 192.168.24.4Qos information : 0x0AS-path 200, origin igp, MED 0, pref-val 0, valid, external, best, select, acti
ve, pre 255Advertised to such 1 peers:10.10.1.1
[R2]display ip  routing-table 10.10.4.4
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface10.10.4.4/32  EBGP    255  0           D   192.168.24.4    GigabitEthernet
0/0/1[R2]bg	
[R2]bgp  100
[R2-bgp]peer 10.10.1.1 next-hop-local 
[R2-bgp]dis	
[R2-bgp]display  bg	
[R2-bgp]display  bgp  ro	
[R2-bgp]display  bgp  routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   10.10.4.4/32       192.168.24.4    0                     0      200i*>   10.10.8.8/32       192.168.24.4    0                     0      200i
[R2-bgp]undo peer 10.10.1.1 next-hop-local
[R2-bgp]peer 10.10.1.1 next-hop-local
[R2-bgp]dis	
[R2-bgp]display  bg	
[R2-bgp]display  bgp  ro	
[R2-bgp]display  bgp  routing-table BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   10.10.4.4/32       192.168.24.4    0                     0      200i*>   10.10.8.8/32       192.168.24.4    0                     0      200i
[R2-bgp]display bgp routing-tableBGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   10.10.4.4/32       192.168.24.4    0                     0      200i*>   10.10.8.8/32       192.168.24.4    0                     0      200i
[R2-bgp]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on

R3

The device is running!<R3>dis	
<R3>display  bg	
<R3>display  bgp  p	
<R3>display  bgp  pathsTotal Number of Routes: 0Total Number of Paths: 0
<R3>display bgp pe	
<R3>display bgp peer BGP local router ID : 3.3.3.3Local AS number : 100Total number of peers : 2		  Peers in established state : 2Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv10.10.1.1       4         100        3        3     0 00:01:27 Established    0192.168.34.4    4         200        3        4     0 00:01:56 Established    0
<R3>dis	
<R3>display  bg	
<R3>display  bgp  ro	
<R3>display  bgp  routing-table BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 1Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   10.10.4.4/32       192.168.34.4    0                     0      200i
<R3>dis	
<R3>display  bg	
<R3>display  bgp  r	
<R3>display  bgp  routing-table BGP Local router ID is 3.3.3.3 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   10.10.4.4/32       192.168.34.4    0                     0      200i*>   10.10.8.8/32       192.168.34.4    0                     0      200i
<R3>Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R3>sys
Enter system view, return user view with Ctrl+Z.
[R3]bg	
[R3]bgp  100
[R3-bgp]un	
[R3-bgp]undo  peer 10.10.1.1 next-hop-local  
[R3-bgp]peer 10.10.1.1 next-hop-local  
[R3-bgp]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on

R4

The device is running!<R4>dis	
<R4>display  bg	
<R4>display  bgp  pe	
<R4>display  bgp  peer BGP local router ID : 4.4.4.4Local AS number : 200Total number of peers : 2		  Peers in established state : 2Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv192.168.24.2    4         100        4        4     0 00:02:06 Established    0192.168.34.3    4         100        4        4     0 00:02:06 Established    0
<R4>sys
Enter system view, return user view with Ctrl+Z.
[R4]bg	
[R4]bgp  200
[R4-bgp]dis	
[R4-bgp]display 
[R4-bgp]display  th	
[R4-bgp]display  this 
[V200R003C00]
#
bgp 200router-id 4.4.4.4peer 192.168.24.2 as-number 100 peer 192.168.34.3 as-number 100 #ipv4-family unicastundo synchronizationpeer 192.168.24.2 enablepeer 192.168.34.3 enable
#
return
[R4-bgp]ne	
[R4-bgp]network 10.10.4.4 32
[R4-bgp]q
[R4]dis	
[R4]display  bg	
[R4]display  bgp  pe	
[R4]display  bgp  peer BGP local router ID : 4.4.4.4Local AS number : 200Total number of peers : 2		  Peers in established state : 2Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv192.168.24.2    4         100        7        8     0 00:05:05 Established    0192.168.34.3    4         100        7        8     0 00:05:05 Established    0
[R4]int	
[R4]interface  lo	
[R4]interface  LoopBack  1
[R4-LoopBack1]ip add 10.10.8.8 32
[R4-LoopBack1]q
[R4]bg	
[R4]bgp  200
[R4-bgp]net	
[R4-bgp]network  10.10.8.8 32
[R4-bgp]
[R4-bgp]q
[R4]dis	
[R4]display  bg	
[R4]display  bgp  pe	
[R4]display  bgp  peer BGP local router ID : 4.4.4.4Local AS number : 200Total number of peers : 2		  Peers in established state : 2Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv192.168.24.2    4         100       10       12     0 00:08:50 Established    0192.168.34.3    4         100       10       12     0 00:08:50 Established    0
[R4]dis	
[R4]display  bg	
[R4]display  bgp  r	
[R4]display  bgp  routing-table BGP Local router ID is 4.4.4.4 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   10.10.4.4/32       0.0.0.0         0                     0      i*>   10.10.8.8/32       0.0.0.0         0                     0      i
[R4]Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on<R4>
<R4>
<R4>
<R4>dis	
<R4>display  bg	
<R4>display  bgp  ro	
<R4>display  bgp  routing-table BGP Local router ID is 4.4.4.4 Status codes: * - valid, > - best, d - damped,h - history,  i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   10.10.4.4/32       0.0.0.0         0                     0      i*>   10.10.8.8/32       0.0.0.0         0                     0      i
<R4>Please check whether system data has been changed, and save data in timeConfiguration console time out, please press any key to log on

[R4]display  bgp  peer 

 BGP local router ID : 4.4.4.4
 Local AS number : 200
 Total number of peers : 2          Peers in established state : 2

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv

  192.168.24.2    4         100       10       12     0 00:08:50 Established     0
  192.168.34.3    4         100       10       12     0 00:08:50 Established    0

[R4]display  bgp  routing-table 
 Total Number of Routes: 2
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.10.4.4/32       0.0.0.0         0                     0      i
 *>   10.10.8.8/32       0.0.0.0         0                     0      i

R2:
 Total Number of Routes: 2
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.10.4.4/32       192.168.24.4    0                     0      200i
 *>   10.10.8.8/32       192.168.24.4    0                     0      200i

R3:
 Total Number of Routes: 2
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.10.4.4/32       192.168.34.4    0                     0      200i
 *>   10.10.8.8/32       192.168.34.4    0                     0      200i

R1:
 Total Number of Routes: 4
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.10.4.4/32       10.10.2.2       0          100        0      200i
 * i                     10.10.3.3       0          100        0      200i
 
*>i  10.10.8.8/32       10.10.2.2       0          100        0      200i
 * i                     10.10.3.3       0          100        0      200i

1)比较“协议首选值-pref-val”属性,数值越大越好,默认值是0,只在本设备生效,不在网络中传递。


<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]ip ip-p    
[R1]ip ip-prefix ?
  STRING<1-169>  Specify prefix-list name
[R1]ip ip-prefix 3.3 pe    
[R1]ip ip-prefix 3.3 permit 10.10.4.4 32
[R1]rou    
[R1]route
[R1]route-policy 3.3 pe    
[R1]route-policy 3.3 permit  no    
[R1]route-policy 3.3 permit  node  10
Info: New Sequence of this List.
[R1-route-policy]if-match  ip-prefix  3.3
[R1-route-policy]apply  preferred-value 234
[R1]bgp  100
[R1-bgp]peer 10.10.3.3 route-policy 3.3 import 
[R1-bgp]
<R1>refresh bgp all import 
<R1>display  bgp  routing-table 

 BGP Local router ID is 192.168.12.1 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 3
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.10.4.4/32       10.10.3.3       0          100        234    200i
 * i                     10.10.2.2       0          100        0      200i
 *>i  10.10.8.8/32       10.10.2.2       0          100        0      200i
<R1>display  bgp  routing-table  10.10.4.4

 BGP local router ID : 192.168.12.1
 Local AS number : 100
 Paths:   2 available, 1 best, 1 select
 BGP routing table entry information of 10.10.4.4/32:
 From: 10.10.3.3 (3.3.3.3)
 Route Duration: 00h00m48s  
 Relay IP Nexthop: 192.168.13.3
 Relay IP Out-Interface: GigabitEthernet0/0/1
 Original nexthop: 10.10.3.3
 Qos information : 0x0
 AS-path 200, origin igp, MED 0, localpref 100, pref-val 234, valid, internal, b
est, select, active, pre 255, IGP cost 1
 Not advertised to any peer yet

 BGP routing table entry information of 10.10.4.4/32:
 From: 10.10.2.2 (2.2.2.2)
 Route Duration: 00h00m48s  
 Relay IP Nexthop: 192.168.12.2
 Relay IP Out-Interface: GigabitEthernet0/0/0
 Original nexthop: 10.10.2.2
 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 PreVal
 Not advertised to any peer yet

2)比较“本地优先级-local_pref”属性,数值越大越好,默认值是100。


[R1]route-policy 3.3 permit  node  10
Info: You are overwriting this sequence.
[R1-route-policy]undo  apply  preferred-value
[R1]route-policy 3.3 permit  node  20
Info: New Sequence of this List.
[R1-route-policy]ap    

[R1-route-policy]apply  lo    
[R1-route-policy]apply  local-preference  300
[R1-route-policy]q
[R1]bg    
[R1]bgp  100
[R1-bgp]peer  10.10.3.3 route-policy 3.3 import 
<R1>display  bgp  routing-table 

 BGP Local router ID is 192.168.12.1 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 4
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.10.4.4/32       10.10.2.2       0          100        0      200i
 * i                     10.10.3.3       0          100        0      200i
 *>i  10.10.8.8/32       10.10.3.3       0          300        0      200i
 * i                     10.10.2.2       0          100        0      200i

3)比较:是本地始发的路由,还是从对等体学来的路由, 本地始发的BGP路由优于从其他对等体学习到的路由,**本地始发的路由优先级:优选手动聚合>自动聚合>network>import>从对等体学到的。

4)比较“as-path” 属性-as号越短越好。


[R1-bgp]display this
[V200R003C00]
#
bgp 100
 peer 10.10.2.2 as-number 100 
 peer 10.10.2.2 connect-interface LoopBack0
 peer 10.10.3.3 as-number 100 
 peer 10.10.3.3 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 10.10.2.2 enable
  peer 10.10.3.3 enable
#
return
[R1-bgp]display  bgp  routing-table 

 BGP Local router ID is 192.168.12.1 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 4
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.10.4.4/32       10.10.2.2       0          100        0      200i
 * i                     10.10.3.3       0          100        0      200i
 *>i  10.10.8.8/32       10.10.2.2       0          100        0      200i
 * i                     10.10.3.3       0          100        0      200i  
[R1]route-policy 3.3 permit node  10
Info: You are overwriting this sequence.
[R1-route-policy]undo  apply  local-preference  
[R1-route-policy]apply as-path 300 300 additive 
[R1-bgp]peer 10.10.2.2 route-policy 3.3 import 

<R1>display  bgp  routing-table 

 BGP Local router ID is 192.168.12.1 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 4
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.10.4.4/32       10.10.3.3       0          100        0      200i
 * i                     10.10.2.2       0          100        0      300 300 20
0i

 *>i  10.10.8.8/32       10.10.2.2       0          300        0      200i
 * i                     10.10.3.3       0          100        0      200i
<R1>

5)比较“起源属性”-指的是已什么方式注入进BGP协议的。

 Origin : i - IGP, e - EGP, ? - incomplete

[R2-route-policy]apply  origin  ?
  egp         Remote EGP
  igp         Local IGP
  incomplete  Unknown heritage
[R2-route-policy]apply  origin  

Origin : i - IGP, e - EGP, ? - incomplete (优先级)

&:IGP:优先级高,通过network命令注入到BGP路由表的路由,其Origin属性为'i'。

&: e - EGP : 次优的,

&:Incomplete:优先级低,如:通过import-route注入的路由,其Origin属性为 '?'。


<R2>sys
Enter system view, return user view with Ctrl+Z.
[R2]ip ip-prefix  4.4 permit  10.10.4.4 32  
[R2]route-policy 4.4 permit  node  10
Info: New Sequence of this List.
  
[R2-route-policy]if-match  ip-prefix  4.4
[R2-route-policy]apply  origin  incomplete 
[R2-bgp]peer  10.10.1.1 route-policy 4.4 export 
[R2-bgp]display  bgp  routing-table 

 BGP Local router ID is 2.2.2.2 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 2
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.10.4.4/32       192.168.24.4    0                     0      200i
 *>   10.10.8.8/32       192.168.24.4    0                     0      200i

 [R1]bgp  100
[R1-bgp]undo peer 10.10.2.2 route-policy 3.3 import 

[R1-bgp]q
[R1]undo route-policy 3.3 
[R1]display  bgp  routing-table 

 BGP Local router ID is 192.168.12.1 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 4
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.10.4.4/32       10.10.2.2       0          100        0      200i
 * i                     10.10.3.3       0          100        0      200i
 *>i  10.10.8.8/32       10.10.2.2       0          100        0      200i
 * i                     10.10.3.3       0          100        0      200i
[R1]ip ip-p    
[R1]ip ip-prefix  4.4 pe    
[R1]ip ip-prefix  4.4 permit  10.10.4.4 32
[R1]un    
[R1]undo  ip ip-prefix  4.4 permit  10.10.4.4 32
<R1>display  bgp  routing-table 

 BGP Local router ID is 192.168.12.1 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 3
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn 

*>i  10.10.4.4/32       10.10.3.3       0          100        0      200i
 * i                     10.10.2.2       0          100        0      200?
 *>i  10.10.8.8/32       10.10.3.3       0          100        0      200i

<R1>display bgp routing-table 10.10.4.4BGP local router ID : 192.168.12.1Local AS number : 100Paths:   2 available, 1 best, 1 selectBGP routing table entry information of 10.10.4.4/32:From: 10.10.3.3 (3.3.3.3)Route Duration: 00h13m25s  Relay IP Nexthop: 192.168.13.3Relay IP Out-Interface: GigabitEthernet0/0/1Original nexthop: 10.10.3.3Qos information : 0x0AS-path 200, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, bes
t, select, active, pre 255, IGP cost 1Not advertised to any peer yetBGP routing table entry information of 10.10.4.4/32:From: 10.10.2.2 (2.2.2.2)Route Duration: 00h01m02s  Relay IP Nexthop: 192.168.12.2Relay IP Out-Interface: GigabitEthernet0/0/0Original nexthop: 10.10.2.2Qos information : 0x0AS-path 200, origin incomplete, MED 0, localpref 100, pref-val 0, valid, intern
al, pre 255, IGP cost 1, not preferred for OriginNot advertised to any peer yet<R1>

6)比较“MED”属性,指的是一个路由器去往一个BGP路由网段的距离,类似cost。

第一步:在R2中删除调用
[R2-bgp]undo peer 10.10.1.1 route-policy 4.4 export第二步:验证R1的路由表:检查是否恢复默认
[R1]dis bgp routing-table Total Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>i  10.10.4.4/32       10.10.2.2       0          100        0      200i* i                     10.10.3.3       0          100        0      200i第三步:在R2中-进入路由策略,删除修改的起源属性值
[R2]route-policy  4.4 permit  node 10
[R2-route-policy]undo apply origin    //删除修改的起源属性值,恢复默认[R2-route-policy]apply cost 999    //修改路由的MED属性值为999第四步:在R2中调用路由策略
[R2]bgp 100  
[R2-bgp]peer 10.10.1.1 route-policy  4.4 export    //R2在给R1发路由的时候,在出方向修改路由的MED值为999第五步:验证结果
<R1>display bgp routing-table Total Number of Routes: 2Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>i  10.10.4.4/32       10.10.3.3       0          100        0      200i* i                     10.10.2.2       999        100        0      200i

7)比较EBGP邻居优先于IBGP邻居,-EBGP路由优先级高于IBGP路由。

8)比较“去往BGP路由的下一跳IP地址”的cost开销值-越小越好。

—如果前面8条选路规则无法选出最优的路由,我们就可以做负载均衡了

备注:AS号一致,  在要负载均衡的那台设备上开启负载均衡功能

9)比较“cluster-list”的长度,越短越好。反射器

10)比较Router ID(Orginator_ID)的大小,越小越好。

R2


<R2>dis    
<R2>display  bg    
<R2>display  bgp  r    
<R2>display  bgp  routing-table 

 BGP Local router ID is 2.2.2.2 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 2
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.10.4.4/32       192.168.24.4    0                     0      200i
 *>   10.10.8.8/32       192.168.24.4    0                     0      200i

[R2-bgp]router-id 8.8.8.8

[R2-bgp]display  bgp  routing-table 

 BGP Local router ID is 8.8.8.8 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 2
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   10.10.4.4/32       192.168.24.4    0                     0      200i
 *>   10.10.8.8/32       192.168.24.4    0                     0      200i

R1


[R1]display bgp routing-table

 BGP Local router ID is 192.168.12.1 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 4
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.10.4.4/32       10.10.2.2       0          100        0      200i
 * i                     10.10.3.3       0          100        0      200i
 *>i  10.10.8.8/32       10.10.2.2       0          100        0      200i
 * i                     10.10.3.3       0          100        0      200i


[R1]display bgp routing-table


 Total Number of Routes: 4
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.10.4.4/32       10.10.3.3       0          100        0      200i
 * i                     10.10.2.2       0          100        0      200i
 *>i  10.10.8.8/32       10.10.3.3       0          100        0      200i
 * i                     10.10.2.2       0          100        0      200i
[R1]display  bgp  routing-table  10.10.4.4

 BGP local router ID : 192.168.12.1  //bgp的ip地址 192.168.12.1
 Local AS number : 100  //领据号 100

 Paths:   2 available, 1 best, 1 select   
 BGP routing table entry information of 10.10.4.4/32:
 From: 10.10.3.3 (3.3.3.3)
 Route Duration: 00h14m46s  
 Relay IP Nexthop: 192.168.13.3
 Relay IP Out-Interface: GigabitEthernet0/0/1
 Original nexthop: 10.10.3.3
 Qos information : 0x0
 AS-path 200, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, bes
t, select, active, pre 255, IGP cost 1
 Not advertised to any peer yet

 BGP routing table entry information of 10.10.4.4/32:
 From: 10.10.2.2 (8.8.8.8)
 Route Duration: 00h00m52s  
 Relay IP Nexthop: 192.168.12.2
 Relay IP Out-Interface: GigabitEthernet0/0/0
 Original nexthop: 10.10.2.2
 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 router ID
 Not advertised to any peer yet

11)比较“peer 后面的IP地址的大小”,越小越好

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/649469.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Ceph分布式存储自动化运维平台开发实践

文章目录 1. 背景介绍1.1 什么是Ceph&#xff1f;1.1.1 Ceph的核心组件1.1.2 Ceph的优势 1.2 自动化运维的需求目标 2. 平台架构设计和组件版本2.1 平台架构设计2.2 组件版本2.3 模块划分&#xff08;已经脱敏处理&#xff09;2.3.1 当前版本V1.0支持功能2.3.2 前后端代码结构t…

JS-单例设计模式

设计模式&#xff1a;针对特定问题提出的简洁优化的解决方案 构造函数或类仅仅只能实例化一次&#xff0c;得到一个实例对象比如&#xff1a;工具类 在项目中使用工具类实例对象时&#xff0c;每一个实例对象的属性方法与功能作用都是一样的那么在项目中如果每次使用都需要重新…

如何保障主机安全

做好主机安全是非常重要&#xff0c;因为主机安全涉及保护主机的数据存储和处理的保密性、完整性和可用性。主机安全的具体措施包括硬件、固件、系统软件的自身安全以及一系列附加的安全技术和安全管理措施&#xff0c;从而建立一个完整的主机安全保护环境。 主机一旦被黑客入…

利用 “diart“ 和 OpenAI 的 Whisper 简化实时转录

利用 "diart" 和 OpenAI 的 Whisper 简化实时转录 工作原理 Diart 是一个基于人工智能的 Python 库&#xff0c;用于实时记录说话者语言&#xff08;即 "谁在什么时候说话"&#xff09;&#xff0c;它建立在 pyannote.audio 模型之上&#xff0c;专为实时…

Linux CentOS 7 安装mysql的步骤

#wget命令用来从指定的URL下载文件 wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum install mysql-community-server 重启mysql服务 service mysqld restart || systemctl restart mysqld…

RabbitMQ之Window中安装配置与使用

RabbitMQ之Window中安装配置与使用 文章目录 RabbitMQ之Window中安装配置与使用1 安装准备1.1 安装Erlang1.2 ErLnag环境变量配置 2. 安装RabbitMQ2.1 安装2.2 环境变量设置 官网&#xff1a;https://www.rabbitmq.com 下载地址&#xff1a;https://www.rabbitmq.com/download.…

MATLAB中conv和filter函数的区别

文章目录 1.函数简介w conv(u,v)yfilter(b,a,x)讨论情况 2.先说结论3.代码验证 1.函数简介 w conv(u,v) w conv(u,v) 返回向量 u 和 v 的卷积结果&#xff0c;卷积运算是对信号的移位加权求和。 yfilter(b,a,x) 使用由分子和分母系数 b 和 a 定义的有理传递函数对输入数…

Git推送大量内容导致http 413错误

Git推送大量内容导致服务端HTTP 413错误 问题描述 使用git push 大量变更内容&#xff08;超过60M&#xff09;时报 http 413错误&#xff0c;详细错误信息&#xff1a; Compressing objects: 100% (2907/2907), done. Writing objects: 100% (6760/6760), 64.18 MiB | 1.18…

【日常学习笔记】gtest

https://zhuanlan.zhihu.com/p/369466622 int Factorial(int n) {int result 1;for (int i 1; i < n; i) {result * i;}return result; }TEST(TestSuiteName, TestName) 第一个参数可以表示为一个对某一个函数进行测试&#xff0c;第二个参数表示对这个函数测试时的分的几…

微信小程序 仿微信聊天界面

1. 需求效果图 2. 方案 为实现这样的效果&#xff0c;首先要解决两个问题&#xff1a; 2.1.点击输入框弹出软键盘后&#xff0c;将已有的少许聊天内容弹出&#xff0c;导致看不到的问题 点击输入框弹出软键盘后&#xff0c;将已有的少许聊天内容弹出&#xff0c;导致看不到的问…

银行数据仓库体系实践(8)--主数据模型设计

主数据区域中保留了数据仓库的所有基础数据及历史数据&#xff0c;是数据仓库中最重要的数据区域之一&#xff0c;那主数据区域中主要分为近源模型区和整合&#xff08;主题&#xff09;模型区。上一节讲到了模型的设计流程如下图所示。那近源模型层的设计在第2.3和3这两个步骤…

前端工程化之:webpack1-5(配置文件)

一、配置文件 webpack 提供的 cli 支持很多的参数&#xff0c;例如 --mode &#xff0c;但更多的时候&#xff0c;我们会使用更加灵活的配置文件来控制 webpack 的行为。 默认情况下&#xff0c; webpack 会读取 webpack.config.js 文件作为配置文件&#xff0c;但也可以通过 C…

《动手学深度学习(PyTorch版)》笔记4.2 4.3

注&#xff1a;书中对代码的讲解并不详细&#xff0c;本文对很多细节做了详细注释。另外&#xff0c;书上的源代码是在Jupyter Notebook上运行的&#xff0c;较为分散&#xff0c;本文将代码集中起来&#xff0c;并加以完善&#xff0c;全部用vscode在python 3.9.18下测试通过。…

85 总结一下最近遇到的一些 jar发布 相关的知识

前言 呵呵 最近有一些构建服务, 发布服务的一些需求 我们这里的服务 一般来说是 java application, spring boot application 针对发布, 当然最好是 增量发布, 尽量的减少需要传递给 发布服务器 的资源的大小 比如 我的这个 java application, 可能会存在很多依赖, 常规…

探讨Go语言在构建HTTP代理时的优势和挑战

亲爱的读者&#xff0c;让我们一起来探讨一下Go语言在构建HTTP代理时的优势和挑战。 首先&#xff0c;让我们来谈谈Go语言在构建HTTP代理时的优势。Go语言是一种高性能的编程语言&#xff0c;它具有简洁、高效的特点&#xff0c;非常适合构建高效的代理服务器。使用Go语言&…

springboot第52集:微服务分布式架构,统一验证,oauth,订单,地区管理周刊

在计算机领域中&#xff0c;FGC 通常代表 Full Garbage Collection&#xff0c;即全垃圾收集。垃圾收集是一种自动管理内存的机制&#xff0c;它负责回收不再被程序使用的内存&#xff0c;以便释放资源和提高程序性能。 当系统执行 Full Garbage Collection 时&#xff0c;它会…

【代码随想录-数组】二分查找

💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学习,不断总结,共同进步,活到老学到老导航 檀越剑指大厂系列:全面总结 jav…

Android源码设计模式解析与实战第2版笔记(三)

第三章 自由扩展你的项目–Builder 模式 Builder 模式的定义 将一个复杂对象的构建与它的表示分离&#xff0c;使得同样的构建过程可以创建不同的表示。 Builder 模式的使用场景 相同的方法&#xff0c;不同的执行顺序&#xff0c;产生不同的事件结果时 多个部件或零件&…

【驱动系列】C#获取电脑硬件显卡核心代号信息

欢迎来到《小5讲堂》&#xff0c;大家好&#xff0c;我是全栈小5。 这是《驱动系列》文章&#xff0c;每篇文章将以博主理解的角度展开讲解&#xff0c; 特别是针对知识点的概念进行叙说&#xff0c;大部分文章将会对这些概念进行实际例子验证&#xff0c;以此达到加深对知识点…

msvcp140.dll丢失,有什么好的解决方法?

msvcp140.dll 是 Microsoft Visual C Redistributable Package 的一部分&#xff0c;这是一个由微软开发并发布的运行时库文件。具体而言&#xff1a; 功能与用途&#xff1a; msvcp140.dll 是动态链接库&#xff08;DLL&#xff09;文件&#xff0c;包含了 C 标准库的实现和…