1. はじめに
一般的には、VCFaaSでインターネットアクセスする際のPublic IPは、
- inbound trafficは、Customer Edge(T1)でDNATしてからユーザーのVMに到達する
- outbound trafficは、Customer Edge(T1)でSNAT/Masquaradeされてインターネットに出ていく。
といったFloating IPが割り当てられている。しかし、こうしたNATをCustomer Edge(T1)で実施することなく直接自分で操作したいとか、セキュリティーアプライアンスを配置したいとか、独自のIPSec VPNソフトウェアを構築したいとかという要件を満たすために、VMに直接IPアドレスを割り当てる方法も存在する。本稿ではその方法を紹介する。
2. Public IP address (without NAT)のためのIP Prefixを注文する
以下のdocsにあるように、Customer Edge(T1)に割り当てるIPアドレス(Floating IP
https://cloud.ibm.com/docs/vmware-service?topic=vmware-service-vcd-ops-guide#vcd-ops-guide-additional-ips
Requesting additional public IP addresses
You can open an IBM Support ticket to request additional public IP addresses on VDCs with public-private networking. Each ticket can include a request for either four NAT/Floating IPs or a public IP prefix. IP prefix requests can include a single /30 (two contiguous addresses) or /29 (six contiguous addresses).
- Use NAT/Floating addresses similar to the initial eight public addresses. You must configure the addresses to NAT from the public network to the Cloud Director private networks.
- Use IP prefix addresses to connect Cloud Director VMs directly to the public network without a NAT. The edge firewall is used to control public egress and ingress.
Provide the following details in the IBM Support ticket:
- The IP address type: NAT/Floating IPs or IP Prefix
- The VDC ID that includes the edge to add the IP addresses against
- The name of the edge gateway or the provider gateway in the VDC to add additional IP addresses
なお、/30ではtwo contiguous addresses
と書いてあるが、その一方はdefault gateway用のIPになるので、実質利用できるのは1個だけである。例えばCaseには以下のように起票すればいいだろう。
Subject:
Please assign the public IP prefix addresses without NAT for VCFaaS
Description:
Please assign the public IP prefix addresses(/30), as we'd like to connect the Cloud Director VMs directly to the public network without NAT. I'd like to try the following usecase.
https://cloud.ibm.com/docs/vmware-service?topic=vmware-service-vcd-ops-guide#vcd-ops-guide-additional-ips
> Use IP prefix addresses to connect Cloud Director VMs directly to the public network without a NAT. The edge firewall is used to control public egress and ingress.
Region: Tokyo
VDC name: xxxxx
VDC ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Public IP Address(without NAT)のIP prefixが割り当てられると、VMware Cloud Director上では以下で割り当ての確認が可能である。
以下では、161.xx.xx.228/30
が割り当てられたため、
- 161.xx.xx.228: Network Address
- 161.xx.xx.229: Gateway Address
- 161.xx.xx.230: VMに割り当てるAddress
- 161.xx.xx.231: Broadcast Address
として扱う。
3. Routed Networkの作成
あとはデフォルトのまま作成。
4. VMの作成
5. Firewall ruleの修正
私の端末のIPからこのPublic IPのみをSSHで許可する。
6. 疎通テスト
syasuda@MacBook-Pro ~ % ssh root@161.xxx.xx.230 -i .ssh/id_rsa
(無事SSHアクセス成功)
[root@gateway01 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:02:19:d1 brd ff:ff:ff:ff:ff:ff
altname enp11s0
inet 161.xxx.xx.230/30 brd 161.xxx.xx.231 scope global noprefixroute ens192
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe02:19d1/64 scope link
valid_lft forever preferred_lft forever
[root@gateway01 ~]# ip r
default via 161.xxx.xx.229 dev ens192 proto static metric 100
161.xxx.xx.228/30 dev ens192 proto kernel scope link src 161.xxx.xx.230 metric 100
[root@gateway01 ~]# cat /var/log/secure
(途中略)
Jul 24 02:47:05 gateway01 sshd[5290]: Accepted publickey for root from 111.xxx.x.xxx port 61465 ssh2: RSA SHA256:cGMDJ5foiwrw++tGsoDtQgJxrxWf2g0Itxob5ErenGg
Jul 24 02:47:05 gateway01 sshd[5290]: pam_unix(sshd:session): session opened for user root(uid=0) by root(uid=0)
(途中略)
7. アドバンストな構成
VCFaaSではVRRPが稼働するので、例えば既存でvSRXなどを仮想アプライアンスを構成していた場合は、IBM CloudのClassic Infrastructureの構成に似せた、以下のような構成も可能だと思われる。