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

news2024/10/2 14:22:15

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 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]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 - 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]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         Interface

      10.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 - 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                     192.168.24.4    0          100        0      200i
 *>i  10.10.8.8/32       10.10.3.3       0          100        0      200i
   i                     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 - 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                     192.168.24.4    0          100        0      200i
 *>i  10.10.8.8/32       10.10.3.3       0          100        0      200i
   i                     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 - 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]

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>

  Please check whether system data has been changed, and save data in time

  Configuration 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 100
 router-id 2.2.2.2
 peer 10.10.1.1 as-number 100 
 peer 10.10.1.1 connect-interface LoopBack0
 peer 192.168.24.4 as-number 200 
 #
 ipv4-family unicast
  undo synchronization
  peer 10.10.1.1 enable
  peer 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 - 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]display bgp routing-table 10.10.4.4

 BGP local router ID : 2.2.2.2
 Local AS number : 100
 Paths:   1 available, 1 best, 1 select
 BGP 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/1
 Original nexthop: 192.168.24.4
 Qos information : 0x0
 AS-path 200, origin igp, MED 0, pref-val 0, valid, external, best, select, acti
ve, pre 255
 Advertised 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         Interface

      10.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 - 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]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 - 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]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]

  Please check whether system data has been changed, and save data in time

  Configuration 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  paths

 Total Number of Routes: 0
 Total Number of Paths: 0
<R3>display bgp pe	
<R3>display bgp peer 

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

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

  10.10.1.1       4         100        3        3     0 00:01:27 Established    
   0
  192.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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 1
      Network            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 - 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.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 time

  Configuration 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 time

  Configuration 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.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        4        4     0 00:02:06 Established    
   0
  192.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 200
 router-id 4.4.4.4
 peer 192.168.24.2 as-number 100 
 peer 192.168.34.3 as-number 100 
 #
 ipv4-family unicast
  undo synchronization
  peer 192.168.24.2 enable
  peer 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.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        7        8     0 00:05:05 Established    
   0
  192.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.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]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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 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
[R4]

  Please check whether system data has been changed, and save data in time

  Configuration 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 - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 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
<R4>

  Please check whether system data has been changed, and save data in time

  Configuration 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.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: 00h13m25s  
 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 (2.2.2.2)
 Route Duration: 00h01m02s  
 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 incomplete, MED 0, localpref 100, pref-val 0, valid, intern
al, pre 255, IGP cost 1, not preferred for Origin
 Not 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: 2
      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
 
 
第三步:在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: 2
      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       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.coloradmin.cn/o/1412860.html

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

相关文章

初识数据库

数据库技术的基础术语 在学习数据库技术之前&#xff0c;我们先认识与该技术密切相关的基本术语&#xff0c;分别是数据库 (Database, DB)、数据库管理系统(Database Management System, DBMS)和数据库 系统(Database System, DBS)&#xff0c;具体介绍如下。 1. 数据库 数…

win10安装redis并配置加自启动(采用官方推荐unix子系统)

记录&#xff0c;为啥有msi安装包&#xff0c;还这么麻烦的用linux版本redis的安装方式&#xff0c;是因为从github上下载别人制作的msi报毒&#xff0c;还不止一处&#xff0c;这种链接数据库的东西&#xff0c;用别人加工过的&#xff0c;都报毒了还用就是傻逼了。 所以采用…

13.while条件循环语句 (4)

while条件循环语句是一种让脚本根据某些条件来重复执行命令的语句&#xff0c;它的循环结构往往在执行前并不确定最终执行的次数&#xff0c;完全不同于for循环语句中有目标、有范围的使用场景。 while循环语句通过判断条件测试的真假来决定是否继续执行命令&#xff0c;若条件…

IP 地址如何进行动态分配?

由于 IP 地址资源的有限性&#xff0c;大部分用户上网都是使用动态 IP 地址&#xff0c;而不是静态 IP 地址。动态 IP 地址指的是在需要的时候才进行 IP 地址分配的方式&#xff0c;而静态 IP 地址是固定分配一个 IP 地址&#xff0c;每次都用这一个地址。因此&#xff0c;IP 地…

AI PC的引擎 – 英特尔第 14 代处理器Meteor Lake架构分析

英特尔从2023年12月开始在笔记本电脑中发售首款 Meteor Lake 第 14 代 Core Ultra 芯片&#xff0c;开启新的“AI PC”时代。这款芯片采用了全新的架构&#xff0c;将CPU分为四块“瓷砖”&#xff08;tiles&#xff09;&#xff1a;CPU Tile&#xff0c;SoC Tile&#xff0c;Gr…

Python学习从0到1 day9 Python函数

苦难是花开的伏笔 ——24.1.25 函数 1.定义 函数&#xff1a;是组织好的&#xff0c;可重复使用的&#xff0c;用来实现特定功能的代码段 2.案例 在pycharm中完成一个案例需求&#xff1a;不使用内置函数len&#xff08;&#xff09;&#xff0c;完成字符串长度的计算 #统计字…

海外云手机三大优势

在全球化潮流下&#xff0c;企业因业务需求对海外手机卡等设备的需求不断攀升&#xff0c;推动了海外云手机业务的蓬勃发展。相较于自行置备手机设备&#xff0c;海外云手机不仅能够降低成本&#xff0c;还具备诸多优势&#xff0c;让我们深入探讨其中的三大黄金优势。 经济实惠…

Vulnhub靶机:FunBox 9

一、介绍 运行环境&#xff1a;Virtualbox 攻击机&#xff1a;kali&#xff08;10.0.2.15&#xff09; 靶机&#xff1a;FunBox 9&#xff08;10.0.2.37&#xff09; 目标&#xff1a;获取靶机root权限和flag 靶机下载地址&#xff1a;https://www.vulnhub.com/entry/funb…

NGINX如何实现rtmp推流服务

最近直播大火&#xff0c;直播推流软件遍地开花&#xff0c;那么用NGINX如何进行推流呢&#xff1f;下面我们就简单的介绍一下用NGINX的rtmp模块如何实现视频推流&#xff0c;我们主要从一下几点介绍&#xff1a; 推流拉流推流认证拉流认证 package mainimport ("fmt&qu…

Elasticsearch基础篇(八):常用查询以及使用Java Api Client进行检索

ES常用查询以及使用Java Api Client进行检索 1. 检索需求 参照豆瓣阅读的列表页面 需求&#xff1a; 检索词需要在数据库中的题名、作者和摘要字段进行检索并进行高亮标红返回的检索结果需要根据综合、热度最高、最近更新、销量最高、好评最多进行排序分页数量为10&#xf…

vscode 代码格式化很短就换行,以及缩放设置

安装vetur 打开vscode设置settings.json { "editor.tabSize": 2,//缩进单位"vetur.format.defaultFormatter.html": "js-beautify-html","vetur.format.defaultFormatterOptions": {"js-beautify-html": {"wrap_line…

项目测试 手机系统 改串号 写IMEI 改MEID 改手机型号 等信息配置信息 演示视频 和一键新机

项目测试 手机系统 改串号 写IMEI 改MEID 改手机型号 等信息配置信息 演示视频 和配置说明 项目-手机系统支持直接改串号 IMEI MEID 手机型号 等信息配置信息 演示视频 支持 条形码 SN IMEI 1 IMEI 2 MEID 唯一SN 蓝牙地址 wifi地址 mac "一键新机"这个术语通常出现…

视频有点大能做二维码吗?视频转成二维码图片的方法

怎么把一个比较大的视频转二维码图片呢&#xff1f;现在很多人会以二维码为载体来存储视频文件&#xff0c;其他人只需要扫码生成二维码就可以观看视频。有的视频因为时间比较长&#xff0c;尺寸比较大&#xff0c;文件会比较大&#xff0c;那么几十几百m大小的视频如何快速制作…

不学前沿技术与朽木浮草何异 Java 10新特性

不学前沿技术与朽木浮草何异? Java 10新特性 ​ 发布于 2018 年 3 月 20 日&#xff0c;最知名的特性应该是 var 关键字&#xff08;局部变量类型推断&#xff09;的引入了&#xff0c;其他还有垃圾收集器改善、GC 改进、性能提升、线程管控等一批新特性。 概览&#xff08;…

Shell脚本------函数与数组

目录 一、函数 1、函数是什么&#xff1f; 2、函数的格式 3、函数的调用方法 ①脚本&#xff1a;查看当前操作系统 ②脚本二&#xff1a;函数备份yum线上源&#xff0c;创建yum本地源和清理缓存安装httpd 4、函数的返回值 5、函数传参 6、函数变量的作用范围 1、实例…

2024年【安全员-B证】考试技巧及安全员-B证操作证考试

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 安全员-B证考试技巧参考答案及安全员-B证考试试题解析是安全生产模拟考试一点通题库老师及安全员-B证操作证已考过的学员汇总&#xff0c;相对有效帮助安全员-B证操作证考试学员顺利通过考试。 1、【多选题】《建筑施…

Rocky8 顺利安装 Airflow 并解决数据库报错问题

rocky是替代centos的服务器系统&#xff0c;稳定可靠。rocky8会比centos7新&#xff0c;可以支持更多服务软件的安装&#xff0c;免去升级各种库的麻烦&#xff0c;本文运行airflow服务就用rocky8系统。airflow是一个定时任务管理系统&#xff0c;功能强大&#xff0c;目前是ap…

机器学习算法(二)

一、朴素贝叶斯 朴素贝叶斯&#xff08;Naive Bayes&#xff09;是基于贝叶斯定理。它测量每个类的概率&#xff0c;每个类的条件概率给出 x 的值。这个算法用于分类问题&#xff0c;得到一个二进制“是 / 非”的结果。看看下面的方程式。 先验概率&#xff1a;即基于统计的概…

python基础学习-03 安装

python3 可应用于多平台包括 Windows、Linux 和 Mac OS X。 Unix (Solaris, Linux, FreeBSD, AIX, HP/UX, SunOS, IRIX, 等等。)Win 9x/NT/2000Macintosh (Intel, PPC, 68K)OS/2DOS (多个DOS版本)PalmOSNokia 移动手机Windows CEAcorn/RISC OSBeOSAmigaVMS/OpenVMSQNXVxWorksP…

万物简单AIoT 端云一体实战案例学习 之 空气质量检测系统

学物联网,来万物简单IoT物联网!! 下图是本案的3步导学,每个步骤中实现的功能请参考图中的说明。 1、简介 环境污染、空气污染是人类一直所关心并且讨论的永恒话题,人们对优质的环境和健康的身体非常向往。因此,如果有一种可以检测周围环境的空气质量的设备并且环境数据…