【old】BGP next-hop-self

画像

初期設定

コンフィグ

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の経路が載っていない
  • next-hop-selfを設定することで、iBGPに広告する際のネクストホップを自身のアドレスに変更する
  • そのため100.1.1.0/24のネクストホップが1.1.1.1で、1.1.1.1は元からルート情報があったため、100.1.1.0/24の経路情報もルーティングテーブルに載るようになる

おまけ

  • next-hop-unchagedなるものがあるらしい。multi-hp EBGPネイバーからiBGP VRF Liteでしか使えないから検証できなかったけども、いずれやりたい