Hi Team,
Facing issue while connecting to OnPrem VPN to GCP Cloud SQL. Cloud SQL PostgreSQL instance having both Pubilc IP and Private IP enabled.
Enabled private service access and private path connectivity on cloud sql instance. created a VPN Gateway and VPN Tunnel in Cloud to connect OnPrem.
I am able to connect on Public IP from my On Prem Machine however not able to connect on my Private IP.
Any one, suggest any further network/ DB related changes I have to do.
Unable to connect on your Private IP.
There are a few things that could be preventing you from connecting to your Cloud SQL PostgreSQL instance on its private IP address from your on-premises network via your Cloud VPN tunnel:
On-Premises Network Configuration:
ip route get <private_ip_address_of_your_cloud_sql_instance>
ip route get
command is specific to Linux-based systems. If you are using a different operating system, please consult the documentation for your operating system on how to verify routing table entries.Cloud VPN Tunnel Configuration:
Cloud SQL Instance Configuration:
Additional Points:
If you have verified that all of the above are configured correctly and you are still having trouble connecting to your Cloud SQL instance on its private IP address from your on-premises network via your Cloud VPN tunnel, please contact Google Cloud support for assistance.
Thanks for your inputs.
While Creating Cloud SQL Db, i am assigning static IP using terraform. But while after executing terraform script, I am getting different private IP of Cloud SQL Instance.
Also, Verify that your Cloud SQL instance's firewall rules allow connections from your on-premises network. --- for this , which kind of firewall need to open.
created new instance with another private network in GCP, able to access private
When you create a Cloud SQL instance using Terraform, Google Cloud automatically assigns a private IP address from the allocated IP range within your VPC when you enable a private IP. You cannot assign a static private IP address to a Cloud SQL instance; this is managed by Google Cloud.
To allow connections to your Cloud SQL instance from your on-premises network, you need to ensure that your Cloud SQL instance is configured to accept connections from the IP ranges of your on-premises network. This is done within the Cloud SQL instance's settings, not through traditional firewall rules.
If you are able to access your Cloud SQL instance from another private network in GCP, it suggests that the networking within GCP is correctly configured, possibly with VPC peering. To access your Cloud SQL instance from an on-premises network, you will need to set up a VPN tunnel or use Cloud Interconnect to route traffic from your on-premises network to your VPC network in GCP.
I will work accordingly and update you