
初期設定
コンフィグ
BGPルート 条件付きアドバタイズ
https://www.n-study.com/bgp-detail/bgp-route-conditional-advertisement/?expand_article=1
iosv-1
en
terminal length 0
conf t
hostname iosv-1
line console 0
logging synchronous
exit
!
int gi0/0
ip address 192.168.13.1 255.255.255.0
no shut
!
int gi0/1
ip address 172.16.1.1 255.255.255.0
no shut
!
int lo0
ip address 1.1.1.1 255.255.255.255
exit
!
int lo1
ip address 199.1.1.1 255.255.255.0
!
router bgp 100
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 update-source loopback0
neighbor 3.3.3.3 ebgp-multihop 255
neighbor 172.16.1.10 remote-as 1
end
!
[あとから追加]
access-list 3 permit 199.1.1.0
access-list 4 permit 100.1.1.0
!
route-map ADV permit 10
match ip address 3
exit
!
route-map NONEXIST permit 10
match ip address 4
!
router bgp 100
network 199.1.1.0
neighbor 3.3.3.3 advertise-map ADV non-exist-map NONEXIST
iosv-3
en
terminal length 0
conf t
hostname iosv-3
line console 0
logging synchronous
exit
!
int gi0/0
ip address 192.168.13.3 255.255.255.0
no shut
!
int lo0
ip address 3.3.3.3 255.255.255.255
exit
!
router bgp 100
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source loopback0
neighbor 1.1.1.1 ebgp-multihop 255
end
!
ISP1
en
terminal length 0
conf t
hostname ISP1
line console 0
logging synchronous
exit
!
int gi0/0
ip address 172.16.1.10 255.255.255.0
no shut
!
int lo1
ip address 100.1.1.1 255.255.255.0
!
int lo2
ip address 100.1.2.1 255.255.255.0
!
int lo3
ip address 100.1.3.1 255.255.255.0
!
router bgp 1
neighbor 172.16.1.1 remote-as 100
network 100.1.1.0 mask 255.255.255.0
network 100.1.2.0 mask 255.255.255.0
network 100.1.3.0 mask 255.255.255.0
end
[advertise-mapを設定してから設定]
router bgp 1
no network 100.1.1.0 mask 255.255.255.0
- 100.1.1.0/24のネクストホップが172.16.1.10になっている(iosv-3にとってはネクストネクストホップ)ため、ルーティングテーブルには100.1.1.0/24の経路が載っていない
iosv-3#sh ip bgp
<略>
Network Next Hop Metric LocPrf Weight Path
* i 100.1.1.0/24 172.16.1.10 0 100 0 1 i
* i 100.1.2.0/24 172.16.1.10 0 100 0 1 i
* i 100.1.3.0/24 172.16.1.10 0 100 0 1 i
iosv-3#sh ip route | b Gate
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
S 1.1.1.1 [1/0] via 192.168.13.1
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.13.0/24 is directly connected, GigabitEthernet0/0
L 192.168.13.3/32 is directly connected, GigabitEthernet0/0
- next-hop-selfを設定することで、iBGPに広告する際のネクストホップを自身のアドレスに変更する
- そのため100.1.1.0/24のネクストホップが1.1.1.1で、1.1.1.1は元からルート情報があったため、100.1.1.0/24の経路情報もルーティングテーブルに載るようになる
iosv-1(config-router)#neighbor 3.3.3.3 next-hop-self
iosv-3#sh ip bgp | b Origin
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*>i 100.1.1.0/24 1.1.1.1 0 100 0 1 i
*>i 100.1.2.0/24 1.1.1.1 0 100 0 1 i
*>i 100.1.3.0/24 1.1.1.1 0 100 0 1 i
iosv-3#sh ip route | b Gate
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
S 1.1.1.1 [1/0] via 192.168.13.1
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
100.0.0.0/24 is subnetted, 3 subnets
B 100.1.1.0 [200/0] via 1.1.1.1, 00:07:15
B 100.1.2.0 [200/0] via 1.1.1.1, 00:07:15
B 100.1.3.0 [200/0] via 1.1.1.1, 00:07:15
192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.13.0/24 is directly connected, GigabitEthernet0/0
L 192.168.13.3/32 is directly connected, GigabitEthernet0/0
おまけ
- next-hop-unchagedなるものがあるらしい。multi-hp EBGPネイバーからiBGP VRF Liteでしか使えないから検証できなかったけども、いずれやりたい
iosv-1(config-router)#neighbor 3.3.3.3 next-hop-unchanged
%BGP: Can propagate the nexthop only to multi-hop EBGP neighbor or iBGP VRF CE lite