码迷,mamicode.com
首页 > 编程语言 > 详细

BGP ECMP环境中community属性是如何传递的

时间:2020-01-05 09:39:51      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:dex   tis   with   admin   ssi   enc   com   deb   发布   

需求:
R1发布环回口地址1.1.1.1给R2携带团体属性1111:1111,R3发布环回口地址1.1.1.1给R2携带团体属性1111:1111,R4发布1.1.1.1给R2不携带团体属性,测试在R2发送给R5的BGP路由表象中1.1.1.1是否携带团体属性值1111:1111?

AS规划:
R1 AS 100
R2 AS 200
R3 AS 300
R4 AS 400
R5 AS 500

拓扑环境:
技术图片
R1配置:

<R1>dis ip int b 
*down: administratively down
(s): spoofing  (l): loopback
Interface                Physical Protocol IP Address      Description 
GE0/0                    up       up       12.1.1.1        --
GE0/1                    down     down     --              --
GE0/2                    down     down     --              --
GE5/0                    down     down     --              --
GE5/1                    down     down     --              --
GE6/0                    down     down     --              --
GE6/1                    down     down     --              --
Loop0                    up       up(s)    1.1.1.1         --
Ser1/0                   down     down     --              --
Ser2/0                   down     down     --              --
Ser3/0                   down     down     --              --
Ser4/0                   down     down     --              --
<R1>dis cu conf bgp
#
bgp 100
 peer 12.1.1.2 as-number 200
 #
 address-family ipv4 unicast
  network 1.1.1.1 255.255.255.255 route-policy com
  peer 12.1.1.2 enable
  peer 12.1.1.2 advertise-community
#
<R1>dis cu conf route-policy
#
route-policy com permit node 10
 apply community 1111:1111 
#
return

R2配置:

<R2>dis ip int b 
*down: administratively down
(s): spoofing  (l): loopback
Interface                Physical Protocol IP Address      Description 
GE0/0                    up       up       12.1.1.2        --
GE0/1                    up       up       23.1.1.2        --
GE0/2                    up       up       24.1.1.2        --
GE5/0                    up       up       25.1.1.2        --
GE5/1                    down     down     --              --
GE6/0                    down     down     --              --
GE6/1                    down     down     --              --
Ser1/0                   down     down     --              --
Ser2/0                   down     down     --              --
Ser3/0                   down     down     --              --
Ser4/0                   down     down     --              --
<R2>  
<R2>dis cu conf bgp
#
bgp 200
 peer 12.1.1.1 as-number 100
 peer 23.1.1.3 as-number 300
 peer 24.1.1.4 as-number 400
 peer 25.1.1.5 as-number 500
 #
 address-family ipv4 unicast
  balance 32                            //负载均衡配置
  balance as-path-relax                 //忽略比较AS内容
  peer 12.1.1.1 enable
  peer 23.1.1.3 enable
  peer 24.1.1.4 enable
  peer 25.1.1.5 enable
  peer 25.1.1.5 advertise-community
#

R3配置:

<R3>dis ip int b 
*down: administratively down
(s): spoofing  (l): loopback
Interface                Physical Protocol IP Address      Description 
GE0/0                    down     down     --              --
GE0/1                    up       up       23.1.1.3        --
GE0/2                    down     down     --              --
GE5/0                    down     down     --              --
GE5/1                    down     down     --              --
GE6/0                    down     down     --              --
GE6/1                    down     down     --              --
Loop0                    up       up(s)    1.1.1.1         --
Ser1/0                   down     down     --              --
Ser2/0                   down     down     --              --
Ser3/0                   down     down     --              --
Ser4/0                   down     down     --              --
<R3>  
<R3>dis cu conf bgp
#
bgp 300
 peer 23.1.1.2 as-number 200
 #
 address-family ipv4 unicast
  network 1.1.1.1 255.255.255.255 route-policy com
  peer 23.1.1.2 enable
  peer 23.1.1.2 advertise-community
#
return
<R3>
<R3>dis cu conf route-po
<R3>dis cu conf route-policy 
#
route-policy com permit node 10
 apply community 1111:1111 
#

R4配置:

<R4>dis ip int b 
*down: administratively down
(s): spoofing  (l): loopback
Interface                Physical Protocol IP Address      Description 
GE0/0                    down     down     --              --
GE0/1                    down     down     --              --
GE0/2                    up       up       24.1.1.4        --
GE5/0                    down     down     --              --
GE5/1                    down     down     --              --
GE6/0                    down     down     --              --
GE6/1                    down     down     --              --
Loop0                    up       up(s)    1.1.1.1         --
Ser1/0                   down     down     --              --
Ser2/0                   down     down     --              --
Ser3/0                   down     down     --              --
Ser4/0                   down     down     --              --
<R4>
<R4>dis cu conf bgp
#
bgp 400
 peer 24.1.1.2 as-number 200
 #
 address-family ipv4 unicast
  network 1.1.1.1 255.255.255.255
  peer 24.1.1.2 enable
#
return

R5配置:

<R5>dis ip int b 
*down: administratively down
(s): spoofing  (l): loopback
Interface                Physical Protocol IP Address      Description 
GE0/0                    down     down     --              --
GE0/1                    down     down     --              --
GE0/2                    down     down     --              --
GE5/0                    up       up       25.1.1.5        --
GE5/1                    down     down     --              --
GE6/0                    down     down     --              --
GE6/1                    down     down     --              --
Ser1/0                   down     down     --              --
Ser2/0                   down     down     --              --
Ser3/0                   down     down     --              --
Ser4/0                   down     down     --              --
<R5>dis cu conf bgp
#
bgp 500
 peer 25.1.1.2 as-number 200
 #
 address-family ipv4 unicast
  peer 25.1.1.2 enable
#
return

测试:
在R2上查看BGP ECMP负载情况:

<R2>dis bgp peer ipv4

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

  * - Dynamically created peer
  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

  12.1.1.1               100       22       20    0       1 00:13:08 Established
  23.1.1.3               300       23       21    0       1 00:13:08 Established
  24.1.1.4               400       20       19    0       1 00:13:08 Established
  25.1.1.5               500        3        4    0       0 00:00:25 Established
<R2>dis bgp routing-table ipv4              //通过在R2上查看路由,确认是负载均衡状态

 Total number of routes: 3

 BGP local router ID is 25.1.1.2 
 Status codes: * - valid, > - best, d - dampened, h - history
               s - suppressed, S - stale, i - internal, e - external
               a - additional-path
       Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

* >e 1.1.1.1/32         12.1.1.1        0                     0       100i
* >e                    23.1.1.3        0                     0       300i
* >e                    24.1.1.4        0                     0       400i
<R2>

<R2>dis ip routing-table 

Destinations : 25       Routes : 27

Destination/Mask   Proto   Pre Cost        NextHop         Interface
0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0
1.1.1.1/32         BGP     255 0           12.1.1.1        GE0/0
                                                 23.1.1.3        GE0/1
                                             24.1.1.4        GE0/2
12.1.1.0/24        Direct  0   0           12.1.1.2        GE0/0

R5上查看收到的1.1.1.1的路由条目属性值,发现携带了1111:1111的团体属性值

<R5>dis bgp routing-table ipv4 1.1.1.1

 BGP local router ID: 25.1.1.5
 Local AS number: 500

 Paths:   1 available, 1 best

 BGP routing table information of 1.1.1.1/32:
 From            : 25.1.1.2 (25.1.1.2)
 Rely nexthop    : 25.1.1.2
 Original nexthop: 25.1.1.2
 OutLabel        : NULL
 Community       : <1111:1111>
 RxPathID        : 0x0  
 TxPathID        : 0x0  
 AS-path         : 200 100
 Origin          : igp
 Attribute value : pref-val 0
 State           : valid, external, best 
 IP precedence   : N/A
 QoS local ID    : N/A
 Traffic index   : N/A

开启R5侧debug,确认R5侧收到BGP update更新报文是否携带团体属性值-------答案是携带团体属性1111:1111

<R5>t m
The current terminal is enabled to display logs.
<R5>t d
The current terminal is enabled to display debugging logs.
<R5>deb
<R5>debugging bgp u
<R5>debugging bgp update
<R5>reset bgp all
Reset BGP sessions? [Y/N]:y
<R5>%Jan  4 01:51:15:752 2020 R5 BGP/5/BGP_STATE_CHANGED: 
 BGP default.: 25.1.1.2 state has changed from ESTABLISHED to IDLE for administrative reset.
<R5>%Jan  4 01:51:18:002 2020 R5 BGP/5/BGP_STATE_CHANGED: 
 BGP default.: 25.1.1.2 State is changed from OPENCONFIRM to ESTABLISHED.
<R5>
<R5>*Jan  4 01:51:18:228 2020 R5 BGP/7/DEBUG: 
        BGP.: Recv UPDATE from peer 25.1.1.2 with following destinations:
        Update message length : 59
        Origin       : IGP 
        AS path      : 200 100 
        Next hop     : 25.1.1.2 
        Community    : <1111:1111>
        1.1.1.1/32 PathID 0 ,

结论:在EBGP ECMP负载均衡环境中,当不同的EBGP 宣告者分别发布既带有团体属性的community属性值和不带团体属性的community属性的业务网段时,最终EBGP 用户侧设备会收到一条带有团体community属性的路由,而不带community属性值得路由条目会被忽略掉

BGP ECMP环境中community属性是如何传递的

标签:dex   tis   with   admin   ssi   enc   com   deb   发布   

原文地址:https://blog.51cto.com/14648383/2464307

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!