Cloudflare Magic Transit IPv4とIPv6 (Beta) を繋げてみた
はじめに
CloudflareネットワークサービスのCloudflare Magic Transit IPv4とIPv6(Beta)について
簡単にまとめた記事になります。
Cloudflare Magic Transit
Cloudflare Magic Transitは、オンプレミスやハイブリッドネットワーク向けに、DDoS攻撃からの保護、ネットワークパフォーマンスの向上、トラフィック管理の簡素化を提供するネットワークセキュリティソリューションです。Cloudflareのグローバルネットワークを活用し、IPサブネット全体を保護し、ルーティングや接続性を強化します。
接続の利点
DDoS攻撃を効果的に防御、ファイアウォール機能でネットワークを保護、最適なルーティングでレイテンシを削減、クリーントラフィックのみを迅速に転送、オンプレミスやクラウド環境とシームレスに統合、常時稼働型やオンデマンド型の利用が可能。セキュリティとパフォーマンスを向上しながら、柔軟性とコスト効率を両立するネットワーク保護が可能です。
接続の概要
Cloudflare Magic TransitとPalo Alto Network PA-220とVyOSを利用して接続しています。
- IPv6は2024年12月16日からBeta予定となります。
CloudflareとPA-220 IPsec Tunnel設定
PA-220は Verison 10.2.9-h1 を利用しました。
CloudlareダッシュボードにてMagic TransitのIPSecトンネルを作成します。
PA-220 Tunnel Interface Address: 10.1.1.3/31
Cloudflare Tunnel Interface Address: 10.1.1.2/31
Customer endpoint: PA-220インターフェースのGlobal IP address
Cloudflare endpoint: Cloudflare側から提供
今回はFQDN IDを利用しました
IKE Crypto ProfileをDH Group: group14, ENCRYPTION: aes-256-cbc
IKE GatewayでCloudflare側で作成と提供されるPre-shared Key, Local Identification を入力
IPSec Crypto ProfileをIPSec Protocol: ESP, ENCRYPTION: aes-256-cbc, DH Group: group14
IPsec TunnelにてIKE Gateway, IPSec Crypto Profileを選択
LoopbackにルーティングしているIPプレフィックスからのIPアドレス付与
% ping 8.xxx.xxx.242
PING 8.31.160.242 (8.31.160.242): 56 data bytes
64 bytes from 8.xxx.xxx.242: icmp_seq=0 ttl=51 time=11.895 ms
64 bytes from 8.xxx.xxx.242: icmp_seq=1 ttl=51 time=9.654 ms
64 bytes from 8.xxx.xxx.242: icmp_seq=2 ttl=51 time=8.838 ms
Interface Mangaement ProfileでPingを許可し疎通確認
CloudflareとVyOS GRE Tunnel設定 IPv6 over IPv4 GRE
CloudlareダッシュボードにてMagic Transit IPv6向けGREトンネルを作成します。
IPv4, IPv6 Interface Adreess - tun0用 を設定
カスタマーGREエンドポイント: VyOSで利用できるグローバルIP
Cloudflareエンドポイント: Cloudflarea側から提供IP
Cloudflare側 IPv6プレフィックス ルーティング
VyOS側 GRE Tunnel
set firewall options interface tun0 adjust-mss6 1476
set interfaces tunnel tun0 address '172.16.120.1/31'
set interfaces tunnel tun0 description 'magic-wan'
set interfaces tunnel tun0 encapsulation 'gre'
set interfaces tunnel tun0 ip disable-arp-filter
set interfaces tunnel tun0 remote '162.xxx.xxx.xxx’ #Coudflare Endpoint IP
set interfaces tunnel tun0 source-address 'VyOS External IP address'
set interfaces tunnel tun0 address 2606:xxxx:x:0:xxxx:xxxx:x:1/127
VyOS側 Loopback IPv6 address
set interfaces loopback lo address 2606:xxxx:x:fffe::1/128
VyOS側 IPv6 デフォルトルート
set protocols static route6 ::/0 next-hop 2606:xxxx:x:0:xxxx:xxxx:x:0 interface tun0
GRE Tunnel 疎通確認
taka$ ping 172.16.120.0 interface 172.16.120.1 count 4
PING 172.16.120.0 (172.16.120.0) from 172.16.120.1 : 56(84) bytes of data.
64 bytes from 172.16.120.0: icmp_seq=1 ttl=64 time=186 ms
64 bytes from 172.16.120.0: icmp_seq=2 ttl=64 time=183 ms
64 bytes from 172.16.120.0: icmp_seq=3 ttl=64 time=175 ms
64 bytes from 172.16.120.0: icmp_seq=4 ttl=64 time=180 ms
taka$ ping 2606:xxxx:x:x:xxxx:xxxx:x:0 interface 2606:xxxx:x:x:xxxx:xxxx:x:1 count 4
PING 2606:54c1:7:0:a9fe:12d2:9:0(2606:54c1:7:0:a9fe:12d2:9:0) from 2606:54c1:7:0:a9fe:12d2:9:1 : 56 data bytes
64 bytes from 2606:xxxx:x:0:xxxx:xxxx:x:0: icmp_seq=1 ttl=64 time=168 ms
64 bytes from 2606:xxxx:x:0:xxxx:xxxx:x:0: icmp_seq=2 ttl=64 time=179 ms
64 bytes from 2606:xxxx:x:0:xxxx:xxxx:x:0: icmp_seq=3 ttl=64 time=181 ms
64 bytes from 2606:xxxx:x:0:xxxx:xxxx:x:0: icmp_seq=4 ttl=64 time=181 ms
インターネット側からIPv6で通信
OCN - Internet - Cloudflare - VyOS
$ ping6 2606:54c2:1:fffe::1
PING 2606:54c2:1:fffe::1 (2606:xxxx:x:fffe::1) 56 data bytes
64 bytes from 2606:xxxx:x:fffe::1: icmp_seq=1 ttl=48 time=188 ms
64 bytes from 2606:xxxx:x:fffe::1: icmp_seq=2 ttl=48 time=190 ms
64 bytes from 2606:xxxx:x:fffe::1: icmp_seq=3 ttl=48 time=197 ms
$ curl -g -6 'http://[2606:xxxx:x:fffe::1]:80'
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to Magic Transit nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
まとめ
CloudflareとMagic Transitを既存機器から接続することができました。
今回記載しませんがツールを利用してDDoS攻撃対策に効果があることを確認しています。
Cloudflare Magic TransitによりDDoS攻撃対策、ネットワークパフォーマンス向上、Cloudflareのグローバルネットワークを活用し、IPサブネット全体を保護しつつ、最適なルーティングで遅延削減を期待することができます。
Discussion