Azure NAT Gatewayを理解するための前提
NAT Gatewayはsubnet-levelのoutbound serviceで、VMごとのpublic IPを要求しない。 unsolicited inbound connectionは許可せず、active outbound connectionへのresponse trafficのみ通す。
NAT Gatewayはsubnetのdefault Internet destinationに対するegressを提供し、通常NATのためだけのUDR追加は不要。 Standardはsingle-zone scope(明示zoneまたはNo zoneでAzureが1 zoneに配置)で、StandardV2はzone-redundantとしてregion内の全Availability Zoneにまたがり、IPv6、flow logs、より高いthroughputを提供する。
StandardV2はStandardV2 public IP/prefixが必要で、Standardからin-place upgradeはできない。 SNAT port exhaustionはsource/destination concurrency、public IP数、idle timeout等を含めてtelemetryで評価する。
Control plane と data plane
仕組み
workloadからInternet宛packetが出ると、route selection後にsubnet associationされたNAT GatewayがSNAT sourceをNAT public IPへ変換する。
NAT Gatewayはoutbound flowごとにSNAT portを割り当て、response packetをprivate tupleへ戻す。Internet側から新規flowを開始してNAT Gateway経由でVMへ入ることはできない。
NAT Gatewayはsecurity filterそのものではない。outbound destination制御が必要ならNSG/Firewall/NVAなど別controlが必要。
centralized inspection pathではNAT Gatewayをどのsubnetへ関連付けるかでsource translation pointが変わる。Firewallとの組合せはpacket pathを明示して設計する。
Packet path
routing問題は「どのresourceがあるか」ではなく、packetが各hopで何を選ぶかを順に追う。
- VMがInternet destinationへnew connectionを開始。
- Azure route selectionでInternet/egress pathを決定。
- NAT Gatewayがprivate source IP:portをpublic IP:SNAT portへ変換。
- destinationからresponseがNAT public IPへ戻る。
- NAT stateに一致するresponseのみoriginal VMへ復元される。
設計判断
| 判断点 | 推奨 | 理由 |
|---|---|---|
| SKU | 新規要件でzone redundancy/IPv6/flow logs/100Gbps級が必要ならStandardV2を評価。 | StandardとStandardV2はpublic IP SKUも異なる。 |
| Public IP capacity | concurrencyとdestination patternからSNAT port余裕を確認。 | 単純VM台数だけではport exhaustionを予測できない。 |
| Security | NAT Gatewayをfirewallの代替と扱わない。 | inbound抑止とegress filteringは別要件。 |
| HA test | zone failureやpublic IP dependencyをarchitectureに合わせて検証。 | SKUごとのfailure domainが異なる。 |
確認手順
Azure Portal
- NAT gateways → SKU / Availability zone / Public IP addresses or prefixesを確認。
- Subnet側のNAT gateway associationを確認。
- Metrics/flow logs(利用SKUでsupportされる場合)とapplication側source IPを突き合わせる。
Verification discipline
- subscription / resource group / resource IDを記録する。
- 同じsource・destinationでbefore/afterを比較する。
- read-only evidenceを保存してから変更する。
- control-plane successとapplication successを別々に判定する。
az network nat gateway show -g <rg> -n <nat> -o jsonc
az network vnet subnet show -g <rg> --vnet-name <vnet> -n <subnet> --query natGateway -o jsoncGet-AzNatGateway -ResourceGroupName <rg> -Name <nat>
障害切り分け
| 症状 | 疑う点 | 証拠 | 次の確認 |
|---|---|---|---|
| outbound timeout/断続失敗 | SNAT exhaustion / destination saturation / idle timeout | NAT metrics + connection pattern | public IP capacity/connection reuse/timeout設計を見直す |
| source IPが変わった | 別egress method/association | effective route + observed public IP | subnet associationとrouteを固定 |
| InternetからNAT public IPへ入れない | 仕様どおりunsolicited inbound不可 | flow direction | LB/App Gateway/Firewall DNAT等のinbound serviceを別途設計 |
| StandardV2へ変更できない | in-place upgrade非対応 | SKU/public IP resource | parallel deploy + subnet切替で移行 |
変更時の確認と rollback
- 新NATをparallelに作成しpublic IP allowlistを先に反映。
- subnet association切替前にcritical destination testを準備。
- 切替後はnew connectionsでsource public IP、throughput、error率を確認。
- rollback用に旧NAT/public IPを検証完了まで保持。
What changed recently
StandardV2はzone-redundant、IPv6、flow logs、最大100 Gbps級のcapabilityを持つ現行SKU。Standardとはpublic IP SKUやmigration方式が異なるため、既存Standardを「設定変更だけでV2化」しない。