目次
はじめに
こんにちは。ネットワークエンジニアの「だいまる」です。
今回もBGPの経路関連に関する記事として「デフォルトルートの広報」についてまとめていきたいと思います。
デフォルトルート広報
概要
デフォルトルートとは「0.0.0.0/0」を指し、全ルートが該当する経路のことを指します。
フルルートや全てのプライベートアドレスの経路を内部に広報した場合、性能的に処理できないルータや経路切り替えが遅くなり、サービス影響が発生するリスクがあります。
そのため、デフォルトルート(0.0.0.0/0)のみを広報することで管理する経路数を減らすメリットが出てきます。
設定方法
デフォルトルート(0.0.0.0/0)のみの制御方法について、まとめていきます。
Static経路によるデフォルトルートの設定
(config)# ip route 0.0.0.0 0.0.0.0 <next-hop> #next-hopはNull0が多いイメージ
上記でデフォルトルートを作成した後は、BGP配下にdefault-information originateの設定を行います。
BGP配下へのdefault originateの設定
(config)# router bgp <AS番号>
(config-router)# redistribute static
(config-router)# default-information originate
動作確認
それでは実際にCisco IOSで動作確認を実施していきましょう。
検証環境
今回も検証環境に利用するのは以下の構成です。
事前確認(ルータ4)
ルータ4でデフォルトルート(0.0.0.0/0)が回ってきてないことを確認したいと思います。
事前確認
Router4#show ip bgp
BGP table version is 12, local router ID is 10.10.4.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
r>i 10.10.1.1/32 10.10.1.1 0 100 0 i
r>i 10.10.2.1/32 10.10.2.1 0 100 0 i
r>i 10.10.3.1/32 10.10.3.1 0 100 0 i
*> 10.10.4.1/32 0.0.0.0 0 32768 i
*>i 10.20.0.0/16 10.10.2.1 0 100 0 i
*>i 10.20.5.1/32 10.10.1.1 0 100 0 200 i
*>i 10.20.6.1/32 10.10.1.1 0 100 0 200 i
*>i 10.20.7.1/32 10.10.1.1 0 100 0 200 i
*>i 10.30.8.1/32 10.10.2.1 0 100 0 300 i
*>i 10.40.9.1/32 10.10.1.1 0 100 0 400 i
*>i 10.40.19.1/32 10.10.1.1 0 100 0 400 i
Router4#
ルータ1/ルータ2への設定(フィルタによる経路制御含む)
フィルタ作成
Router2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#ip prefix-list default seq 10 permit 0.0.0.0/0
Router2(config)#route-map default permit 10
Router2(config-route-map)#match ip address prefix-list default
Router2(config-route-map)#exit
Router2(config)#end
次にBGP配下の設定を行います。
BGP配下の設定
Router2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#router bgp 100
Router2(config-router)#redistribute static
Router2(config-router)#default-information originate
Router2(config-router)#neighbor 10.10.1.1 route-map default out
Router2(config-router)#neighbor 10.10.3.1 route-map default out
Router2(config-router)#neighbor 10.10.4.1 route-map default out
Router2(config-router)#end
Router2#
事後確認(ルータ4)
設定後は、実際に動作しているかを事後確認してみましょう。
事後確認(ルータ4)
Router4#show ip bgp
BGP table version is 26, local router ID is 10.10.4.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
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 0.0.0.0 10.10.2.1 0 100 0 ?
r>i 10.10.3.1/32 10.10.3.1 0 100 0 i
*> 10.10.4.1/32 0.0.0.0 0 32768 i
Router4#
ほとんどの経路が消え、デフォルトルート(0.0.0.0/0)が新たに追加されていることがわかります。
また、消えた経路に対するPingも疎通できているため、問題ないことがわかります。
Pingによる疎通確認
Router4#ping 10.10.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/2 ms
Router4#ping 10.30.8.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.30.8.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/3 ms
最後に
今回は経路数をデフォルトルート(0.0.0.0/0)のみに絞る経路制御方法をまとめてみました。
この記事が皆さんの役に立っているのであれば、幸いです。


