이 페이지에서는 Google Cloud 방화벽 규칙 및 피어 네트워크 방화벽 규칙 구성을 위한 안내를 제공합니다.
피어 네트워크에 연결하도록 Cloud VPN 터널을 구성할 때 Google Cloud 및 피어 네트워크의 방화벽 규칙을 검토하고 요구사항에 맞게 수정합니다. 피어 네트워크가 다른 Virtual Private Cloud (VPC) 네트워크인 경우 Google Cloud 네트워크 연결의 양측에 대해 방화벽 규칙을 구성합니다.
Google Cloud 방화벽 규칙은 VPC 네트워크 내에서 Cloud VPN 터널을 통해 가상 머신(VM) 인스턴스 간에 전송된 패킷에 적용됩니다.
묵시적인 이그레스 허용 규칙은 Google Cloud 네트워크에 있는 VM 인스턴스 및 기타 리소스가 송신 요청을 수행하고 설정된 응답을 수신할 수 있게 합니다. 하지만 묵시적인 인그레스 거부 규칙은 Google Cloud 리소스에 대해 모든 수신 트래픽을 차단합니다.
최소한 피어 네트워크에서 Google Cloud로의 인그레스 트래픽을 허용하도록 방화벽 규칙을 만드세요. 특정 유형의 트래픽을 거부하도록 이그레스 규칙을 만든 경우 다른 이그레스 규칙도 만들어야 할 수 있습니다.
UDP 500, UDP 4500, ESP(IPsec, IP 프로토콜 50) 프로토콜을 포함하는 트래픽은 Cloud VPN 게이트웨이에서 하나 이상의 외부 IP 주소 간에 항상 허용됩니다. 하지만 Cloud VPN 게이트웨이에서 피어 VPN 게이트웨이로 전송되는 캡슐화 후 IPsec 패킷에는 Google Cloud 방화벽 규칙이 적용되지 않습니다.
방화벽 규칙에 대한 자세한 내용은 Google Cloud VPC 방화벽 규칙 개요를 참고하세요.
구성 예시
인그레스 또는 이그레스 트래픽을 제한하는 여러 예시는 VPC 문서의 구성 예시를 참조하세요.
다음 예시에서는 인그레스 허용 방화벽 규칙을 만듭니다. 이 규칙은 피어 네트워크의 CIDR에서 VPC 네트워크의 VM으로 들어오는 모든 TCP, UDP, ICMP 트래픽을 허용합니다.
이 작업에 필요한 권한
이 작업을 수행하려면 다음과 같은 권한 또는 다음과 같은 IAM 역할을 부여받아야 합니다.
VPN 게이트웨이 섹션에서 VPC 네트워크의 이름을 클릭합니다. 그러면 터널이 포함된 VPC 네트워크 세부정보 페이지가 표시됩니다.
방화벽 규칙 탭을 클릭합니다.
방화벽 규칙 추가를 클릭합니다. TCP, UDP, ICMP에 대한 규칙을 추가합니다.
이름:allow-tcp-udp-icmp를 입력합니다.
소스 필터:IPv4 범위를 선택합니다.
소스 IP 범위: 터널을 만든 시점의 원격 네트워크 IP 범위 값을 입력합니다. 피어 네트워크 범위가 1개 이상인 경우 각각을 입력합니다. 항목 사이에는 Tab 키를 누릅니다.
피어 네트워크의 모든 소스 IPv4 주소에서 오는 트래픽을 허용하려면 0.0.0.0/0을 지정합니다.
지정된 프로토콜 또는 포트:tcp 및 udp를 선택합니다.
기타 프로토콜:icmp를 입력합니다.
대상 태그: 모든 유효한 태그를 추가합니다.
만들기를 클릭합니다.
피어 네트워크에서 VPC 네트워크의 IPv6 주소에 대한 액세스를 허용해야 하는 경우 allow-ipv6-tcp-udp-icmpv6 방화벽 규칙을 추가합니다.
방화벽 규칙 추가를 클릭합니다. TCP, UDP, ICMPv6에 대한 규칙을 추가합니다.
이름:allow-ipv6-tcp-udp-icmpv6를 입력합니다.
소스 필터:IPv6 범위를 선택합니다.
소스 IP 범위: 터널을 만든 시점의 원격 네트워크 IP 범위 값을 입력합니다. 피어 네트워크 범위가 1개 이상인 경우 각각을 입력합니다. 항목 사이에는 Tab 키를 누릅니다.
피어 네트워크의 모든 소스 IPv6 주소에서 오는 트래픽을 허용하려면 ::/0을 지정합니다.
PEER_SOURCE_RANGE를 피어 네트워크의 소스 IPv6 범위로 바꿉니다.
피어 네트워크 범위가 한 개를 초과할 경우 소스 범위 필드에 쉼표로 구분된 목록을 입력합니다(--source-ranges 2001:db8:aa::/64,2001:db8:bb::/64).
피어 네트워크의 모든 소스 IPv6 주소에서 오는 트래픽을 허용하려면 ::/0을 지정합니다.
기타 방화벽 규칙
필요에 따라 다른 방화벽 규칙을 만듭니다.
firewall-rules 명령어에 대한 자세한 내용은 gcloud 방화벽 규칙 문서를 참조하세요.
피어 방화벽 규칙
피어 방화벽 규칙을 구성할 때 다음 사항을 고려하세요.
VPC 네트워크의 서브넷에서 사용하는 IP 범위를 오가는 이그레스 및 인그레스 트래픽을 허용하는 규칙을 구성합니다.
모든 프로토콜 및 포트를 허용하도록 선택하거나, 요구 사항을 충족하는 프로토콜 및 포트의 필수 집합으로만 트래픽을 제한할 수 있습니다.
Google Cloud에서 피어 시스템 및 인스턴스 또는 리소스 간 통신을 위해 ping을 사용해야 하는 경우 ICMP 트래픽을 허용합니다.
ping을 사용하여 피어 네트워크에서 IPv6 주소에 액세스해야 하는 경우 피어 방화벽에서 ICMPv6(IP 프로토콜 58)를 허용합니다.
네트워크 기기(보안 어플라이언스, 방화벽 기기, 스위치, 라우터, 게이트웨이)와 시스템에서 실행되는 소프트웨어(예: 운영체제에 포함된 방화벽 소프트웨어) 모두 온프레미스 방화벽 규칙을 구현할 수 있습니다. 트래픽을 허용하려면 VPC 네트워크 경로에서 모든 방화벽 규칙을 적절하게 구성합니다.
VPN 터널에 동적(BGP) 라우팅이 사용되는 경우, 링크-로컬 IP 주소에 대해 BGP 트래픽이 허용되는지 확인합니다. 자세한 내용은 다음 섹션을 참조하세요.
피어 게이트웨이에 대한 BGP 고려사항
동적(BGP) 라우팅은 TCP 포트 179를 사용하여 경로 정보를 교환합니다. Cloud VPN 게이트웨이를 비롯한 일부 VPN 게이트웨이는 개발자가 동적 라우팅을 선택할 때 이 트래픽을 자동으로 허용합니다. 피어 VPN 게이트웨이가 허용하지 않는 경우 TCP 포트 179에서 들어오는 트래픽과 나가는 트래픽을 허용하도록 구성합니다. 모든 BGP IP 주소는 링크-로컬 169.254.0.0/16 CIDR 블록을 사용합니다.
피어 VPN 게이트웨이가 인터넷에 직접 연결되어 있지 않으면, 이 게이트웨이와 피어 라우터, 방화벽 규칙, 보안 어플라이언스가 최소한 BGP 트래픽(TCP 포트 179) 및 ICMP 트래픽을 VPN 게이트웨이로 전달하도록 구성되어 있는지 확인합니다. ICMP는 필수가 아니지만, Cloud Router와 VPN 게이트웨이 사이의 연결을 테스트하는 데 유용합니다. 피어 방화벽 규칙을 적용할 IP 주소 범위에는 Cloud Router 및 게이트웨이의 BGP IP 주소가 포함되어야 합니다.
다음 단계
구성요소가 Cloud VPN과 올바르게 통신하는지 확인하려면 VPN 상태 확인을 참조하세요.
고가용성 및 높은 처리량 시나리오 또는 다중 서브넷 시나리오를 사용하려면 고급 구성을 참조하세요.
Cloud VPN을 사용할 때 발생할 수 있는 일반적인 문제를 해결하려면 문제 해결 참조하기
[[["이해하기 쉬움","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,["# Configure firewall rules\n\nThis page provides guidance for configuring Google Cloud firewall\nrules and your peer network firewall rules.\n\nWhen you configure Cloud VPN tunnels to connect to your peer network,\nreview and modify firewall rules in your Google Cloud and peer networks\nto make sure that they meet your needs. If your peer network is another\nVirtual Private Cloud (VPC) network, then configure Google Cloud firewall\nrules for both sides of the network connection.\n| **Note:** If your Cloud VPN tunnel uses [dynamic (BGP) routing](/network-connectivity/docs/vpn/concepts/choosing-networks-routing#dynamic-routing), make sure that your on-premises network and VPN gateway [allow BGP traffic](#dynamic-rules) so that route information can be exchanged.\n\nFor more information about Cloud VPN, see the following resources:\n\n- For best practices to consider before setting up Cloud VPN, see\n [Best practices](/network-connectivity/docs/vpn/concepts/best-practices).\n\n- For more information about Cloud VPN, see the\n [Cloud VPN overview](/network-connectivity/docs/vpn/concepts/overview).\n\n- For definitions of terms used on this page, see\n [Key terms](/network-connectivity/docs/vpn/concepts/key-terms).\n\nGoogle Cloud firewall rules\n---------------------------\n\nGoogle Cloud firewall rules apply to packets sent to and\nfrom virtual machine (VM) instances within your VPC network\nand through Cloud VPN tunnels.\n\nThe [implied allow egress](/vpc/docs/firewalls#default_firewall_rules) rules\nallow VM instances and other resources in your Google Cloud network to\nmake outgoing requests and receive established responses. However, the\n[implied deny ingress](/vpc/docs/firewalls#default_firewall_rules) rule blocks\nall incoming traffic to your Google Cloud resources.\n\nAt a minimum, create firewall rules to allow ingress traffic from\nyour peer network to Google Cloud. If you created egress rules to\n*deny* certain types of traffic, you might also need to create other egress\nrules.\n\nTraffic containing the protocols UDP 500, UDP 4500, and ESP\n(IPsec, IP protocol 50) is always allowed to and from one or more external IP\naddresses on a Cloud VPN gateway. However, Google Cloud firewall\nrules do *not* apply to the\n[post-encapsulated IPsec packets](https://wikipedia.org/wiki/IP_in_IP)\nthat are sent from a Cloud VPN gateway to a peer VPN gateway.\n\nFor more information about Google Cloud firewall rules, see the\n[VPC firewall rules overview](/vpc/docs/firewalls).\n\n### Example configurations\n\nFor multiple examples of restricting ingress or egress traffic, see the\n[configuration examples](/vpc/docs/using-firewalls#configuration_examples)\nin the VPC documentation.\n\nThe following example creates an *ingress allow* firewall rule. This rule\npermits all TCP, UDP, and ICMP traffic from your peer network's CIDR to your\nVMs in your VPC network.\n\n#### Permissions required for this task\n\nTo perform this task, you must have been granted the following permissions\n*or* the following IAM roles.\n\n**Roles**\n\n- [`roles/compute.securityAdmin`](/compute/docs/access/iam#compute.securityAdmin) \n\n### Console\n\n1. In the Google Cloud console, go to the **VPN tunnels** page.\n\n [Go to VPN tunnels](https://console.cloud.google.com/vpn/list?tab=tunnels)\n2. Click the VPN tunnel that you want to use.\n\n3. In the **VPN gateway** section, click the name of the VPC\n network. This action directs you to the **VPC network details** page that\n contains the tunnel.\n\n4. Click the **Firewall rules** tab.\n\n5. Click **Add firewall rule**. Add a rule for TCP, UDP, and ICMP:\n\n - **Name:** Enter `allow-tcp-udp-icmp`.\n - **Source filter:** Select **IPv4 ranges**.\n - **Source IP ranges:** Enter a **Remote network IP range** value from when you created the tunnel. If you have more than one peer network range, enter each one. Press the **Tab** key between entries. To allow traffic from all source IPv4 addresses in your peer network, specify `0.0.0.0/0`.\n - **Specified protocols or ports:** Select `tcp` and `udp`.\n - **Other protocols:** Enter `icmp`.\n - **Target tags:** Add any valid tag or tags.\n6. Click **Create**.\n\nIf you need to allow access to IPv6 addresses on your VPC network from your peer network, add an `allow-ipv6-tcp-udp-icmpv6` firewall rule.\n\n1. Click **Add firewall rule** . Add a rule for TCP, UDP, and ICMPv6:\n - **Name:** Enter `allow-ipv6-tcp-udp-icmpv6`.\n - **Source filter:** Select **IPv6 ranges**.\n - **Source IP ranges:** Enter a **Remote network IP range** value from when you created the tunnel. If you have more than one peer network range, enter each one. Press the **Tab** key between entries. To allow traffic from all source IPv6 addresses in your peer network, specify `::/0`.\n - **Specified protocols or ports:** Select `tcp` and `udp`.\n - **Other protocols** : Enter `58`. 58 is the protocol number for ICMPv6.\n - **Target tags:** Add any valid tag or tags.\n2. Click **Create**.\n\nCreate other firewall rules if necessary.\n\nAlternatively, you can create rules from the Google Cloud console\n**Firewall** page.\n\n### gcloud\n\nRun the following command: \n\n```\ngcloud compute --project PROJECT_ID firewall-rules create allow-tcp-udp-icmp \\\n --network NETWORK \\\n --allow tcp,udp,icmp \\\n --source-ranges IPV4_PEER_SOURCE_RANGE\n```\n\nReplace \u003cvar translate=\"no\"\u003eIPV4_PEER_SOURCE_RANGE\u003c/var\u003e with source IPv4 ranges from your peer network.\n\nIf you have more than one peer network range, provide a comma-separated\nlist in the source-ranges field\n(`--source-ranges 192.168.1.0/24,192.168.2.0/24`).\n\nTo allow traffic from all source IPv4 addresses in your peer network, specify `0.0.0.0/0`.\n\n**IPv6 firewall rules**\n\nIf you need to allow access to IPv6 addresses on your VPC network from your peer network, add an `allow-ipv6-tcp-udp-icmpv6` firewall rule. \n\n```\ngcloud compute --project PROJECT_ID firewall-rules create allow-ipv6-tcp-udp-icmpv6 \\\n --network NETWORK \\\n --allow tcp,udp,58 \\\n --source-ranges IPV6_PEER_SOURCE_RANGE\n```\n\n58 is the protocol number for ICMPv6.\n\nReplace \u003cvar translate=\"no\"\u003ePEER_SOURCE_RANGE\u003c/var\u003e with source IPv6 ranges from your peer network.\nIf you have more than one peer network range, provide a comma-separated\nlist in the source-ranges field\n(`--source-ranges 2001:db8:aa::/64,2001:db8:bb::/64`).\n\nTo allow traffic from all source IPv6 addresses in your peer network, specify `::/0`.\n\n**Other firewall rules**\n\nCreate other firewall rules if necessary.\n\nFor more information about the `firewall-rules` command, see the\n[`gcloud` firewall rules](/sdk/gcloud/reference/compute/firewall-rules)\ndocumentation.\n\nPeer firewall rules\n-------------------\n\nWhen configuring your peer firewall rules, consider the following:\n\n- Configure rules to allow egress and ingress traffic to and from the IP ranges used by the subnets in your VPC network.\n- You can choose to permit all protocols and ports, or you can restrict traffic to only the necessary set of protocols and ports to meet your needs.\n- Allow ICMP traffic if you need to use `ping` to be able to communicate among peer systems and instances or resources in Google Cloud.\n- If you need to access IPv6 addresses on your peer network with `ping`, allow ICMPv6 (IP protocol 58) in your peer firewall.\n- Both your network devices (security appliances, firewall devices, switches, routers, and gateways) and software running on your systems (such as firewall software included with an operating system) can implement on-premises firewall rules. To allow traffic, configure all firewall rules in the path to your VPC network appropriately.\n- If your VPN tunnel uses dynamic (BGP) routing, make sure that you allow BGP traffic for the link-local IP addresses. For more details, see the next section.\n\n### BGP considerations for peer gateways\n\nDynamic (BGP) routing exchanges route information by using TCP port 179. Some VPN\ngateways, including Cloud VPN gateways, allow this traffic automatically\nwhen you choose dynamic routing. If your peer VPN gateway does not,\nconfigure it to allow incoming and outgoing traffic on TCP port 179. All BGP\nIP addresses use the link-local `169.254.0.0/16` CIDR block.\n\nIf your peer VPN gateway is not directly connected to the internet, make\nsure that it and peer routers, firewall rules, and security appliances are\nconfigured to at least pass BGP traffic (TCP port 179) and ICMP traffic to your\nVPN gateway. ICMP is not required, but it is useful to test connectivity between\na Cloud Router and your VPN gateway. The range of IP addresses to which\nyour peer firewall rule should apply must include the BGP IP addresses of the\nCloud Router and your gateway.\n\nWhat's next\n-----------\n\n- To make sure components are communicating correctly with Cloud VPN, see [Check VPN status](/network-connectivity/docs/vpn/how-to/checking-vpn-status).\n- To use high-availability and high-throughput scenarios or multiple subnet scenarios, see [Advanced configurations](/network-connectivity/docs/vpn/concepts/advanced).\n- To help you solve common issues that you might encounter when using Cloud VPN, see [Troubleshooting](/network-connectivity/docs/vpn/support/troubleshooting)."]]