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
当同样的路由策略应用于多个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
!
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
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
!
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
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
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
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
转载于:https://blog.51cto.com/xiaomu205/150877