Cloud Router를 사용하면 중간 VPC를 통과하는 두 네트워크 간의 커스텀 공지 경로를 구성하여 여러 VPC를 Cloud SQL 인스턴스에 연결할 수 있습니다. VPC 2개를 가상 사설망(VPN), Cloud Interconnect 또는 다른 Cloud Router 지원 네트워크를 사용하여 연결해야 합니다.
커스텀 공지 경로를 사용하면 Cloud SQL VPC(VPC C)는 중간 VPC(VPC B)를 사용하여 기본 VPC(VPC A)에 연결됩니다. 다음 방법으로 이러한 네트워크 간에 공유 경로를 구성할 수 있습니다.
Cloud Router를 사용하여 중간 VPC를 통과하는 두 네트워크 간의 경로를 수동으로 공지할 수 있습니다. 경로를 수동으로 공지하도록 Cloud Router를 구성하는 방법에 대한 자세한 내용은 전송 네트워크를 참조하세요.
Cloud Router를 사용하여 여러 VPC를 Cloud SQL 인스턴스에 연결하려면 커스텀 공지 경로를 사용하는 것이 좋습니다.
중간 프록시(SOCKS5)를 사용하여 연결
클라이언트와 Cloud SQL 인스턴스 사이의 기본 VPC에 Cloud SQL 인증 프록시와 함께 중간 VPC에 SOCKS5 프록시와 같은 중간 프록시를 설정할 수 있습니다. 이렇게 하면 중간 노드가 암호화된 트래픽을 Cloud SQL 인증 프록시에서 Cloud SQL 인스턴스로 전달할 수 있습니다.
중간 프록시를 사용하여 여러 VPC에서 Cloud SQL 인스턴스에 연결하려면 다음 단계를 수행합니다.
외부 클라이언트 대신 중간 VPC에 Cloud SQL 인증 프록시를 설치 및 실행하고 연결 풀러라고도 하는 프로토콜 인식 프록시와 페어링하여 보안 연결을 사용 설정할 수 있습니다. 연결 풀러 예시에는 PGbouncer 또는 Pgpool-II(PostgreSQL만 해당)가 있습니다.
이 연결 방법을 사용하면 구성된 SSL을 사용하여 애플리케이션을 풀러에 직접 안전하게 연결할 수 있습니다. 풀러는 Cloud SQL 인증 프록시를 사용하여 데이터베이스 쿼리를 Cloud SQL 인스턴스에 전달합니다.
Private Service Connect를 사용하여 연결
Private Service Connect를 사용하면 서로 다른 프로젝트나 조직에서 여러 VPC 네트워크에 연결할 수 있습니다. Private Service Connect를 사용하여 기본 인스턴스 또는 해당 인스턴스의 모든 읽기 복제본에 연결할 수 있습니다. Private Service Connect에 대한 자세한 내용은 Private Service Connect 개요를 참조하세요.
[[["이해하기 쉬움","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-08-13(UTC)"],[],[],null,["# Connect your instance to multiple VPCs\n\n\u003cbr /\u003e\n\nMySQL \\| [PostgreSQL](/sql/docs/postgres/connect-multiple-vpcs \"View this page for the PostgreSQL database engine\") \\| [SQL Server](/sql/docs/sqlserver/connect-multiple-vpcs \"View this page for the SQL Server database engine\")\n\n\u003cbr /\u003e\n\nThis page describes how to connect to your Cloud SQL instance across\ntransitively peered VPCs.\n\nCloud SQL offers the following ways to connect your Cloud SQL instance\nto multiple VPCs using private IP:\n\n- [Connect using custom advertised routes](#custom-route)\n- [Connect using an intermediate proxy (SOCKS5)](#intermediate-proxy)\n- [Connect using Proxy as a service](#proxy-service)\n- [Connect using Private Service Connect](#connect-psc)\n\nConnect using custom advertised routes\n--------------------------------------\n\nYou can use [Cloud Router](/network-connectivity/docs/router/concepts/overview)\nto configure custom advertised routes between two networks that go through an\nintermediate VPC to connect multiple VPCs to your Cloud SQL instance.\nThe two VPCs must be connected using a\nvirtual private network (VPN), Cloud Interconnect , or any other\n[Cloud Router](/network-connectivity/docs/router/concepts/overview) supported\nnetwork.\n\nWith custom advertised routes, your Cloud SQL VPC, *VPC C* ,\nis connected to your main VPC, *VPC A* , using an intermediate VPC, *VPC B*.\nYou can configure shared routes between these networks in the following ways:\n\n- You can use Cloud Router to manually advertise routes between two\n networks that go through an intermediate VPC. For more information on\n how to configure Cloud Router to manually advertise routes,\n see [Transit network](/vpc/docs/vpc-peering#transit-network).\n\n- You can create two [HA VPN gateways](/network-connectivity/docs/vpn/concepts/topologies#2-gcp-gateways)\n that connect to each other to bridge the two different VPCs and configure\n Cloud Router to share routes between them. For more information on how to\n set up HA VPN gateways, see\n [Create HA VPN gateways to connect VPC networks](/network-connectivity/docs/vpn/how-to/creating-ha-vpn2#creating-ha-gw-2-gw-and-tunnel).\n\nWe recommend using custom advertised routes to connect multiple VPCs\nto your Cloud SQL instance using\n[Cloud Router](/network-connectivity/docs/router/concepts/overview).\n\nConnect using an intermediate proxy (SOCKS5)\n--------------------------------------------\n\nYou can set up an intermediate proxy, such as SOCKS5 proxy,\non an intermediate VPC along with the [Cloud SQL Auth Proxy](/sql/docs/mysql/proxy)\nin your main VPC between the client and your Cloud SQL instance. This\nenables the intermediate node to forward encrypted traffic from the\nCloud SQL Auth Proxy to the Cloud SQL instance.\n\nTo use an intermediary proxy to connect to your Cloud SQL instance from multiple VPCs, follow these steps:\n\n1. On your external client, [install](/sdk/docs/install)[gcloud CLI](/sdk/gcloud).\n\n2. On the intermediary VM, install, configure, and run a SOCKS server. One\n example of this server is [Dante](https://www.inet.no/dante/), a\n popular open source solution.\n\n3. Configure the server to bind to the VM's `ens4` network interface\n for both external and internal connections. For internal connections, specify any\n port.\n\n4. [Configure your VPC's firewall](/vpc/docs/firewalls) to allow TCP\n traffic from the appropriate IP address or range to\n the SOCKS server's configured port.\n\n5. On your external client, [download and install the Cloud SQL Auth Proxy](/sql/docs/mysql/sql-proxy#install).\n\n6. On your external client, [start the Cloud SQL Auth Proxy](/sql/docs/mysql/connect-auth-proxy#start-proxy).\n\n Because you configured your instance to use an internal IP address, when you start the Cloud SQL Auth Proxy, you must provide the `--private-ip` option.\n\n Also, set the `ALL_PROXY` environment variable to the intermediary VM's IP address and specify the port that the SOCKS server uses. For example, `ALL_PROXY=socks5://`\u003cvar translate=\"no\"\u003eVM_IP_ADDRESS\u003c/var\u003e`:`\u003cvar translate=\"no\"\u003eSOCKS_SERVER_PORT\u003c/var\u003e`.`\n | **Note:** The default port for the SOCKS server is `1080`.\n\n If you're connecting from a\n peered VPC, then use the intermediary VM's internal IP address;\n otherwise, use its external IP address.\n7. On your external client, test your connection using [`mysql`](/sql/docs/mysql/connect-admin-ip).\n\nConnect using the Cloud SQL Auth Proxy as a service\n---------------------------------------------------\n\nYou can install and run the Cloud SQL Auth Proxy on your intermediate VPC instead\nof your external client and enable secure connections by pairing it with a\nprotocol-aware proxy, also known as a connection pooler. Examples of connection poolers include\n[PGbouncer](https://www.pgbouncer.org/), or [Pgpool-II](https://pgpool.net/)(PostgreSQL only).\n\nThis connection method allows your applications to securely connect directly to the pooler\nusing a configured SSL. The pooler passes databases queries to your Cloud SQL instance\nusing the Cloud SQL Auth Proxy.\n| **Note:** You'll need to set up your own secure connection. These connections aren't secured by Cloud SQL.\n\nConnect using Private Service Connect\n-------------------------------------\n\n[Private Service Connect](/sql/docs/mysql/about-private-service-connect)\nallows you to connect to multiple VPC networks across different projects\nor organizations. You can use Private Service Connect to connect\nto either a primary instance or any of its read replicas. For more\ninformation about Private Service Connect, see\n[Private Service Connect overview](/sql/docs/mysql/about-private-service-connect).\n\nTo connect across multiple VPCs using Private Service Connect,\nsee [Connect to an instance using Private Service Connect](/sql/docs/mysql/configure-private-service-connect)."]]