静的NATありのAS間BGP接続について
先日仕事でBGPでNATセグメントのルーティングを広告するかを検証したので、備忘の意味を込めて残します。
構成図
AS50000にあるPC-Aから、AS40000にあるPC-Bに接続します。また、RT-AでPC-Aの送信元アドレスをNATします。
# 実際はPC-Bは繋がずにL3SW-Bのループバックにpingをして確かめました^^;
下記にそれぞれのアドレスを示します。
IPアドレス | サブネットマスク | V-LAN | |
---|---|---|---|
PC-A | 110.232.40.1 | 255.255.255.252 | - |
RT-A(PC-A側) | 110.232.40.2 | 255.255.255.252 | 10 |
RT-A(loopback) | 110.232.40.5 | 255.255.255.252 | - |
RT-A(WAN側) | 110.232.40.9 | 255.255.255.252 | 11 |
L3SW-B(WAN側) | 110.232.40.10 | 255.255.255.252 | 12 |
L3SW-B(loopback) | 110.232.40.13 | 255.255.255.252 | - |
L3SW-B(PC-B側) | 110.232.40.17 | 255.255.255.252 | 13 |
PC-B側 | 110.232.40.18 | 255.255.255.252 | - |
NAT | 110.10.10.0 | 255.255.255.0 | - |
設定
改めて確認したいことは、RT-AのBGPのnetworkにNATセグメントを記述したら、RT-Aがルーティングを覚え、L3SW-Bに広告するかどうかです。
さて、L3SW-Bの設定です。
# 実機がないので、とりあえずは基本的な部分とルーティングとBGPだけです^^;
まず、インターフェースです。
interface Loopback0 ip address 110.232.40.13 255.255.255.252 interface Gigabitethernet0/1 switch port mode access switch port access vlan 12 duplex auto speed auto interface Gigabitethernet0/2 switch port mode access switch port access vlan 13 duplex auto speed auto interface Vlan 12 ip address 110.232.40.10 255.255.255.252 interface Vlan 13 ip address 110.232.40.17 255.255.255.252
デフォルトルートはPC-Bの方を向くので、
ip route 0.0.0.0 0.0.0.0 110.232.40.18
BGPは、
router bgp 40000 router-id 110.232.40.13 network 110.232.40.13 mask 255.255.255.255 network 110.232.40.16 mask 255.255.255.252 neighbor 110.232.40.9 remote-as 50000 neighbor 110.232.40.9 timers 5 15 neighbor 110.232.40.9 advertisement-interval 1
L3SW-Bの設定は以上です。
次はRT-Aの設定です。インターフェースは次の通りです。
interface Loopback0 ip address 110.232.40.5 255.255.255.252 interface Gigabitethernet0/1 switch port mode access switch port access vlan 11 duplex auto speed auto interface Gigabitethernet0/2 switch port mode access switch port access vlan 10 duplex auto speed auto interface Vlan 10 ip address 110.232.40.2 255.255.255.252 interface Vlan 11 ip address 110.232.40.9 255.255.255.252
デフォルトルートはPC-Aを向くので、
ip route 0.0.0.0 0.0.0.0 110.232.40.1
BGPは、
router bgp 50000 router-id 110.232.40.5 network 110.232.40.5 mask 255.255.255.255 network 110.10.10.0 mask 255.255.255.0 neighbor 110.232.40.10 remote-as 40000 neighbor 110.232.40.10 timers 5 15 neighbor 110.232.40.10 advertisement-interval 1
RT-Aの設定は以上、だと思ってました。。。
上記設定の結果
NATセグメントのルーティングは、RT-Aは覚えてくれませんでした。当り前?なんですかね。
結論として、明示的にルーティングを追加することで、RT-Aで覚え、L3SW-Bで学習してくれました。
ip route 110.10.10.0 255.255.255.0 Gigabitethernet0/2