BGP 团队属性--no-export属性

拓扑:

 

 

 

bgp no-export

 

1.     no-export属性

当一台路由器,收到一个bgp的路由带有no-export属性是这台路由器就不会再向EBGP对等体发送该路由了

 

R1

Router>en

Router#conf t

Router(config)#host R1

R1(config)#no ip do lo

R1(config)#line cons 0

R1(config-line)#no exec-t

R1(config-line)#logg sync

R1(config-line)#exi

R1(config)#int s1/1

R1(config-if)#ip add 10.1.1.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#int lo 0

R1(config-if)#ip add 172.16.1.1 255.255.255.0

R1(config-if)#ip add 172.16.2.1 255.255.255.0 s

R1(config-if)#ip add 172.16.3.1 255.255.255.0 s

R1(config-if)#router bgp 1

R1(config-router)#net 172.16.1.0 mask 255.255.255.0

R1(config-router)#net 172.16.2.0 mask 255.255.255.0

R1(config-router)#net 172.16.3.0 mask 255.255.255.0

R1(config-router)#nei 10.1.1.2 remote 2

R1(config-router)#end

 

没配置NO-EXPORT时,R3仍学到所有路由

R3#sh ip bgp

BGP table version is 6, local router ID is 10.2.2.2

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

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

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 10.1.1.0/24      10.2.2.1                 0             0 2 i

*  10.2.2.0/24      10.2.2.1                 0             0 2 i

*>                  0.0.0.0                  0         32768 i

*> 172.16.1.0/24    10.2.2.1                               0 2 1 i

*> 172.16.2.0/24    10.2.2.1                               0 2 1 i

*> 172.16.3.0/24    10.2.2.1                               0 2 1 i

配置EX-EXPORT

R1(config)#access-list 1 per 172.16.3.0 0.0.0.255

R1(config)#route-map ccxx per 10

R1(config-route-map)#ma ip add 1

R1(config-route-map)#set community no-export

R1(config-route-map)#exi

R1(config)#route-map ccxx per 20 (写一个空条目)

R1(config-route-map)#exi

R1(config)#router bgp 1

R1(config-router)#nei 10.1.1.2 route-map ccxx out

R1(config-router)#nei 10.1.1.2 send-community

配好后:

R1#cle ip bgp * so out

 

查看R2 R3路由表

R2#sh ip bgp

BGP table version is 5, local router ID is 10.2.2.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

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

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 172.16.1.0/24    10.1.1.1                 0             0 1 i

*> 172.16.2.0/24    10.1.1.1                 0             0 1 i

*> 172.16.3.0/24    10.1.1.1                 0             0 1 i

R3#sh ip bgp

BGP table version is 5, local router ID is 10.2.2.2

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

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

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 172.16.1.0/24    10.2.2.1                               0 2 1 i

*> 172.16.2.0/24    10.2.2.1                               0 2 1 i

 

R3没学到172.16.3.0 这一网络吧!!!!!)

R2#sh ip bgp 172.16.3.1

BGP routing table entry for 172.16.3.0/24, version 5

Paths: (1 available, best #1, table Default-IP-Routing-Table, not advertised to EBGP peer)

  Not advertised to any peer

  1

    10.1.1.1 from 10.1.1.1 (172.16.1.1)

      Origin IGP, metric 0, localpref 100, valid, external, best

      Community: no-export

<think>好的,我需要回答用户关于BGP community属性no-export的作用和用法的问题。首先,我应该回顾一下BGP的基本概念,特别是community属性的相关知识。BGP community是一种用来标记路由的标签,允许路由器根据这些标签来执行特定的策略。no-export是预定义的知名community之一,它的作用是阻止路由被传播到特定的边界之外。 根据用户提供的引用资料,引用[1]提到了BGP的一些配置注意事项,比如remote-as和选路策略,但并没有直接提到no-export。不过,结合常见的BGP知识,no-export的作用应该是阻止路由被发送到其他AS。例如,当路由器收到带有no-export community的路由时,它不会将该路由通告给其他自治系统(AS)的对等体。这在多AS协作或需要限制路由传播范围的场景中非常有用,比如在联盟内部或与特定伙伴之间共享路由时。 接下来,我需要确认no-export的具体用法。通常,community属性可以通过路由映射(route-map)来设置,并在邻居配置中应用。例如,在Cisco设备中,可以使用set community no-export语句来标记特定的路由。然后,当这些路由被通告时,其他BGP路由器会识别这个community并遵守不向外部分发的规定。 另外,需要考虑no-export是否会影响联盟内的子AS之间的路由传递。根据RFC 1997,no-export community的路由不应该被通告到本地AS之外,但如果使用BGP联盟,联盟内的子AS之间可能仍然会传播,除非明确配置了不这样做。这一点需要明确说明,避免用户误解。 还要举一个应用实例,比如在多个AS互联的情况下,如何利用no-export来限制某些敏感路由的传播范围。例如,AS100希望将某个路由通告给AS200,但不希望AS200再传播给其他AS,这时候就可以在AS100的路由策略中为这些路由设置no-export community。这样,AS200收到后即使有其他的对等体连接,也不会将这些路由继续传播出去。 最后,根据用户的要求,生成相关问题,比如其他知名community的作用、配置注意事项、与本地优先级的区别等。确保问题具有相关性,能够帮助用户深入理解BGP community属性的其他方面。</think>### BGP Community属性no-export的作用与用法 #### 1. **基本作用** BGP的`no-export`是预定义的知名Community属性之一,用于控制路由传播范围。其核心功能是:**标记的路由不会被通告到当前自治系统(AS)之外**。例如,若路由器从邻居收到带有`no-export`的路由,即使该路由器与其他AS建立BGP对等关系,也不会将此类路由转发给外部AS的对等体[^1]。 #### 2. **典型应用场景** - **限制路由泄露**:在多个AS协作的场景中(如企业多分支机构互联),可通过`no-export`确保某些敏感路由仅在特定AS内部使用,避免意外传播到公共互联网。 - **联盟(Confederation)控制**:在BGP联盟中,`no-export`的路由仍可能在联盟内的子AS间传递,但不会泄露到联盟外的AS[^2]。 #### 3. **配置示例(以Cisco IOS为例)** ```plaintext route-map SET_NO_EXPORT permit 10 match ip address 10 set community no-export ! router bgp 65001 neighbor 192.0.2.2 route-map SET_NO_EXPORT out ``` 此配置将匹配访问列表10的路由添加`no-export` Community,并应用到指定BGP邻居的出方向。 #### 4. **注意事项** - **Community传递**:默认BGP不传递Community属性,需通过`neighbor send-community`命令显式启用。 - **与Local Preference的优先级**:若路由同时受`no-export`和本地优先级(Local Pref)影响,BGP会优先处理路由策略,再决定是否传播。 #### 5. **验证方法** 可通过`show bgp ipv4 unicast <prefix>`查看路由的Community属性,确认是否包含`no-export`(通常显示为十进制值`4294967042`或十六进制`0xFFFFFF02`)。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值