Reputation: 7163
I created two networks in Google Cloud Compute Engine. One called front
using 10.200.166.0/26
and another called back
using 10.200.165.0/26
. I was planning to have my web server in front and my database server in back. But, I can't figure out how to create a route between the two networks. Is this possible? If so, what is the gcloud command?
Upvotes: 2
Views: 4750
Reputation: 530
You need to follow the next steps:
An example of that in terraform: https://github.com/kurkop/terraform-labs/tree/master/vpn2vpn
Upvotes: 0
Reputation: 507
You can use now network peering, which basically allow to pass traffic between the two networks.
Upvotes: 0
Reputation: 11
You can do that by setting up a VPN gateway in each of them and specifying the other one as the destination gateway IP.
Upvotes: 1
Reputation: 1967
In GCE in order to communicate between two networks you need to use the public IP assigned to the instance. You will not be able to communicate between two networks using private IPs. You can find more information on the GCE networks in this article. However, keep in mind that communication through public IP is considered as egress traffic and might be charged depending on the traffic type. You can refer to this article for more information on egress charges.
If you need to create a static IP and route the traffic to that static IP, you can do that using a combination of routes and an instance's --can-ip-forward ability to add an IP address as a static network IP address that will than map to your desired virtual machine instance. You can find more information and the steps in this article.
Upvotes: 4