LoginSignup
2
0

More than 1 year has passed since last update.

IBM Cloud: BM for VPCのインターフェース属性(Infrastructure NAT)とは何か?

Last updated at Posted at 2022-02-03

1. はじめに

VSIの時にはなかったBM for VPCのインターフェースの属性としてEnable infrastructure NATというものが追加されています。

image.png

これは一体何をするものでしょうか?無効にするとどうなるでしょうか?
IBM Cloud docsには一応以下のように説明があります・・・がこれだけ読んでピンと来る人はほとんどいないのではないでしょうか。

Turning on infrastructure NAT allows the VPC infrastructure to perform any needed NAT operations. If infrastructure NAT is off, the packet passes unmodified to and from the network interface, allowing the workload to perform NAT operations. The default option is on. You must have the Advanced Network Operator IAM role to modify this configuration. Allow IP spoofing must be turned off if Enable infrastructure NAT is turned off.

2. パケットフロー

  • 118.x.xx.131は、私の端末のGlobal IP
  • 158.xxx.xx.55は、Floating IP(サーバーのネットワークインターフェースに紐づけることができるPublic IP)
  • 172.16.0.4はVMのIP

とします。

2-1: Infrastructure NATが有効の時(デフォルトの挙動)

  • Floating IP宛のパケットはVPC内でFloating IPからネットワークインターフェースのIPにDestination NATされて、サーバーに到達します。 image.png
InfrastructureNATが有効な時のVM上でのtcpdump
[root@guestvm1 ~]# tcpdump -i any port 443 -nn
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
14:54:04.963287 IP 118.x.xx.131.36336 > 172.16.0.4.443: Flags [S], seq 3006787997, win 65535, options [mss 1420,nop,wscale 6,nop,nop,TS val 875394950 ecr 0,sackOK,eol], length 0
14:54:06.033623 IP 118.x.xx.131.36336 > 172.16.0.4.443: Flags [S], seq 3006787997, win 65535, options [mss 1420,nop,wscale 6,nop,nop,TS val 875395950 ecr 0,sackOK,eol], length 0
14:54:07.047181 IP 118.x.xx.131.36336 > 172.16.0.4.443: Flags [S], seq 3006787997, win 65535, options [mss 1420,nop,wscale 6,nop,nop,TS val 875396950 ecr 0,sackOK,eol], length 0
14:54:08.055694 IP 118.x.xx.131.36336 > 172.16.0.4.443: Flags [S], seq 3006787997, win 65535, options [mss 1420,nop,wscale 6,nop,nop,TS val 875397950 ecr 0,sackOK,eol], length 0
14:54:09.059092 IP 118.x.xx.131.36336 > 172.16.0.4.443: Flags [S], seq 3006787997, win 65535, options [mss 1420,nop,wscale 6,nop,nop,TS val 875398950 ecr 0,sackOK,eol], length 0

2-2: Infrastructure NATが無効の時

  • Floating IP宛のパケットはVPC内では何も行われません。Floating IPに紐づいているネットワークインターフェース宛にそのまま転送されます。

image.png

InfrastructureNATを無効にした時のVM上でのtcpdump
[root@guestvm1 ~]# tcpdump -i any port 443 -nn
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
14:55:13.137704 IP 118.x.xx.131.39416 > 158.xxx.xx.55.443: Flags [S], seq 1477831577, win 65535, options [mss 1420,nop,wscale 6,nop,nop,TS val 1853123572 ecr 0,sackOK,eol], length 0
14:55:14.145450 IP 118.x.xx.131.39416 > 158.xxx.xx.55.443: Flags [S], seq 1477831577, win 65535, options [mss 1420,nop,wscale 6,nop,nop,TS val 1853124572 ecr 0,sackOK,eol], length 0
14:55:15.145397 IP 118.x.xx.131.39416 > 158.xxx.xx.55.443: Flags [S], seq 1477831577, win 65535, options [mss 1420,nop,wscale 6,nop,nop,TS val 1853125572 ecr 0,sackOK,eol], length 0
14:55:16.149641 IP 118.x.xx.131.39416 > 158.xxx.xx.55.443: Flags [S], seq 1477831577, win 65535, options [mss 1420,nop,wscale 6,nop,nop,TS val 1853126572 ecr 0,sackOK,eol], length 0
14:55:17.154095 IP 118.x.xx.131.39416 > 158.xxx.xx.55.443: Flags [S], seq 1477831577, win 65535, options [mss 1420,nop,wscale 6,nop,nop,TS val 1853127573 ecr 0,sackOK,eol], length 0

Infrastructure NATが無効のケースは、どういう時に役に立つのでしょうか?
例えば、VPC上でVMware NSXなどを使ってネットワークの仮想化をしている場合、T0ルーターにそのままパケットを割り振りたい時などにこの機能は役立ちます。VPC側でNATされてしまっていたら、T0ルーターに到達する時に既に宛先がT0ルーターのprivate IPになってしまっていますし、T0ルーターからVMに転送するために再度NATが必要になってきたりしますからね。。。
T0ルーターに宛先IPがpublic IPのまま到達してくれた方が、そこから再度DNATするのか、そのままフォワードするのか、など設計の柔軟性も上がるのではないでしょうか。

3. Floating IPの関連付け

通常は、Infrastructure NATが有効の時はFloating IPは1つしか紐付けることはできません。しかし、Infrastructure NATを無効にすれば、複数のFloating IPを紐付けることができます。

  • Infrastructure NATが有効の時
    image.png
  • Infrastrucutre NATが無効の時
    image.png

以下、IBM Cloud docsより引用

To associate multiple floating IPs to a network interface, make sure that both Allow IP spoofing and Enable infrastructure NAT are off on the network interface.

2
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
2
0