내부 패스 스루 네트워크 부하 분산기는 내부 가상 머신(VM) 인스턴스에만 액세스할 수 있는 내부 IP 주소를 기반으로 서비스를 실행하고 확장할 수 있게 해주는 리전 부하 분산기입니다.
이 페이지에서는 동일한 IP 주소로 여러 전달 규칙을 사용하는 방법을 설명합니다. 내부 패스 스루 네트워크 부하 분산기에 대해 자세히 알아보려면 내부 패스 스루 네트워크 부하 분산기 개요를 참조하세요.
내부 전달 규칙을 사용하면 최대 10개의 전달 규칙에서 공유 내부 IP 주소를 사용할 수 있습니다. IP 주소를 공유하려면 IP 주소의 목적을 SHARED_LOADBALANCER_VIP로 설정합니다. 전달 규칙 프로토콜에 TCP 또는 UDP를 사용하여 전달 규칙에 최대 5개의 포트를 할당하거나, --ports=ALL을 지정하여 모든 포트를 사용할 수 있습니다. L3_DEFAULT 프로토콜을 사용하려면 --ports=ALL 옵션으로 모든 포트를 사용해야 합니다.
프로토콜과 포트의 고유한 조합으로 다음을 수행할 수 있습니다.
TCP 프로토콜을 사용하여 각 전달 규칙으로 고유한 TCP 포트 50개를 만듭니다.
전달 규칙이 TCP 프로토콜과 모든 포트를 사용하도록 구성된 경우 TCP 프로토콜을 사용하는 다른 전달 규칙은 동일한 공유 IP 주소를 사용할 수 없습니다.
UDP 프로토콜을 사용하여 각 전달 규칙에 고유한 UDP 포트 50개를 만듭니다.
전달 규칙이 UDP 프로토콜과 모든 포트를 사용하도록 구성된 경우 UDP 프로토콜을 사용하는 다른 전달 규칙은 동일한 공유 IP 주소를 사용할 수 없습니다.
TCP 또는 UDP 프로토콜을 사용하여 각 전달 규칙에 TCP 및 UDP 포트의 고유한 조합 50개를 만듭니다.
공통 백엔드 서비스(단일 부하 분산기) 또는 여러 백엔드 서비스(동일한 IP 주소를 공유하는 여러 부하 분산기)를 참조합니다.
L3_DEFAULT 프로토콜로 전달 규칙을 구성할 때 모든 포트를 사용합니다. IP 주소 하나에 L3_DEFAULT 전달 규칙이 하나만 있을 수 있으며, 필요한 경우 다른 TCP 및 UDP 전달 규칙과 공유할 수 있습니다.
전달 규칙에 여러 프로토콜이 있으면 두 개의 다른 백엔드 서비스도 있어야 합니다. 단일 내부 패스 스루 네트워크 부하 분산기는 이러한 프로토콜 중 하나만 사용하는 단일 백엔드 서비스를 사용하므로 TCP 또는 UDP 트래픽 중 하나만 작동합니다.
전달 규칙의 결정 행렬
다음 표를 사용하여 배포를 설계합니다.
단일 내부 패스 스루 네트워크 부하 분산기
단일 백엔드 서비스는 TCP 또는 UDP 중 하나만을 지원합니다.
전달 규칙이 여러 개 필요한 경우 ⌈total number of ports / 5⌉ 수식을 사용하여 필요한 전달 규칙 수를 계산합니다. 여기서 ⌈⌉는 Ceiling(최소 정수) 함수이며 가장 가까운 정수로 반올림을 의미합니다.
예를 들어 부하 분산기의 한 IP 주소에 26개의 TCP 포트가 필요하다고 가정해 보겠습니다. --ports=ALL을 사용하여 단일 전달 규칙을 만들지 않는 경우 26 / 5 = 5 with a remainder of 1이기 때문에 6개의 전달 규칙을 만들어야 합니다.
의도된 프런트엔드 구성
필요한 전달 규칙 수
IP 주소에 --purpose=SHARED_LOADBALANCER_VIP 플래그 필요
전달 규칙 포트 사양
하나의 IP 주소, 모든 포트에 대한 트래픽
하나의 전달 규칙
아니요
--ports=ALL
하나의 IP 주소, 특정 포트에 대한 트래픽
5개 이하의 포트: 하나의 전달 규칙
6개 이상의 포트: 여러 전달 규칙
5개 이하의 포트인 경우: 아니요
6개 이상의 포트인 경우: 예
--ports를 최대 5개의 연속 또는 비연속 포트 번호 집합으로 설정합니다.
여러 IP 주소, 모든 포트에 대한 트래픽
IP 주소당 전달 규칙 1개
아니요
--ports=ALL
여러 IP 주소, 특정 포트에 대한 트래픽
IP 주소당 전달 규칙 하나 이상
IP 주소당 포트를 5개 이하로 사용하는 경우: 아니요
IP 주소당 포트를 6개 이상 사용하는 경우: 예
--ports를 최대 5개의 연속 또는 비연속 포트 번호 집합으로 설정합니다.
내부 패스 스루 네트워크 부하 분산기 2개
두 개의 내부 패스 스루 네트워크 부하 분산기가 있으면 두 개의 백엔드 서비스가 있을 수 있습니다. 한 백엔드는 TCP 트래픽용이고 다른 백엔드 서비스는 UDP 트래픽용입니다.
전달 규칙이 여러 개 필요한 경우 다음 수식을 사용하여 필요한 전달 규칙 수를 계산합니다. 여기서 ⌈⌉는 Ceiling(최소 정수) 함수이며 가장 가까운 정수로의 반올림을 의미합니다.
⌈total number of TCP ports / 5⌉
⌈total number of UDP ports / 5⌉
예를 들어 TCP 포트 26개와 UDP 포트 12개가 필요하다고 가정해 보겠습니다.
9개의 전달 규칙을 만들어야 합니다.
26 / 5 = 5 with a remainder of 1이므로 TCP 포트에 6개의 전달 규칙이 필요합니다.
12 / 5 = 2 with a remainder of 2이므로 UDP 포트에 3개의 전달 규칙이 필요합니다.
의도된 프런트엔드 구성
필요한 전달 규칙 수
IP 주소에 --purpose=SHARED_LOADBALANCER_VIP 플래그 필요
전달 규칙 포트 사양
하나의 IP 주소, 모든 포트에 대한 트래픽
전달 규칙 2개(TCP용 1개, UDP용 1개)
예(TCP 전달 규칙과 UDP 전달 규칙은 하나의 IP 주소를 공유해야 하기 때문)
--ports=ALL
하나의 IP 주소, 특정 포트에 대한 트래픽
5개 이하의 TCP 포트와 5개 이하의 UDP 포트: 전달 규칙 2개(TCP용 1개, UDP용 1개)
6개 이상의 TCP 포트 또는 UDP 포트: 각 전달 규칙이 1개의 프로토콜과 5개 이하의 포트를 지원하는 여러 개의 전달 규칙
예
--ports를 최대 5개의 연속 또는 비연속 포트 번호 집합으로 설정합니다.
여러 IP 주소, 모든 포트에 대한 트래픽, TCP 또는 UDP
2개 이상의 전달 규칙(1개의 IP 주소를 사용하는 TCP용 1개, 다른 IP 주소를 사용하는 UDP용 1개)
IP 주소가 3개 이상 필요한 경우 3개 이상의 전달 규칙
아니요
--ports=ALL
여러 IP 주소, 특정 포트에 대한 트래픽, TCP 또는 UDP
2개 이상의 전달 규칙(1개의 IP 주소를 사용하는 TCP용 1개, 다른 IP 주소를 사용하는 UDP용 1개)
다음 중 하나가 필요한 경우 3개 이상의 전달 규칙:
3개 이상의 IP 주소
1개의 IP 주소에 대한 TCP 트래픽의 포트 6개 이상, 1개의 IP 주소에 대한 UDP 트래픽의 포트 6개 이상
5개 이하의 TCP 포트에 IP 주소 1개, 5개 이하의 UDP 포트에 IP 주소 1개인 경우: 아니요
6개 이상의 TCP 포트 또는 UDP 포트인 경우: 예
--ports를 최대 5개의 연속 또는 비연속 포트 번호 집합으로 설정합니다.
제한사항
IP 주소와 프로토콜이 동일한 전달 규칙 2개 이상에서는 포트가 겹칠 수 없습니다. 예를 들면 다음과 같습니다.
프로토콜 TCP 및 포트 80을 사용하여 전달 규칙을 구성할 때 다른 전달 규칙에서 해당 프로토콜과 포트를 제공하도록 구성할 수 없습니다. 예를 들어 TCP 포트 80, 81, 90을 제공하는 다른 전달 규칙을 만들 수 없습니다.
TCP 및 포트 80, 8080, 90에 전달 규칙을 구성할 때 모든 포트를 사용하는 TCP에 다른 전달 규칙을 구성할 수 없습니다.
전달 규칙 2개 이상에서 --purpose=SHARED_LOADBALANCER_VIP 플래그를 사용하여 같은 IP 주소를 공유하는 경우 프로토콜 1개만 L3_DEFAULT로 설정될 수 있습니다.
사용 사례
여러 가지 유형의 배포가 가능합니다. 다음 예시에서는 2개의 부하 분산기에 대해 특정 포트에서 트래픽을 허용하는 IP 주소 하나를 사용합니다.
예 1
이 예시에서는 다음 매개변수가 포함된 여러 전달 규칙을 사용합니다.
동일한 IP 주소(10.1.1.1)
다른 프로토콜
각 전달 규칙이 가리키는 별도의 백엔드 서비스
일치하는 프로토콜: 각 백엔드 서비스의 프로토콜이 해당 전달 규칙의 프로토콜과 일치함
다른 전달 규칙, 동일한 IP 주소, 다른 프로토콜 및 포트(확대하려면 클릭)
예 2
이 예시에서는 다음 매개변수가 포함된 여러 전달 규칙을 사용합니다.
동일한 IPv4 주소(10.1.1.1)
동일한 프로토콜
각 전달 규칙의 번호가 지정된 다른 포트 집합
다른 전달 규칙, 동일한 IP 주소, 동일한 프로토콜, 6개 이상의 번호가 지정된 포트(확대하려면 클릭)
구성 단계
다음 두 가지를 모두 수행하면 IP 주소가 동일한 여러 개의 내부 전달 규칙을 만들 수 있습니다.
[[["이해하기 쉬움","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-04(UTC)"],[],[],null,["# Internal passthrough Network Load Balancer forwarding rules that use a common IP address\n\nInternal passthrough Network Load Balancers are regional load balancers that enable\nyou to run and scale your services behind an internal IP address\nthat is accessible only to your internal virtual machine (VM) instances.\n\nThis page discusses using multiple forwarding rules with\nthe same IP address. For general information about internal passthrough Network Load Balancers, see the\n[Internal passthrough Network Load Balancer overview](/load-balancing/docs/internal).\n\nUsing internal forwarding rules, you can use a shared internal IP address across\nup to ten forwarding rules. To share an IP address, you set the purpose of the\nIP address to `SHARED_LOADBALANCER_VIP`. You can use `TCP`or `UDP` for the\nforwarding rule protocol and assign up to five ports to the forwarding rule, or\nspecify `--ports=ALL` to use all ports. If you want to use the `L3_DEFAULT`\nprotocol, you must use all ports with the `--ports=ALL` option.\n\nWith unique combinations of protocol and ports, you can do the following:\n\n- Create 50 unique TCP ports with each forwarding rule using the `TCP`\n protocol.\n\n If a forwarding rule is configured to use the `TCP` protocol and all ports, no\n other forwarding rule using the `TCP` protocol can use the same shared IP\n address.\n- Create 50 unique UDP ports with each forwarding rule using the `UDP`\n protocol.\n\n If a forwarding rule is configured to use the `UDP` protocol and all ports, no\n other forwarding rule using the `UDP` protocol can use the same shared IP\n address.\n- Create 50 unique combinations of TCP and UDP ports, with each forwarding\n rule using either the `TCP` or `UDP` protocol.\n\n- Reference a common backend service (a single load balancer) or multiple\n backend services (multiple load balancers that share the same IP address).\n\n- Use all ports when configuring a forwarding rule with the `L3_DEFAULT`\n protocol. There can be only one `L3_DEFAULT` forwarding rule for an IP\n address, which can be shared with other TCP and UDP forwarding rules, if\n necessary.\n\nWhen your forwarding rules have different protocols, you must have two different\nbackend services as well. A single internal passthrough Network Load Balancer works for either TCP or\nUDP traffic---not both---because it has a single backend service that uses only\none of these protocols.\n\nDecision matrices for forwarding rules\n--------------------------------------\n\nUse the following tables to design your deployment.\n\n### Single internal passthrough Network Load Balancer\n\nA single backend service supports TCP or UDP, not both.\n\nWhen you need multiple forwarding rules, calculate the number of forwarding\nrules that you need by using the formula\n`⌈total number of ports / 5⌉`, where `⌈⌉` is the\nceiling (least integer) function, and means *round up* to the nearest\nwhole number.\n\nFor example, suppose you need 26 TCP ports on one IP address of your load\nbalancer. If you don't want to create a single forwarding rule by using\n`--ports=ALL`, you must create six forwarding rules because `26 / 5 = 5 with a remainder of 1`.\n\n### Two internal passthrough Network Load Balancers\n\nWhen you have two internal passthrough Network Load Balancers, you can have two backend services, where\none backend service is for TCP traffic, and the other backend service is for UDP\ntraffic.\n\nWhen you need multiple forwarding rules, calculate the number of forwarding\nrules that you need by using the following formula, where\n`⌈⌉` is the ceiling (least integer) function, and means *round up*\nto the nearest whole number: \n\n```\n ⌈total number of TCP ports / 5⌉\n\n ⌈total number of UDP ports / 5⌉\n```\n\nFor example, suppose you need 26 TCP ports and 12 UDP ports.\nYou must create nine forwarding rules:\n\n- `26 / 5 = 5 with a remainder of 1`, so you need six forwarding rules for your TCP ports.\n- `12 / 5 = 2 with a remainder of 2`, so you need three forwarding rules for your UDP ports.\n\n| **Note:** You cannot share a static internal IPv6 address across multiple forwarding rules.\n\n#### Limitations\n\n- Two or more forwarding rules with the same IP address and protocol cannot have overlapping ports. For example:\n - When you configure the forwarding rule with protocol TCP and port `80`, you cannot configure another forwarding rule to serve that protocol and port. For example, you cannot create another forwarding rule to serve TCP ports `80`, `81`, and `90`.\n - When you configure the forwarding rule for TCP and ports `80`, `8080`, and `90`, you cannot configure another forwarding rule for TCP that would use all ports.\n- When two or more forwarding rules share the same IP address by using the `--purpose=SHARED_LOADBALANCER_VIP` flag, at most only one of them can have the protocol set to `L3_DEFAULT`.\n\nUse cases\n---------\n\nMany different types of deployments are possible. The following\nexamples use one IP address that accepts traffic on specific ports for two\nload balancers.\n\n### Example 1\n\nThis example uses different forwarding rules with the following parameters:\n\n- The same IP address (`10.1.1.1`)\n- Different protocols\n- Separate backend services that each forwarding rule points to\n- Matching protocols: the protocol of each backend service matches the protocol of the corresponding forwarding rule\n\n[](/static/load-balancing/images/ilb-fwd-rules-same-ip-different-protocols.svg) Different forwarding rules, same IP address, different protocols and ports (click to enlarge).\n\n### Example 2\n\nThis example uses different forwarding rules with the following parameters:\n\n- The same IPv4 address (`10.1.1.1`)\n- The same protocol\n- A different set of numbered ports on each forwarding rule\n\n| **Notes:**\n|\n| - This configuration option is an alternative to creating a single forwarding rule that specifies all ports.\n| - You cannot share a static internal IPv6 address across multiple forwarding rules.\n[](/static/load-balancing/images/ilb-fwd-rules-same-ip-different-ports.svg) Different forwarding rules, same IP address, same protocol, more than five numbered ports (click to enlarge).\n\nConfiguration steps\n-------------------\n\nYou can create multiple internal forwarding rules that have the same IP address\nif you do both of the following:\n\n1. [Create a static (reserved) internal IP address](/vpc/docs/reserve-static-internal-ip-address) for the forwarding rules to use.\n2. Set the [`--purpose` flag](/sdk/gcloud/reference/compute/addresses/create#--purpose) on the shared internal IP address to the value `SHARED_LOADBALANCER_VIP`.\n\nFor an example setup, see\n[Accepting traffic on multiple ports using two forwarding rules](/load-balancing/docs/internal/setting-up-internal#multiple-ports-two-fwd-rules)."]]