LoginSignup
1
0

Akamai's cloud computing servicesとAWSをSite-to-Site VPNで接続をする(冗長構成OSPF編)

Last updated at Posted at 2023-06-21

本構成について

Akamai's cloud computing services上に構築したインスタンスとAWSのインスタンス間の通信を行う際にはインターネット経由で通信を行う必要があります。
今回はLinodeインスタンスにstrongSwanとFRRoutingを構築して、AWSのSite-to-Site VPNに接続し、安全な通信経路とBGPによる動的ルーティングを構築します。
Linode VLAN内のインスタンスの経路を冗長化させるため、OSPFを活用して冗長化を実現します。

image.png

構成の前提

前提として、2台のVPNインスタンスにはすでにVPNとBGPの設定が終わっている状態となります。

構築手順については以下を参照ください。

Linode VLANについての補足

Linode VLANはLayer 2(データリンク層)で動作するため、ブロードキャスト、マルチキャストの通信が可能となります。
今回の構成ではOSPFを利用しますが、マルチキャストの通信も問題ありません。

VPN/Routing Instance 1 のFRRoutingの設定を追加

iBGPとOSPFの設定を行います。

root@localhost:~# vtysh

Hello, this is FRRouting (version 8.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

localhost# conf t
localhost(config)#

! VLANのインターフェイスに対してOSPFのタイマー値とプライオリティを設定する
interface eth1
 ip ospf dead-interval 3
 ip ospf hello-interval 1
 ip ospf priority 100
exit
!
router bgp 65000
 bgp log-neighbor-changes
 no bgp ebgp-requires-policy
 bgp graceful-restart
 timers bgp 3 9
 ! iBGPの設定を追加
 neighbor 10.0.1.3 remote-as 65000
 neighbor 169.254.139.81 remote-as 64512
 neighbor 169.254.173.125 remote-as 64512
 !
 address-family ipv4 unicast
  network 10.0.1.0/24
  ! iBGPの設定を追加
  neighbor 10.0.1.3 soft-reconfiguration inbound
  neighbor 10.0.1.3 next-hop-self
  neighbor 169.254.139.81 soft-reconfiguration inbound
  neighbor 169.254.173.125 soft-reconfiguration inbound
 exit-address-family
exit
!
! OSPFのエリアを追加
router ospf
 redistribute bgp
 network 10.0.1.0/24 area 0
exit
!
end

VPN/Routing Instance 2 のFRRoutingの設定を追加

iBGPとOSPFの設定を行います。

root@localhost:~# vtysh

Hello, this is FRRouting (version 8.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

localhost# conf t
localhost(config)#

! VLANのインターフェイスに対してOSPFのタイマー値とプライオリティを設定する
interface eth1
 ip ospf dead-interval 3
 ip ospf hello-interval 1
 ip ospf priority 90
exit
!
router bgp 65000
 bgp log-neighbor-changes
 no bgp ebgp-requires-policy
 bgp graceful-restart
 timers bgp 3 9
 ! iBGPの設定を追加
 neighbor 10.0.1.2 remote-as 65000
 neighbor 169.254.157.109 remote-as 64512
 neighbor 169.254.198.209 remote-as 64512
 !
 address-family ipv4 unicast
  network 10.0.1.0/24
  ! iBGPの設定を追加
  neighbor 10.0.1.2 soft-reconfiguration inbound
  neighbor 10.0.1.2 next-hop-self
  neighbor 169.254.157.109 soft-reconfiguration inbound
  neighbor 169.254.198.209 soft-reconfiguration inbound
 exit-address-family
exit
!
! OSPFのエリアを追加
router ospf
 redistribute bgp
 network 10.0.1.0/24 area 0
exit
!
end

BGP Neighborを確認

VPN/Routing Instance 2とNeighborが確立できていることを確認します。

localhost# show ip bgp summary

IPv4 Unicast Summary (VRF default):
BGP router identifier 172.104.177.22, local AS number 65000 vrf-id 0
BGP table version 2
RIB entries 3, using 552 bytes of memory
Peers 3, using 2169 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
10.0.1.3        4      65000     17853     17854        0    0    0 14:52:31            2        2 N/A
169.254.139.81  4      64512     17854     17856        0    0    0 14:52:39            1        2 N/A
169.254.173.125 4      64512     17854     17856        0    0    0 14:52:39            1        2 N/A

ICMP InstanceにFRRoutingを構築

VPN/Routing Instanceから動的に経路情報を取得するため、OSPFを利用します。
ICMPを行うインスタンスにFRRoutingをインストールします。

apt update
apt install frr 

FRRoutingの設定を行います。

root@localhost:~# vtysh

Hello, this is FRRouting (version 8.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

localhost# conf t
localhost(config)#

! VLANのインターフェイスに対してOSPFのタイマー値とプライオリティを設定する
interface eth1
 ip ospf dead-interval 3
 ip ospf hello-interval 1
exit
!
! OSPFのエリアを追加
router ospf
 network 10.0.1.0/24 area 0
exit
!
end

OSPFの確認

正常にNeighborが確立できていることを確認します。

localhost# show ip ospf neighbor

Neighbor ID     Pri State           Dead Time Address         Interface                        RXmtL RqstL DBsmL
xxx.xxx.xxx.xxx  100 Full/DROther       2.646s 10.0.1.2        eth1:10.0.1.100                      0     0     0
xxx.xxx.xxx.xxx 100 Full/Backup        2.646s 10.0.1.3        eth1:10.0.1.100                      0     0     0

経路情報を取得できているか確認をします。

localhost# show ip route ospf
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

O>* 10.0.0.0/24 [110/20] via 10.0.1.2, eth1, weight 1, 15:08:16
  *                      via 10.0.1.3, eth1, weight 1, 15:08:16
O   10.0.1.0/24 [110/1] is directly connected, eth1, weight 1, 15:32:41

疎通確認

AWSのインスタンスに疎通確認が取れるか確認をします。

root@localhost:~# ping 10.0.0.24
PING 10.0.0.24 (10.0.0.24) 56(84) bytes of data.
64 bytes from 10.0.0.24: icmp_seq=1 ttl=126 time=73.7 ms
64 bytes from 10.0.0.24: icmp_seq=2 ttl=126 time=74.1 ms
64 bytes from 10.0.0.24: icmp_seq=3 ttl=126 time=73.5 ms
64 bytes from 10.0.0.24: icmp_seq=4 ttl=126 time=73.6 ms

root@localhost:~# tracepath 10.0.0.24
 1?: [LOCALHOST]                      pmtu 1500
 1:  10.0.1.2                                              0.617ms
 1:  10.0.1.2                                              0.569ms
 2:  10.0.1.2                                              0.408ms pmtu 1436
 2:  10.0.1.2                                              0.389ms pmtu 1422
 2:  10.0.0.24                                            73.670ms reached

以上で構築は完了です。

まとめ

FRRoutingでBGPとOSPFを活用することで、どちらかのVPNインスタンスに障害があった場合でも動的に経路変更を行うことができるようになりました。
高可用性が求められる通信などでのユースケース等に利用していただければと思います。

関連記事

アカマイ・テクノロジーズ合同会社はQiitaでAkamai's cloud computing services関連など開発者向けの記事を掲載しております。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0