1. 程式人生 > 實用技巧 >BGP對等組 peer-group

BGP對等組 peer-group

BGP對等組:
當同樣的路由策略應用於多個BGP對端的時候,將對端指定為一個對等組的成員將會極大地簡化一個路由器的BGP配置。可以按照下面步驟來生成一個對等組:
1)為對等組指定一個名字 neighbor xiaomu peer-group
2)如果是內部對等組,就要先為對等組指定AS號(neighbor xiaomu remote-as 100 );
如果是外部對等組,每個EBGP都要單獨指定。
neighbor x.x.x.x remote-as 200
3)將成員加入對等組中: neighbor 2.2.2.2 peer-group xiaomu
4) 如果是內部對等組,要指定loopback , next-hop-self
neighbor xiaomu update-source Loopback0
neighbor xiaomu next-hop-self
5)對對等組應用策略:neighbor xiaomu filter-list 1 in

內部對等組的配置:
R1:
router bgp 100
no synchronization
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
neighbor xiaomu peer-group //為對等體組指定一個名字
neighbor xiaomu remote-as 100 //必須先指定內部對等組的AS號
neighbor xiaomu update-source Loopback0
neighbor 2.2.2.2 peer-group xiaomu //將對等組的成員加入對等組中
neighbor 3.3.3.3 peer-group xiaomu
no auto-summary
R2:
!
router bgp 100
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 2.2.2.0 mask 255.255.255.0
neighbor xiaomu peer-group
neighbor xiaomu remote-as 100
neighbor xiaomu update-source Loopback0
neighbor xiaomu next-hop-self
neighbor 1.1.1.1 peer-group xiaomu
neighbor 3.3.3.3 peer-group xiaomu
neighbor 172.16.4.4 remote-as 200
no auto-summary
R3: !
router bgp 100
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
network 3.3.3.0 mask 255.255.255.0
neighbor xiaomu peer-group
neighbor xiaomu remote-as 100
neighbor xiaomu update-source Loopback0
neighbor xiaomu next-hop-self
neighbor 1.1.1.1 peer-group xiaomu
neighbor 2.2.2.2 peer-group xiaomu
neighbor 172.16.5.5 remote-as 200
no auto-summary

外部對等組的配置: R2:
!
router bgp 100
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 2.2.2.0 mask 255.255.255.0
neighbor xiaomu peer-group
neighbor xiaomu remote-as 100
neighbor xiaomu update-source Loopback0
neighbor xiaomu next-hop-self
neighbor out-xiaomu peer-group//定義一個對等組名
neighbor 1.1.1.1 peer-group xiaomu
neighbor 3.3.3.3 peer-group xiaomu
neighbor 172.16.4.4 remote-as 200//單獨指定外部對等組成員的AS號
neighbor 172.16.4.4 peer-group out-xiaomu//將成員加入對等組中
no auto-summary
R3:
!
router bgp 100
no synchronization
bgp router-id 3.3.3.3
bgp log-neighbor-changes
network 3.3.3.0 mask 255.255.255.0
neighbor xiaomu peer-group
neighbor xiaomu remote-as 100
neighbor xiaomu update-source Loopback0
neighbor xiaomu next-hop-self
neighbor out-xiaomu peer-group
neighbor 1.1.1.1 peer-group xiaomu
neighbor 2.2.2.2 peer-group xiaomu
neighbor 172.16.5.5 remote-as 200
neighbor 172.16.5.5 peer-group out-xiaomu
no auto-summary
測試: R2#show ip bgp peer-group
BGP peer-group is xiaomu, remote AS 100
BGP version 4
Default minimum time between advertisement runs is 5 seconds
For address family: IPv4 Unicast
BGP neighbor is xiaomu, peer-group internal, members:
1.1.1.1 3.3.3.3
Index 1, Offset 0, Mask 0x2
NEXT_HOP is always this router
Update messages formatted 17, replicated 5
Number of NLRIs in the update sent: max 0, min 0

BGP peer-group is out-xiaomu
BGP version 4
Default minimum time between advertisement runs is 30 seconds
For address family: IPv4 Unicast
BGP neighbor is out-xiaomu, peer-group external, members:
172.16.4.4
Index 2, Offset 0, Mask 0x4
Update messages formatted 5, replicated 0
Number of NLRIs in the update sent: max 0, min 0