Classic VPNs are quick and easy to configure, and understanding how they work will help prepare you to set up production-grade HA VPNs. In this short article, we will demonstrate how to create a Classic VPN tunnel from GCP to Anypoint Platform

VPN Setup in GCP

In this first phase, we will set up a classic VPN in GCP. To learn more about Classic VPN, please check the official documentation. For the sake of brevity, this article will cover only the basics regarding the creation of a VPN, starting with our "Create a VPN" screen:

Choose VPC

Next, we choose a VPC to expose via this VPN. In my case, it's gke-vpc with CIDR 10.101.0.0/22. Then we reserve a Static IP for our VPN, as illustrated below.

Tunnel Configuration

Next, we need to configure our tunnels by filling in as much information in the form below as possible:

To finish filling in the form above, we will need some information from the Anypoint Platform. So, let's switch to Anypoint Platform now.

VPN Setup in Anypoint Platform

For the sake of simplicity, I have mapped the information from the Anypoint Platform to the tunnel configuration form as shown in the screenshot below. This will help you understand which information corresponds to each field.

Get Tunnel Configs

The diagram below shows you how to fill in all of the necessary configurations.

Now click CREATE. If everything is correctly filled out, your tunnel will be created.

Testing the Tunnel
At this point, I have done two things:
  1. I have launched a VM in GCP in the defined VPC i.e 10.101.0.0/22. The IP of the VM instance is 10.101.0.10
  2. I have deployed an API in CloudHub in the specified VPC of Anypoint Platform, i.e 10.10.0.0/22. The IP address of the worker is 10.10.3.134.

So now let's test everything by pinging from both sides.

Ping from Worker (Anypoint Platform) to VM (GCP)

To test the configuration, I created a Mule API to run almost all Linux commands available in the worker.

Check out the result below, which shows that I can successfully ping the VM in GCP:

Ping from VM (GCP) to Worker (Anypoint Platform)

And now we need to test it from the VM to Anypoint Platform:

Hurray! It also pinged. So, our tunnel is working perfectly.

Conclusion

In this brief article, I have shown how to create a tunnel from the Anypoint Platform to GCP in a classic way. The overall scenario is illustrated in the following diagram.

In the next article, I will explain how to create an HA VPN in GCP and make a tunnel to the Anypoint Platform. 


Author

Anupam Gogoi

Anupam Gogoi is an Integration Engineer at Avenue Code. He has been working in software development for about 9 years, implementing solutions in Java technologies as well as in SOA domain. He is a hardcore JAVA and MIDDLEWARE evangelist.


Building Accessible Web Applications

READ MORE

Create a Tunnel from Anypoint Platform to GCP Using an HA VPN

READ MORE

How to Make an Android Splash Screen

READ MORE