1、 AS123起ospf协议,R123建立bgp邻居关系,并且将R1的两个环回通告给BGP
[r2-bgp]dis bgp routing-table
BGP Local router ID is 10.0.12.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: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.1.0 10.0.12.1 0 0 1i
*> 192.168.2.0 10.0.12.1 0 0 1i
2、使用aggregate detail-suppressed汇总
抑制明细路由
[r2-bgp]dis bgp routing-table
BGP Local router ID is 10.0.12.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
*> 192.168.0.0/16 10.0.12.1 0 1i
但是此命令抑制缺少update报文的内容AS_path
加入as-set关键字即可
[r2-bgp]dis bgp routing-table 192.168.0.0
BGP local router ID : 10.0.12.2
Local AS number : 2
Paths: 1 available, 1 best, 1 select
BGP routing table entry information of 192.168.0.0/16:
From: 10.0.12.1 (10.0.12.1)
Route Duration: 00h05m20s
Direct Out-interface: GigabitEthernet0/0/1
Original nexthop: 10.0.12.1
Qos information : 0x0
AS-path 1, origin igp, pref-val 0, valid, external, best, select, active, pre 2
55
Aggregator: AS 1, Aggregator ID 10.0.12.1, Atomic-aggregate
Advertised to such 2 peers:
10.0.12.1
10.0.23.3
3、将192.168.2.2这条明细也通告给AS23
使用suppress-policy
[r1-bgp]dis bgp routing-table
BGP Local router ID is 10.0.12.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 3
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.0.0/16 127.0.0.1 0 i
s> 192.168.1.0 0.0.0.0 0 0 i
*> 192.168.2.0 0.0.0.0 0 0 i
具体配置:
[r1]dis current-configuration configuration bgp
[V200R003C00]
#
bgp 1
peer 10.0.12.2 as-number 2
#
ipv4-family unicast
undo synchronization
aggregate 192.168.0.0 255.255.0.0 suppress-policy hcip
network 192.168.0.0 255.255.0.0
network 192.168.1.0
network 192.168.2.0
peer 10.0.12.2 enable
#
Return
4、只要有192.168.1.1路由则存在汇总路由负责则不再
使用orgin-policy关键字
[r1-bgp]dis bgp routing-table
BGP Local router ID is 10.0.12.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 3
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.0.0/16 127.0.0.1 0 i
*> 192.168.1.0 0.0.0.0 0 0 i
*> 192.168.2.0 0.0.0.0 0 0 i
现在去掉192.168.1.0这条路由
[r1-bgp]dis bgp routing-table
BGP Local router ID is 10.0.12.1
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
*> 192.168.2.0 0.0.0.0 0 0 i
只有一条路由
5、修改BGP汇总路由的MED属性
使用attribute-policy
<r2>dis bgp routing-table
BGP Local router ID is 10.0.12.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplet
Total Number of Routes: 1
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 192.168.0.0/16 10.0.12.1 200 0 1i