衝動的にAWSにSiteToSiteVPNを張りたくなったらi-revoを契約しよう
思い立ったが吉日生活
普通に生活してると、ふと夜中にAWSにSiteToSiteVPNを張りたい!と思う日がある。そんな時におすすめなのがi-revo。
i-revoとvyattaを使えば低コストでAWSとSite to Site VPN接続ができるのでざっと解説する。
※本記事は参考程度にお読みいただけると幸いです。
夜中のテンションで契約できる、グローバルIP付きのプロバイダ
i-revoの場合、プロバイダの料金が月額500円でIPv4のグローバルIPを無料で払い出してくれるので、カスタマーゲートウェイのIPとして使えるのである。
しかも面倒な書類の手続きやメールのやり取り不要で、ネットからクレジットカード使って申し込めば即日使える。
正に夜中のテンションでやらかすのにうってつけ!
ただし、i-revoは転送量制限が5GB/日と厳しいので、大容量のファイルの転送を行うのには向かない。
間違ってもi-revo経由で仮想マシンのリフトとかやるのはNG!
でもルーターがお高いんじゃないの?
え?高いルーターが要るんじゃないか?
そんなことはありません!
ソフトウェアルータであるvyatta(現VyOS)を使えばタダ!
動かすのは、kvmでもesxiでもvirtualboxでもvmaware
playerでもWindows10のHyper-Vでも何でもござれ!
ほら高いルーターなんて必要ない!
コミュニティ版のISOを入手すれば大丈夫!
フレッツは2セッションあるから実質無料
え?固定回線がいるんじゃないかって?
…まぁフレッツ光とか回線は別途必要だけど、デフォルトでPPPoE2セッション使えるから実質無料よ!(?)
足りなかったら300円払えばセッション追加できるから!
実際に動かしていたコンフィグ
検証用の環境なので、i-revoでも特に困ってはなかったのだが思うところあってv6プラスの固定IPサービスでグローバルIPを取得したため、i-revo+VyOSの構成は止めてしまった。
ついカッとなって「v6プラス」固定IPサービスを申し込んだ。反省はしていない。
— KenTokuda (@ken_tokuda) May 19, 2020
何して遊ぼっかな😄https://t.co/AebaJqknhc
i-revo、サラッと解約できた😅
— KenTokuda (@ken_tokuda) August 12, 2020
ネットだけで契約もサクッとできるし、PPPoEでグローバルIPが欲しくなったらまた契約しよう😁
もう使ってない環境ではあるが、実際に使ってたコンフィグを晒しておく。
Firewall周りは割と適当なので、しっかりセキュアな設定にしてくださいね♥
多分espの穴とか要らん気がする。
あと、ipsec-interfacesにeth0とpppoe0を両方書いている理由が思い出せないけど、local-addressにグローバルIPを指定してたらpppoe0で、ローカルのIPを指定してたらeth0で行けるはず。
AWSからダウンロードしてきたコンフィグだとVyOSのバージョンが1.2以降だとこちらの内容に引っかかるので、注意。
ipv4-unicastの書き方にする必要がある。
vyos@vyos:~$ show version
Version: VyOS 1.2-rolling-201910110117
Built by: autobuild@vyos.net
Built on: Fri 11 Oct 2019 01:17 UTC
Build UUID: 48a11fa6-8c59-4dbb-94a3-215376c09a02
Build Commit ID: 46f9b2ab60e4fa
Architecture: x86_64
Boot via: installed image
System type: KVM guest
Hardware vendor: QEMU
Hardware model: Standard PC (i440FX + PIIX, 1996)
Hardware S/N:
Hardware UUID: 6d66c35f-4d43-40cd-b384-9ae88ee68ed2
Copyright: VyOS maintainers and contributors
vyos@vyos:~$ show config | strip-private
firewall {
all-ping enable
broadcast-ping disable
config-trap disable
ipv6-receive-redirects disable
ipv6-src-route disable
ip-src-route disable
log-martians enable
name FromOutSide {
default-action drop
rule 10 {
action accept
state {
established enable
related enable
}
}
rule 20 {
action accept
icmp {
type-name echo-request
}
protocol icmp
}
rule 30 {
action accept
destination {
port 500
}
protocol udp
}
rule 31 {
action accept
protocol esp
}
}
receive-redirects disable
send-redirects enable
source-validation disable
syn-cookies enable
twa-hazards-protection disable
}
interfaces {
ethernet eth0 {
address xxx.xxx.90.1/24
hw-id XX:XX:XX:XX:XX:14
pppoe 0 {
default-route auto
firewall {
local {
name FromOutSide
}
}
mtu 1454
name-server auto
password xxxxxx
user-id xxxxxx
}
}
ethernet eth1 {
address xxx.xxx.20.200/24
hw-id XX:XX:XX:XX:XX:6a
}
loopback lo {
}
vti vti0 {
address xxx.xxx.198.126/30
description "VPC tunnel 1"
mtu 1436
}
vti vti1 {
address xxx.xxx.147.18/30
description "VPC tunnel 2"
mtu 1436
}
}
nat {
source {
}
}
protocols {
bgp XXXXXX {
address-family {
ipv4-unicast {
network xxx.xxx.0.0/0 {
}
}
}
neighbor xxx.xxx.147.17 {
address-family {
ipv4-unicast {
soft-reconfiguration {
inbound
}
}
}
remote-as XXXXXX
timers {
holdtime 30
keepalive 10
}
}
neighbor xxx.xxx.198.125 {
address-family {
ipv4-unicast {
soft-reconfiguration {
inbound
}
}
}
remote-as XXXXXX
timers {
holdtime 30
keepalive 10
}
}
}
static {
route xxx.xxx.10.0/24 {
next-hop xxx.xxx.20.1 {
}
}
}
}
service {
ssh {
listen-address xxx.xxx.20.200
}
}
system {
config-management {
commit-revisions 100
}
console {
device ttyS0 {
speed 115200
}
}
host-name xxxxxx
login {
user xxxxxx {
authentication {
encrypted-password xxxxxx
plaintext-password xxxxxx
}
level admin
}
}
ntp {
server xxxxx.tld {
}
}
syslog {
global {
facility all {
level info
}
facility protocols {
level debug
}
}
}
time-zone Asia/Tokyo
}
vpn {
ipsec {
esp-group AWS {
compression disable
lifetime 3600
mode tunnel
pfs enable
proposal 1 {
encryption aes128
hash sha1
}
}
ike-group AWS {
dead-peer-detection {
action restart
interval 15
timeout 30
}
ikev2-reauth no
key-exchange ikev1
lifetime 28800
proposal 1 {
dh-group 2
encryption aes128
hash sha1
}
}
ipsec-interfaces {
interface eth0
interface pppoe0
}
site-to-site {
peer xxxxx.tld {
authentication {
mode pre-shared-secret
pre-shared-secret xxxxxx
}
connection-type initiate
description "VPC tunnel 1"
ike-group AWS
ikev2-reauth inherit
local-address xxx.xxx.80.81
vti {
bind vti0
esp-group AWS
}
}
peer xxxxx.tld {
authentication {
mode pre-shared-secret
pre-shared-secret xxxxxx
}
connection-type initiate
description "VPC tunnel 2"
ike-group AWS
ikev2-reauth inherit
local-address xxx.xxx.80.81
vti {
bind vti1
esp-group AWS
}
}
}
}
}
ちょっと古いけどVyoSの基礎を知りたい方におすすめの書籍
ルーターはハードじゃなきゃ嫌だと言う方にはvyattaが動いているEdgeRouterをおすすめ
下記設定でSite To Site VPNが張れるらしい。
コメント
コメントを投稿