最新开班
RS CCNA暑期 7月9日 在线报名在线报名
RS CCNP 6月1日 在线报名在线报名
RS CCNP暑期 7月19日 在线报名在线报名
RS CCIE 5月19日 在线报名在线报名
SEC CCNP-CCIE 7月2日 在线报名在线报名
DC CCNP-CCIE 6月2日 在线报名在线报名
无线 CCNP-CCIE 5月20日 在线报名在线报名
RS HCNA暑期 7月9日 在线报名在线报名
BGP基础实验:公认团体属性的3个实验&MED属性实验
发布时间:2023-07-13  关键词:HCIP datacom  来源:乾颐堂  
  

公认团体属性的3个实验


 image.png

 image.png

 

R2上给两条路由打上标记,并通告给R3

[R2]ip ip-prefix 1.1 permit 10.1.1.1 32

 

[R2]ip ip-prefix 1.2 permit 10.1.1.2 32

[R2-route-policy]dis th

 

route-policy comm permit node 10

 if-match ip-prefix 1.1

 apply community 100:1

 

route-policy comm permit node 20

 if-match ip-prefix 1.2

 apply community 100:2

#

[R2-bgp]peer 12.1.1.1 route-policy comm import     //R1进入R2时把这两条路由加上团体属性

[R2-bgp]peer 3.3.3.3 advertise-community           //团体属性通告给3.3.3.3

no-advertise

[R2]route-policy 1.2 permit node 10

 

[R2-route-policy]if-match ip-prefix 1.2

[R2-route-policy]apply community no-advertise

[R2]route-policy 1.2 permit node 99

 

[R2-bgp]peer 3.3.3.3 route-policy 1.2 export

 

//在出接口应用,R3得到不通告的团体属性,到达R4后消失。  

<R3>dis bgp routing-table 10.1.1.2

 

 BGP local router ID : 34.1.1.3

 Local AS number : 64512

 Paths:   1 available, 1 best, 1 select

 BGP routing table entry information of 10.1.1.2/32:

 From: 2.2.2.2 (23.1.1.2)

 Route Duration: 00h04m14s  

 Relay IP Nexthop: 23.1.1.2

 Relay IP Out-Interface: GigabitEthernet0/0/1

 Original nexthop: 2.2.2.2

 Qos information : 0x0

 Community:no-advertise

 AS-path 100, origin igp, MED 0, localpref 100, pref-val 0, valid, internal-conf

ed, best, select, active, pre 255

 Not advertised to any peer yet

[R4-bgp]dis bgp routing-table 10.1.1.2

Info: The network does not exist.

几乎不传递给任何对等体邻居。

no-export

[R2-route-policy]apply community no-export

//此时R3R4查看1.1有团体属性,1.2团体属性为no-export

[R4-bgp]peer 45.1.1.5 advertise-community

 

<R5>dis bgp routing-table 10.1.1.2      //R510.1.1.2的路由消失,只有1.1的路由

Info: The network does not exist.

<R5>dis bgp routing-table 10.1.1.1

 

 BGP local router ID : 45.1.1.5

 Local AS number : 300

 Paths:   1 available, 1 best, 1 select

 BGP routing table entry information of 10.1.1.1/32:

 From: 45.1.1.4 (45.1.1.4)

 Route Duration: 00h00m08s  

 Direct Out-interface: GigabitEthernet0/0/1

 Original nexthop: 45.1.1.4

 Qos information : 0x0

 Community:<100:1>

 AS-path 200 100, origin igp, pref-val 0, valid, external, best, select, active,

 pre 255

 Not advertised to any peer yet

 

该属性不导出给其他as区域,在IBGP内传递属性。

no-export-subconfed

[R2-route-policy]apply community no-export-subconfed

 

在一个as联盟的子区域内传,出了子区域就消失。

<R4>dis bgp routing-table 10.1.1.2

Info: The network does not exist.

<R4>dis bgp routing-table 10.1.1.1

 

 BGP local router ID : 45.1.1.4

 Local AS number : 64513

 Paths:   1 available, 1 best, 1 select

 BGP routing table entry information of 10.1.1.1/32:

 From: 3.3.3.3 (34.1.1.3)

 Route Duration: 00h15m52s  

 Relay IP Nexthop: 34.1.1.3

 Relay IP Out-Interface: GigabitEthernet0/0/1

 Original nexthop: 2.2.2.2

 Qos information : 0x0

 Community:<100:1>

 AS-path (64512) 100, origin igp, MED 0, localpref 100, pref-val 0, valid, exter

nal-confed, best, select, active, pre 255

 Advertised to such 1 peers:

    45.1.1.5

 

MED属性实验

MEDMulti-Exit Discriminator,多出口鉴别器)是可选非过渡属性,MED值不会跨AS传递(EBGP间传递一次)。

image.png 

缺省情况下,路由器只比较来自同一相邻ASBGP路由的MED值,也就是说如果去往同一个目的地的两条路由来自不同的相邻AS,则不进行MED值的比较。

一台BGP路由器将路由通告给EBGP对等体时,是否携带MED属性,需要根据以下条件进行判断(不对EBGP对等体使用策略的情况下):

1.如果该BGP路由是本地始发(本地通过networkimport-route命令引入)的,则缺省携带MED属性发送给EBGP对等体。

2.如果该BGP路由为从BGP对等体学习到,那么该路由传递给EBGP对等体时缺省不会携带MED属性。

3.IBGP对等体之间传递路由时,MED值会被保留并传递,除非部署了策略,否则MED值在传递过程中不发生改变也不会丢失。

可以使用default imed命令修改缺省的MiEDdefault med命令只对本设备上用import-route命令引入的路由和BGP的聚合路由生效。例如在R2上配置default med 999,那么R2通过import-routeaggregate命令产生的路由传递给R3时,路由携带的MED999

image.png 

R1宣告

[R1-bgp]network 1.11.11.11 32

R1bgp宣告,则MED0

[R2-bgp]dis bgp routing-table

 

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 

 *>i  1.11.11.11/32      1.1.1.1         0          100        0      i

[R3-bgp]dis bgp routing-table

 

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 

 *>   1.11.11.11/32      23.1.1.2                              0      100i

 是本路由器产生,所以MED0,在AS内和该as相连的下一跳AS都为0

R2宣告

[R2-bgp]network 1.11.11.11 32

[R2-bgp]dis bgp routing-table

 

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 

 *>   1.11.11.11/32      0.0.0.0         1                     0      i

[R3-bgp]dis bgp routing-table

 

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 

 *>   1.11.11.11/32      23.1.1.2        1                     0      100i

[R1-bgp]dis bgp routing-table

 

      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 

 *>i  1.11.11.11/32      2.2.2.2         1          100        0      i

该路由在R2产生为ospf学习来,cost1,所以在BGP内宣告后MED值为1


姓名:
Q Q:
电话:
全国统一客服电话:
400-618-8070
扫一扫立即关注
乾颐堂微信公众号
© 2013-2021 乾颐堂网络实验室 版权所有:上海乾韵信息科技有限公司 京ICP备14044984号-2 备案查询地址:http://www.beian.miit.gov.cn/