组网需求
- Router B分别与Router A、Router C建立EBGP连接
- 要求:AS 10发布给AS 20的路由,不在发布给其他AS
配置BGP团体属性拓扑
配置思路
- 在Router A上配置策略,发布No_Export团体属性
- 实现AS 10 的路由发布给AS 20后,不在发布给其他AS
配置命令
配置各路由器基本功能以及各个接口IP 地址
Router A配置
1
2
3
4
5
6
7
8sys
sys Router A
int g0/0/0
ip add 200.1.2.1 30
int LoopBack 0
ip add 9.1.1.1 32
int LoopBack 1
ip add 1.1.1.1 32
Router B配置
1
2
3
4
5
6
7
8sys
sys Router B
int g0/0/0
ip add 200.1.2.2 30
int g0/0/1
ip add 200.1.3.1 30
int g0/0/0
ip add 2.2.2.2 32
Router C配置
1
2
3
4
5
6sys
sys Router C
int g0/0/1
ip add 200.1.3.2 30
int LoopBack 0
ip add 3.3.3.3 32
配置EBGP对等体
Router A配置
1
2
3
4sys
bgp 10
router-id 1.1.1.1
peer 10.1.2.2 as-number 20
Router B配置
1
2
3
4
5sys
bgp 20
router-id 2.2.2.2
peer 10.1.2.1 as-number 10
peer 10.1.3.2 as-number 30
Router C配置
1
2
3
4sys
bgp 30
router-id 3.3.3.3
peer 10.1.3.1 as-number 20
发布路由
Router A配置
1
2
3
4sys
bgp 10
ipv4-family unicast
network 9.1.1.1 32
配置团体community团体属性
Router A配置
1
2
3sys
route-policy community_policy permit node 10
aplly community no_export
在BGP中应用团体属性
Router A配置
1
2
3
4
5sys
bgp 10
ipv4-family unicast
peer 10.1.2.2 route-policy community_policy
peer 10.1.2.2 advertise-community
查看结果
配置团体属性前的BGP路由表(以Router B为例)
路由表
1
2
3
4
5
6
7
8
9
10
11
12
13
14display bgp routing-table
<Router B>display bgp routing-table
BGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 9.1.1.1/32 200.1.2.1 0 0 10i
具体目的地址路由表
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19display bgp routing-table 9.1.1.1 32
<Router B>display bgp routing-table 9.1.1.1 32
BGP local router ID : 2.2.2.2
Local AS number : 20
Paths: 1 available, 1 best, 1 select
BGP routing table entry information of 9.1.1.1/32:
From: 200.1.2.1 (1.1.1.1)
Route Duration: 00h10m03s
Direct Out-interface: GigabitEthernet0/0/0
Original nexthop: 200.1.2.1
Qos information : 0x0
AS-path 10, origin igp, MED 0, pref-val 0, valid, external, best, select, activ
e, pre 255
# 宣告给邻居
Advertised to such 2 peers:
200.1.2.1
200.1.3.2
配置团体属性后的BGP路由表(以Router B为例)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18display bgp routing-table 9.1.1.1 32
<Router B>display bgp routing-table 9.1.1.1 32
BGP local router ID : 2.2.2.2
Local AS number : 20
Paths: 1 available, 1 best, 1 select
BGP routing table entry information of 9.1.1.1/32:
From: 200.1.2.1 (1.1.1.1)
Route Duration: 00h00m03s
Direct Out-interface: GigabitEthernet0/0/0
Original nexthop: 200.1.2.1
Qos information : 0x0
Community:no-export
AS-path 10, origin igp, MED 0, pref-val 0, valid, external, best, select, activ
e, pre 255
# 未宣告给邻居
Not advertised to any peer yet