送信元ネットワーク アドレス変換(SNAT)は、Dataplane V2 ロード バランシングのデフォルトの転送モードです。しかし、SNAT モードでは、クライアント IP アドレスがバックエンド Pod に対して保持されません。クライアントからのパケットは、ロードバランサ ノードに到達すると、変換され、バックエンド Pod がある宛先のワーカーノードに転送されます。バックエンド Pod は、リクエストが、クライアントの場所からではなく、ロードバランサ ノードから送信されていることを認識します。その結果、応答はロードバランサ ノードに返され、逆変換されてクライアントに送り返されます。
SNAT のパケットフロー
Dataplane V2 ロード バランシングの SNAT 転送モードでは、外部クライアントからバックエンド Pod へのパケットフローが次のようになります。
LoadBalancer タイプの Service がロードバランサ ノードに割り当てられ、その IP アドレス 172.16.20.16 がノードで実行されている MetalLB スピーカーによってアドバタイズされます。
Dataplane V2 は、SNAT を使用して送信元 IP アドレスとポートを <LB_NODE_IP>:52000 に変換し、パケットをワーカーノードに転送します。
レスポンスがロードバランサ ノードに送り返され、宛先アドレスが逆変換されます。
次の図では、SNAT モードのパケットフローを示します。
DSR ロード バランシング
Direct Server Return(DSR)は、SNAT ロード バランシングの問題を解決します。DSR モードでは、ロードバランサ ノードが IP オプションを使用してクライアントの送信元アドレスを保存します。ワーカーノードは元のパケットを復元して、バックエンド Pod に転送できます。バックエンド Pod は、ロードバランサ ノードの IP アドレスではなく、クライアント IP アドレスからパケットが送信されていることを認識できます。その結果、戻りのパケットは、ロードバランサ ノードに戻されるのではなく、直接クライアント IP アドレスに返されます。
このモードでは、クライアント IP アドレスの公開設定の問題が解決されるだけでなく、ロードバランサ ノードの帯域幅も節約されます。戻りトラフィックがロードバランサ ノードを通過する必要がなく、ロードバランサ ノードが接続トラッキングを行う必要もなくなります。この方法は、メモリを節約し転送ポートを解放します。ダウンロード トラフィックがリクエスト トラフィックよりもはるかに高い非対称ワークロードの場合、DSR フローは帯域幅を大幅に削減します。
DSR のパケットフロー
Dataplane V2 ロード バランシングの DSR 転送モードでは、外部クライアントからバックエンド Pod へのパケットフローが次のようになります。
LoadBalancer タイプの Service がロードバランサ ノードに割り当てられ、その IP アドレス 172.16.20.16 がノードで実行されている MetalLB スピーカーによってアドバタイズされます。
Dataplane V2 は、パケットをワーカーノードに転送し、IP オプションを使用して元のクライアントの送信元 IP アドレスとポートを保存します。
apiVersion:baremetal.cluster.gke.io/v1kind:Clustermetadata:name:lb-modenamespace:cluster-lb-mode...spec:clusterNetwork:forwardMode:dsr# valid options are dsr or snatpods:cidrBlocks:-192.168.0.0/16services:cidrBlocks:-10.96.0.0/20...
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-01 UTC。"],[],[],null,["This document describes the two Dataplane V2 forwarding modes for load balancing\nand how to enable them for Google Distributed Cloud. Dataplane V2 supports two\nforwarding modes for load balancing:\n\n- Source network address translation (SNAT)\n- Direct Server Return (DSR)\n\nThe forwarding mode for load balancing can be configured when you create a\ncluster only.\n\nSNAT load balancing\n\nSource network address translation (SNAT) is the default forwarding mode for\nDataplane V2 load balancing. However, in SNAT mode, the client IP address isn't\npreserved for backend Pods. When the packet from the client arrives at the load\nbalancer node, it's translated and forwarded to the destination worker node with\nthe backend Pod. The backend Pod sees that the request is coming from the load\nbalancer node, instead of the client location. As a result, the reply is\nreturned to the load balancer node and reversed translated and sent back to the\nclient.\n\nPacket flow for SNAT\n\nWith SNAT forwarding mode for Dataplane V2 load balancing, here's the packet\nflow from an external client to a backend Pod and back:\n\n- Service of type LoadBalancer is assigned to a load balancer node and its IP\n address `172.16.20.16` is advertised by the MetalLB speaker running on that\n node.\n\n- Dataplane V2 translates the source IP address and port with SNAT to\n `\u003cLB_NODE_IP\u003e:52000` and forwards the packet to the worker node.\n\n- The response is sent back to the load balancer node and the destination\n address is reverse translated.\n\nThe following diagram shows the packet flow for SNAT mode:\n\nDSR load balancing\n\nDirect Server Return (DSR) overcomes issues with SNAT load balancing. In DSR\nmode, the load balancer node uses IP Options to save the client source address.\nThe worker node can recover the original packet and forward it to the backend\nPod. The backend Pod can see that the packet is coming from client IP address\ninstead of the load balancer node IP address. As a result, the return packet\ndirectly returns to the client IP address instead of traveling back to the load\nbalancer node.\n\nThis mode not only solves the client IP address visibility problem, it also\nsaves the bandwidth for the load balancer node. Return traffic doesn't have to\ngo through the load balancer node, and the load balancer node doesn't have to do\nconnection tracking anymore. This approach saves memory and frees the forwarding\nport. For asymmetric workloads, where download traffic is much higher than\nrequest traffic, the DSR flow reduces bandwidth significantly.\n\nPacket flow for DSR\n\nWith DSR forwarding mode for Dataplane V2 load balancing, here's the packet flow\nfrom and external client to a backend Pod and back:\n\n- Service of type LoadBalancer is assigned to the load balancer node and its\n IP address `172.16.20.16` is advertised by the MetalLB speaker running on\n that node.\n\n- Dataplane V2 forwards the packet to the worker node and uses IP Options to\n save the original client source IP address and port.\n\n- Dataplane V2 on the worker node forwards the packet to the backend Pod.\n\n- The backend Pod recovers the source IP address and port and replies to the\n client.\n\nThe following diagram shows the packet flow for DSR mode:\n\nEnable DSR mode\n\nTo enable DSR mode, add the\n[`spec.clusterNetwork.forwardMode`](/kubernetes-engine/distributed-cloud/bare-metal/docs/reference/cluster-config-ref#clusternetwork-forwardmode)\nfield to your cluster configuration file and set it to `dsr`. As noted earlier,\nSNAT mode is enabled by default. You can specify SNAT mode explicitly by setting\n`forwardMode` to `snat`. The forwarding mode for Dataplane V2 load balancing can\nbe configured at cluster creation time only.\n| **Note:** For version 1.16 clusters, the ability to configure Dataplane V2 forwarding mode for load balancing is a ([Preview](/products#product-launch-stages)) capability. While in Preview, this feature uses an annotation `preview.baremetal.cluster.gke.io/dpv2-lbmode-dsr:\nenable` to enable DSR mode. For cluster upgrades from version 1.16 to 1.28.0 and higher, Google Distributed Cloud honors the annotation and sets `forwardMode` in the cluster spec accordingly. \n\n apiVersion: baremetal.cluster.gke.io/v1\n kind: Cluster\n metadata:\n name: lb-mode\n namespace: cluster-lb-mode\n ...\n spec:\n\n clusterNetwork:forwardMode: dsr # valid options are dsr or snat\n pods:\n cidrBlocks:\n - 192.168.0.0/16\n services:\n cidrBlocks:\n - 10.96.0.0/20\n ...\n\nThe `forwardMode` value can't be modified after the cluster is created. Make sure you've\nconfigured the correct option for your needs before you create the cluster."]]