vSRXを活用した、JUNOSのお勉強まとめ【mpBGP / MPLS-VPN 続編】
今回も、引き続き、JUNOSのお勉強メモです。
ttsubo.hatenablog.com
前回は、PE - CE間は、Staticルーティングを前提としておりました。
今回は、PE - CE間で、eBGPによるダイナミックルーティングの設定に変更します。
◼︎ vSRXトポロジ構成
だんだんと、トポロジ図が複雑になってしまったので、今回は、OSPF / LDP面の記載を割愛しました。
あと、前回からの差分は、
・pc1の箇所に、VyOS-1を配備
・VyOS-1とvSRX-1間をeBGPに変更
vSRX-1 vSRX-3 +---------+ +---------+ | | | | | 10.0.0.1| vSRX-2 | 10.0.0.3| | +-----+ | +----+ | +-----+ | | | GRT +-------------------+ GRT | | | +--+--+ | +----+ | +--+--+ | | | | | | | 20.0.0.1/24 +--------+ 172.16.0.0/30 | +--+--+ | | +--+--+ | 172.16.1.0/30 +-----+ 10.0.0.1/24 20.0.1.1/24 | VyOS-1 +-----------------+ VRF | | | | VRF +-----------------+ pc2 | 10.0.1.1/24 +--------+ .1 .2 | +-----+ | | +-----+ | .1 .2 +-----+ 10.0.2.1/24 AS: 65001 +---------+ +---------+ AS: 65000 AS: 65000 : : : : : : : < --------- > : : < --------- > : : < --------- > : eBGP mp-iBGP static
◼︎ JUNOSルーティング設定
(0) 事前準備
前回の記事で設定したダイレクト接続経路"172.16.0.0/30"を再配布するコンフィグ設定を、削除しておきます。
それ以外のコンフィグ設定は、前回のまま活用することとします。
root@vSRX-1# delete routing-instances VPN-A vrf-table-label root@vSRX-1# commit
(1) VRFルーティングインスタンス基本設定
vSRX-1側でのコンフィグは、概ね、前回を設定を踏襲します。唯一、VRF内部で、eBGP Peerを動作させる設定のみ追加します。
なお、vSRX-3側でのコンフィグは、全く変更の必要がありません。
1. routing-instancesを設定する
root@vSRX-1# set routing-instances VPN-A protocols bgp group VPN-A-BGP type external root@vSRX-1# set routing-instances VPN-A protocols bgp group VPN-A-BGP peer-as 65001 root@vSRX-1# set routing-instances VPN-A protocols bgp group VPN-A-BGP neighbor 172.16.0.1 [edit] root@vSRX-1# show | compare [edit routing-instances VPN-A] + protocols { + bgp { + group VPN-A-BGP { + type external; + peer-as 65001; + neighbor 172.16.0.1; + } + } + } root@vSRX-1# commit
2. BGP Peerの状態を確認しておく
root@vSRX-1> show bgp neighbor 172.16.0.1 Peer: 172.16.0.1+35346 AS 65001 Local: 172.16.0.2+179 AS 65000 Type: External State: Established Flags: <Sync> Last State: OpenConfirm Last Event: RecvKeepAlive Last Error: None Options: <Preference PeerAS Refresh> Holdtime: 90 Preference: 170 Number of flaps: 0 Peer ID: 172.16.0.1 Local ID: 172.16.0.2 Active Holdtime: 90 Keepalive Interval: 30 Group index: 1 Peer index: 0 BFD: disabled, down Local Interface: ge-0/0/0.0 NLRI for restart configured on peer: inet-unicast NLRI advertised by peer: inet-unicast NLRI for this session: inet-unicast Peer supports Refresh capability (2) Stale routes from peer are kept for: 300 Peer does not support Restarter functionality Peer does not support Receiver functionality Peer supports 4 byte AS extension (peer-as 65001) Peer does not support Addpath Table VPN-A.inet.0 Bit: 20001 RIB State: BGP restart is complete RIB State: VPN restart is complete Send state: in sync Active prefixes: 2 Received prefixes: 2 Accepted prefixes: 2 Suppressed due to damping: 0 Advertised prefixes: 4 Last traffic (seconds): Received 21 Sent 5 Checked 51 Input messages: Total 10 Updates 2 Refreshes 0 Octets 268 Output messages: Total 11 Updates 1 Refreshes 0 Octets 301 Output Queue[1]: 0 (VPN-A.inet.0, inet-unicast)
3. VPN-Aのアドバタイズ経路を確認しておく
対向側(VyOS-1)からアドバタイズされた経路を受信できるようになりました。
root@vSRX-1> show route receive-protocol bgp 172.16.0.1 table VPN-A.inet.0 VPN-A.inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 20.0.0.0/24 172.16.0.1 1 65001 I * 20.0.1.0/24 172.16.0.1 1 65001 I
つづいて、対向側(VyOS-1)へのアドバイズを確認してみました。
通常のBGP設定と異なり、mpBGP/MPLS-VPN設定の場合は、Export policy適用せずとも、アドバタイズされるようです。
root@vSRX-1> show route advertising-protocol bgp 172.16.0.1 VPN-A.inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.0/24 Self I * 10.0.1.0/24 Self I * 10.0.2.0/24 Self I * 172.16.1.0/30 Self I
vSRX-1でのVRFテーブルの保持状態を確認してみます。
root@vSRX-1> show route table VPN-A.inet.0 VPN-A.inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.0/24 *[BGP/170] 03:13:11, localpref 100, from 10.0.0.3 AS path: I, validation-state: unverified > to 192.168.0.2 via ge-0/0/1.0, Push 299856, Push 299792(top) 10.0.1.0/24 *[BGP/170] 03:13:11, localpref 100, from 10.0.0.3 AS path: I, validation-state: unverified > to 192.168.0.2 via ge-0/0/1.0, Push 299856, Push 299792(top) 10.0.2.0/24 *[BGP/170] 03:13:11, localpref 100, from 10.0.0.3 AS path: I, validation-state: unverified > to 192.168.0.2 via ge-0/0/1.0, Push 299856, Push 299792(top) 20.0.0.0/24 *[BGP/170] 00:13:36, MED 1, localpref 100 AS path: 65001 I, validation-state: unverified > to 172.16.0.1 via ge-0/0/0.0 20.0.1.0/24 *[BGP/170] 00:13:36, MED 1, localpref 100 AS path: 65001 I, validation-state: unverified > to 172.16.0.1 via ge-0/0/0.0 172.16.0.0/30 *[Direct/0] 06:00:41 > via ge-0/0/0.0 172.16.0.2/32 *[Local/0] 06:00:41 Local via ge-0/0/0.0 172.16.1.0/30 *[BGP/170] 03:13:11, localpref 100, from 10.0.0.3 AS path: I, validation-state: unverified > to 192.168.0.2 via ge-0/0/1.0, Push 299856, Push 299792(top)
(2) エンド端末間での疎通確認
まず、VyOS-1側でのBGPテーブルを確認しておきます。
vyos# show ip bgp BGP table version is 0, local router ID is 172.16.0.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, R Removed Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 10.0.0.0/24 172.16.0.2 0 65000 i *> 10.0.1.0/24 172.16.0.2 0 65000 i *> 10.0.2.0/24 172.16.0.2 0 65000 i *> 20.0.0.0/24 0.0.0.0 1 32768 i *> 20.0.1.0/24 0.0.0.0 1 32768 i *> 172.16.1.0/30 172.16.0.2 0 65000 i Total number of prefixes 6
エンドエンド端末間でpingをうってみましょう。
1. "172.16.1.2"宛にpingをうってみる
vyos# ping 172.16.1.2 PING 172.16.1.2 (172.16.1.2) 56(84) bytes of data. 64 bytes from 172.16.1.2: icmp_req=1 ttl=61 time=0.624 ms 64 bytes from 172.16.1.2: icmp_req=2 ttl=61 time=1.69 ms 64 bytes from 172.16.1.2: icmp_req=3 ttl=61 time=0.810 ms 64 bytes from 172.16.1.2: icmp_req=4 ttl=61 time=0.700 ms 64 bytes from 172.16.1.2: icmp_req=5 ttl=61 time=0.747 ms ^C --- 172.16.1.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3999ms rtt min/avg/max/mdev = 0.624/0.914/1.690/0.393 ms
pingが成功しました!
2. "10.0.0.1"宛にpingをうってみる
vyos# ping 10.0.0.1 PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_req=1 ttl=61 time=0.735 ms 64 bytes from 10.0.0.1: icmp_req=2 ttl=61 time=0.826 ms 64 bytes from 10.0.0.1: icmp_req=3 ttl=61 time=0.834 ms 64 bytes from 10.0.0.1: icmp_req=4 ttl=61 time=0.716 ms 64 bytes from 10.0.0.1: icmp_req=5 ttl=61 time=0.921 ms ^C --- 10.0.0.1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3996ms rtt min/avg/max/mdev = 0.716/0.806/0.921/0.078 ms
こちらも、pingが成功しました!
◼︎ 最終的なコンフィグ内容の確認
1. vSRX-1側コンフィグ内容
root@vSRX-1> show configuration ... (snip) routing-options { router-id 10.0.0.1; autonomous-system 65000; } protocols { mpls { interface ge-0/0/1.0; } bgp { group L3VPN { type internal; local-address 10.0.0.1; family inet-vpn { unicast; } neighbor 10.0.0.3; } } ospf { area 0.0.0.0 { interface ge-0/0/1.0; interface lo0.0 { passive; } } } ldp { interface ge-0/0/1.0; } } routing-instances { VPN-A { instance-type vrf; interface ge-0/0/0.0; route-distinguisher 65000:101; vrf-target target:65000:101; protocols { bgp { group VPN-A-BGP { type external; peer-as 65001; neighbor 172.16.0.1; } } } } }
2. VyOS-1側コンフィグ内容
vyos# show running-config Building configuration... Current configuration: ! log syslog log facility local7 ! debug ospf6 lsa unknown ! interface eth0 ipv6 nd suppress-ra link-detect ! interface eth1 ip address 172.16.0.1/30 ipv6 nd suppress-ra link-detect ! interface eth2 ip address 20.0.0.1/24 ipv6 nd suppress-ra link-detect ! interface eth3 ip address 20.0.1.1/24 ipv6 nd suppress-ra link-detect ! interface lo ! router bgp 65001 bgp router-id 172.16.0.1 bgp network import-check network 20.0.0.0/24 network 20.0.1.0/24 neighbor 172.16.0.2 remote-as 65000 ! ip forwarding ipv6 forwarding ! line vty ! end
◼︎ 最後に
mpBGP /MPLS-VPN構成における"GRT"、"VRF"の関係と、おのおので動作するBGP動作がイメージできれば、JUNOSコンフィグの階層構造は、とても理解しやすいものであると感じました。
以上です。