목표 : PGA란 Google Cloud에서 Public 대역이 아닌 구글의 대역을 타고 통신을 할 수 있는 서비스입니다.
이는 크게 GCP VPC 내 Subnet에서 동작하는 GCP PGA가 있고, On-premise → GCP 통신시 사용할 수 있는 On-premise to PGA가 있습니다.
GCP PGA는 다음 포스팅에서 설명하도록 하고 이번 문서에서는 On-premise용 PGA 설정을 하기 위해 DNS설정을 변경하는 방안에 대해 알아보겠습니다.

환경
OS : ubuntu 24.10
CPU : Core 1
MEM : 512MB
On-premise 환경
내부 네트워크 대역 : 192.168.1.0/24
VPN Gateway : 192.168.1.80
DNS Server : 192.168.1.70
DNS SW : Bind9
GCP 환경
내부 네트워크 대역 : 192.168.10.0/24
VPN IP : 34.64.61.94
On-premise용 Private Google Access 대역 : 199.36.153.4/30, 199.36.153.8/30
On-premise PGA를 사용하는 방안은 총 3가지가 있습니다.
- VPN을 통해 GCP를 사용할 서버, 클라이언트의 hosts 파일 변조
- 온프레미스 환경에서 private.googleapis.com 또는 restricted.googleapis.com을 사용하여 Google API를 사설 IP(199.36.153.8~11)로 접근하도록 설정을 구성
- On-premise DNS에서 GCP Cloud DNS로 *.googleapis.com에 대해서만 DNS Forward을 사용하기
본 문서에서는 1, 2번방안에 대해 기술하겠습니다.
- hosts파일 수정을 이용한 방법
간단한 테스트시 권장합니다.
유의사항 : /etc/hosts파일은 정적매핑만 지원하므로 와일드카드(*) 지원불가, IP대역 (/30) 설정 지원되지 않습니다.
각각의 서브도메인에 직접 매핑이 필요합니다.
sudo vi /etc/hosts
199.36.153.4 storage.googleapis.com 199.36.153.4 storagetransfer.googleapis.com
-
온프레미스에서 *.googleapis.com 도메인을 private.googleapis.com으로 라우팅하도록 설정
BIND9 설정 파일 구성
- /etc/bind/named.conf.local 파일을 수정해서 googleapis.com 도메인에 대한 전용 DNS 영역을 생성
sudo vi /etc/bind/named.conf.local
다음 내용을 추가zone "private.googleapis.com" { type master; file "/var/cache/bind/db.private.googleapis.com"; }; zone "googleapis.com" { type master; file "/var/cache/bind/db.googleapis.com"; };
-
private.googleapis.com DNS 레코드 생성
/var/cache/bind/db.private.googleapis.com 파일을 생성합니다.sudo nano /var/cache/bind/db.private.googleapis.com
해당 파일에 아래 내용을 입력합니다.$TTL 604800 @ IN SOA ns1.example.com. admin.example.com. ( 3 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS ns1.example.com. private.googleapis.com. IN A 199.36.153.8 private.googleapis.com. IN A 199.36.153.9 private.googleapis.com. IN A 199.36.153.10 private.googleapis.com. IN A 199.36.153.11 private.googleapis.com. IN AAAA 2600:2d00:0002:2000::
-
googleapis.com의 CNAME 설정
/var/cache/bind/db.googleapis.com 파일을 생성합니다.sudo nano /var/cache/bind/db.googleapis.com
해당 파일에 아래 내용을 입력합니다.$TTL 604800 @ IN SOA ns1.example.com. admin.example.com. ( 3 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS ns1.example.com. *.googleapis.com. IN CNAME private.googleapis.com.
-
BIND9 설정 테스트 및 적용
아래의 명령어로 설정한 부분들이 정상적인지 확인합니다.sudo named-checkconf sudo named-checkzone googleapis.com /var/cache/bind/db.googleapis.com sudo named-checkzone private.googleapis.com /var/cache/bind/db.private.googleapis.com
- BIND9 재시작
sudo systemctl restart bind9
- 설정이 정상적으로 적용되었는지 확인
dig storage.googleapis.com @"dns serverIP" nslookup storage.googleapi.com "dns serverIP"
응답이 private.googleapis.com(199.36.153.8~11)으로 나오면 성공적으로 설정이 완료되었습니다.
이제 On-premise에서 Cloud VPN을 통해 GCP의 VM뿐만 아니라 PaaS서비스들( Bigquery, Cloud Storage등)을 사용할 수 있습니다.
'Cloud > GCP' 카테고리의 다른 글
[GCP] Cloud Site to Site VPN을 위한 strongswan(openvpn), Cloud VPN 설정방안 (4) | 2025.02.25 |
---|---|
GCE, GCS, Bigquery Audit Log 확인 (0) | 2025.02.18 |
[GCP] 2단계(MFA) 인증을 조직 단위로 설정하기 (0) | 2025.02.09 |
GCP to AWS HA VPN구성 (0) | 2025.02.03 |
[GCP] No-ORG → ORG(조직 도메인) 이전 (0) | 2025.01.31 |
[GCP] 프로젝트간 VM Image 공유 (0) | 2025.01.10 |
GCP Web console 접근을 위한 X-windows 구성 (0) | 2025.01.09 |