정책 기반 경로를 사용하면 패킷의 대상 IP 주소 이상을 기준으로 다음 홉을 선택할 수 있습니다. 프로토콜 및 소스 IP 주소별로 트래픽을 일치시킬 수도 있습니다. 일치하는 트래픽이 내부 패스 스루 네트워크 부하 분산기로 리디렉션됩니다. 이렇게 하면 방화벽과 같은 어플라이언스를 네트워크 트래픽 경로에 삽입할 수 있습니다.
사양
정책 기반 경로를 만들 때 정책 기반 경로가 적용되는 리소스를 선택합니다. 경로는 다음에 적용될 수 있습니다.
경로와 동일한 VPC 네트워크에 있는 모든 VM 인스턴스, Cloud Interconnect VLAN 연결, Cloud VPN 터널
경로와 동일한 VPC 네트워크의 특정 리전에 있는 VLAN 연결만 단일 VLAN 연결 또는 Cloud VPN 터널에만 적용되는 정책 기반 경로는 만들 수 없습니다.
정책 기반 경로의 다음 홉은 유효한 내부 패스 스루 네트워크 부하 분산기여야 합니다. 이 내부 패스 스루 네트워크 부하 분산기는 정책 기반 경로와 동일한 VPC 네트워크 또는 VPC 네트워크 피어링을 통해 경로의 VPC 네트워크에 연결된 VPC 네트워크에 있어야 합니다.
다음 홉 내부 패스 스루 네트워크 부하 분산기의 백엔드 VM 인스턴스에 IP 전달이 사용 설정되어 있어야 합니다.
정책 기반 경로는 서브넷 경로, 정적 경로, 동적 경로보다 먼저 평가되지만 특수 라우팅 경로 이후에 평가됩니다. 자세한 내용은 라우팅 순서의 정책 기반 경로 단계를 참조하세요.
두 개 이상의 정책 기반 경로의 우선순위가 동일하고 패킷의 특성이 이러한 정책 기반 경로 중 두 개 이상과 일치하는 경우 Google Cloud는 내부 알고리즘을 사용하여 단일 정책 기반 경로를 선택합니다. 정책 기반 경로는 가장 긴 접두사 일치를 사용하지 않으므로 선택한 정책 기반 경로는 패킷의 특성과 가장 일치하지 않을 수 있습니다. 동일한 VPC 네트워크의 모든 정책 기반 경로에 고유한 우선순위가 있는지 확인합니다.
정책 기반 경로는 IPv4 또는 IPv6 트래픽에 적용될 수 있습니다.
단방향 트래픽에 대한 단일 규칙 또는 양방향 트래픽을 처리하는 여러 규칙을 만들 수 있습니다.
제한사항
정책 기반 경로는 VPC 네트워크 피어링을 통해 연결된 VPC 네트워크 간에 교환되지 않습니다.
Google Cloud CLI를 사용하거나 API 요청을 전송하여 다른 정책 기반 경로를 건너뛰는 정책 기반 경로를 만들 수 있습니다. gcloud CLI의 경우 --next-hop-other-routes=DEFAULT_ROUTING 플래그를 사용합니다. API 요청의 경우 요청 본문에 "nextHopOtherRoutes": "DEFAULT_ROUTING"을 포함합니다.
이 유형의 정책 기반 경로가 패킷의 특성과 일치하고 다른 일치하는 정책 기반 경로보다 우선순위가 높은 경우 Google Cloud는 다른 정책 기반 경로를 무시하고 VPC 라우팅 순서의 가장 구체적인 대상 위치 단계로 진행합니다.
예를 들어 다음 홉 내부 패스 스루 네트워크 부하 분산기를 사용하는 정책 기반 경로가 있다고 가정해 보겠습니다. 이 정책 기반 경로의 소스 범위는 0.0.0.0/0이고 네트워크 태그는 compute-vm입니다.
패킷 소스가 특정 IP 주소 범위와 일치하는 경우 첫 번째 정책 기반 경로의 평가를 건너뛰려면 다른 정책 기반 경로를 건너뛰도록 구성된 우선순위가 더 높은 정책 기반 경로를 만듭니다. 우선순위가 더 높은 이 정책 기반 경로의 소스 IP 주소 범위를 정책 기반 라우팅을 건너뛰어야 하는 시스템의 소스 IP 주소 범위로 설정합니다.
할당량
단일 프로젝트에서 만들 수 있는 정책 기반 경로 수에는 한도가 있습니다. 자세한 내용은 VPC 문서의 프로젝트별 할당량을 참조하세요.
[[["이해하기 쉬움","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-05(UTC)"],[],[],null,["# Policy-based routes\n===================\n\nThis document provides an overview of Policy-based Routing.\n\nPolicy-based routes let you select a next hop based on more than a packet's\ndestination IP address. You can match traffic by protocol and source IP address\nas well. Matching traffic is redirected to an internal passthrough Network Load Balancer. This can help\nyou insert appliances such as firewalls into the path of network traffic.\n\nSpecifications\n--------------\n\n- When you [create a policy-based\n route](/vpc/docs/use-policy-based-routes#create), you select which resources the policy-based route applies to. The route can apply to:\n - All VM instances, Cloud Interconnect VLAN attachments, and Cloud VPN tunnels that are in the same VPC network as the route\n - Only VM instances that are in the same VPC network as the route and identified by [network\n tags](/vpc/docs/add-remove-network-tags)\n - Only VLAN attachments that are in a specific region of the same VPC network as the route. You can't create a policy-based route that only applies to a single VLAN attachment or Cloud VPN tunnel\n- The next hop of a policy-based route must be a valid [internal passthrough Network Load Balancer](/load-balancing/docs/internal). This internal passthrough Network Load Balancer must either be in the same VPC network as the policy-based route or in a VPC network that is connected to the route's VPC network through [VPC Network Peering](/vpc/docs/vpc-peering).\n- The backend VM instances of the next hop internal passthrough Network Load Balancer must have [IP\n forwarding](/vpc/docs/using-routes#create-vm-canipforward) enabled.\n- Policy-based routes are evaluated before subnet routes, static routes, and dynamic routes, but after [special routing\n paths](/vpc/docs/routes#special_return_paths). For more information, see the [Policy-based routes](/vpc/docs/routes#check-for-pbrs) step in the routing order.\n- If two or more policy-based routes have the same priority, and a packet's characteristics match at least two of those policy-based routes, Google Cloud selects a single policy-based route by using an internal algorithm. The selected policy-based route might not be the most specific match for the packet's characteristics because policy-based routes don't use longest-prefix matching. Make sure that all policy-based routes in the same VPC network have unique priorities.\n- A policy-based route can apply to either IPv4 or IPv6 traffic.\n- You can create a single rule for one-way traffic or multiple rules to handle bidirectional traffic.\n\nLimitations\n-----------\n\n- Policy-based routes are not exchanged between VPC networks that are connected through [VPC Network Peering](/vpc/docs/vpc-peering).\n- Policy-based routes are not exchanged between [Network Connectivity Center spokes and hubs](/network-connectivity/docs/network-connectivity-center/concepts/vpc-spokes-overview).\n- Policy-based routes don't support matching traffic based on port.\n- It is not possible to update a policy-based route after it is created. If you want to update a route, [delete the route](/vpc/docs/use-policy-based-routes#delete) and then create a new one.\n- The internal passthrough Network Load Balancer forwarding rule must have a dedicated IP address that's not used by any other internal passthrough Network Load Balancer. Using a shared IP address (IP address purpose set to `SHARED_LOADBALANCER_VIP`) is not supported.\n- Policy-based routes can interfere with communication between the GKE control plane and nodes. For more information, see [Use policy-based routes with GKE](/vpc/docs/use-policy-based-routes#pbr-with-gke).\n- Policy-based routes can't route packets to Private Service Connect endpoints or backends.\n - For information about using policy-based routes in VPC networks with endpoints or backends that access published services, see [Policy-based routes and Private Service Connect for published services](/vpc/docs/use-policy-based-routes#pbr-with-psc).\n - For information about using policy-based routes in VPC networks with endpoints or backends that access Google APIs and services, see [Policy-based routes and accessing Google APIs and services](/vpc/docs/use-policy-based-routes#pbr-with-pga-psc-apis).\n- Only VLAN attachments that use [Dataplane v2](/network-connectivity/docs/interconnect/concepts/terminology#dataplaneVersion) can use policy-based routes. To inspect your VLAN attachment to check what version it uses, see the instructions for [Dedicated Interconnect](/network-connectivity/docs/interconnect/how-to/dedicated/viewing-vlans#dataplane) or [Partner Interconnect](/network-connectivity/docs/interconnect/how-to/partner/viewing-vlans#dataplane).\n\nSkipping other policy-based routes\n----------------------------------\n\nYou can create a policy-based route that skips other policy-based\nroutes by using the Google Cloud CLI or sending an API request. For the\ngcloud CLI, use the\n`--next-hop-other-routes=DEFAULT_ROUTING` flag. For an API request,\ninclude `\"nextHopOtherRoutes\": \"DEFAULT_ROUTING\"` with the request body.\n\nIf a policy-based\nroute of this type matches a packet's characteristics and has\na higher priority than other matching policy-based routes, Google Cloud\nignores the other policy-based routes and proceeds to the *most specific\ndestination* step of the\n[VPC routing order](/vpc/docs/routes#routeselection).\n\nFor example, consider a policy-based route that uses a next hop\ninternal passthrough Network Load Balancer. This policy-based route has a source\nrange of `0.0.0.0/0` and a network tag of `compute-vm`.\n\nTo skip evaluation of the first policy-based route when packet sources match\na specific IP address range, create a higher-priority policy-based route that\nis configured to skip other policy-based routes. Set the source IP\naddress range for this higher-priority policy-based route to the\nsource IP address range of the systems that need to skip policy-based routing.\n\nQuota\n-----\n\nThere is a limit for how many policy-based routes you can create in a single\nproject. For more information, see the per-project [quotas](/vpc/docs/quota#policy-based-routes-quota)\nin the VPC documentation."]]