侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

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

2023-03-21 星期二 / 0 评论 / 0 点赞 / 83 阅读 / 11640 字

需求:R1发布环回口地址1.1.1.1给R2携带团体属性1111:1111,R3发布环回口地址1.1.1.1给R2携带团体属性1111:1111,R4发布1.1.1.1给R2不携带团体属性,测试在R2

.

需求:
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): loopbackInterface                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): loopbackInterface                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): loopbackInterface                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): loopbackInterface                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): loopbackInterface                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 : 27Destination/Mask   Proto   Pre Cost        NextHop         Interface0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop01.1.1.1/32         BGP     255 0           12.1.1.1        GE0/0                                                 23.1.1.3        GE0/1                                             24.1.1.4        GE0/212.1.1.0/24        Direct  0   0           12.1.1.2        GE0/0

1、R1、R3先通告EBGP路由1.1.1.1,然后再在R4上通过EBGP路由1.1.1.1
开启R5侧debug,确认R5侧收到BGP update更新报文携带团体属性1111:1111

<R5>t mThe current terminal is enabled to display logs.<R5>t dThe current terminal is enabled to display debugging logs.<R5>deb<R5>debugging bgp u<R5>debugging bgp update<R5>reset bgp allReset 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 ,<R5>dis bgp rou 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/Anull

2、R2先通告EBGP路由1.1.1.1,然后再在R1、R3上通过EBGP路由1.1.1.1

[R5]%Jan  9 00:12:58:312 2020 R5 BGP/5/BGP_STATE_CHANGED:  BGP default.: 25.1.1.2 State is changed from OPENCONFIRM to ESTABLISHED.*Jan  9 00:12:58:459 2020 R5 BGP/7/DEBUG:         BGP.: Recv UPDATE from peer 25.1.1.2 with following destinations:        Update message length : 52        Origin       : IGP         AS path      : 200 400         Next hop     : 25.1.1.2         1.1.1.1/32 PathID 0 ,<R5>dis bgp rou 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 RxPathID        : 0x0   TxPathID        : 0x0   AS-path         : 200 400 Origin          : igp Attribute value : pref-val 0 State           : valid, external, best  IP precedence   : N/A QoS local ID    : N/A Traffic index   : N/A
结论:在EBGP ECMP负载均衡环境中,当不同的EBGP 宣告者分别发布既带有团体属性的community属性值和不带团体属性的community属性的业务网段时,最终EBGP接收者会将最早发布路由更新的Speaker宣告者的路由条目放到自己的BGP路由表象中。即以最早收到的路由为原则,最先收到谁的路由,就将谁的路由放置到路由表象中。-----![](https://s4.51cto.com/images/blog/202008/16/0ed30fddb3091da29f5a66d9efc7b8c2.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
.

广告 广告

评论区