配置BGP团体属性
如下图所示,R2分别与R1、R3建立EBGP连接,要求AS 1发布到AS 2中的路由不能发布到其他AS中;
配置接口IP地址:
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
配置类似,不做阐述;
配置BGP:
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 2
[r2]bgp 2
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 12.1.1.1 as-number 1
[r2-bgp]peer 23.1.1.2 as-number 3
[r3]bgp 3
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 23.1.1.1 as-number 2
配置BGP团体属性:
[r1]route-policy aaa permit node 5
[r1-route-policy]apply community ?
INTEGER<0-4294967295> Specify community number
STRING<3-11> Specify aa<0-65535>:nn<0-65535>
internet Internet(well-known community attributes)
no-advertise Do not advertise to any peer (well-known community attributes)
no-export Do not export to external peers(well-known community attributes)
no-export-subconfed Do not send outside a sub-confederation(well-known community attributes)
none No community attribute
[r1-route-policy]apply community no-export
[r1]bgp 1
[r1-bgp]ipv4-family unicast
[r1-bgp-af-ipv4]peer 12.1.1.2 route-policy aaa export
[r1-bgp-af-ipv4]peer 12.1.1.2 advertise-community
查看配置结果:
[r2]display bgp routing-table 1.1.1.1
BGP local router ID : 2.2.2.2
Local AS number : 2
Paths: 1 available, 1 best, 1 select
BGP routing table entry information of 1.1.1.0/24:
From: 12.1.1.1 (1.1.1.1)
Route Duration: 00h01m08s
Direct Out-interface: GigabitEthernet0/0/0
Original nexthop: 12.1.1.1
Qos information : 0x0
Community:no-export
AS-path 1, origin igp, MED 0, pref-val 0, valid, external, best, select, active, pre 255
Not advertised to any peer yet