Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru

Enable Public Internet Communication Using Cloud NAT on GCP

Cloud NAT (network address translation) allows instances with no public IP address to continue to communicate with the public Internet when they need external resources. This lab will take you through the steps of creating a managed Cloud NAT gateway for one subnet in a custom VPC network, while leaving a second subnet (with a private instance) cut off from Internet access.


Path Info

Clock icon Intermediate
Clock icon 30m
Clock icon Nov 27, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    SSH into Private Instances and Confirm Lack of External Internet Connectivity

    1. From the web console, go to the top left menu and select Compute Engine.

    2. Click the SSH button next to both private-instance-1 and private-instance-2 to open SSH sessions.

    3. In each SSH session, attempt to ping It should be unsuccessful.

    4. Leave the SSH windows up, and go back to the web console.

  2. Challenge

    Create a Cloud NAT Gateway

    1. From the web console, go to the top left menu and select first Network Services, then Cloud NAT.

    2. Click Get started.

    3. Name the gateway "nat-1".

    4. Under the VPC network menu, select custom-network.

    5. Set region to us-central1.

    6. Under the Cloud Router menu, select Create new router.

    7. Name the router "nat-router".

    8. Click Create.

    9. Under NAT mapping - Source, change the source to "Custom".

    10. Under the Subnet name menu, select subnet-a.

    11. Leave all other settings as defaults, and click Create. After about 15 seconds, your Cloud NAT gateway should be up and running.

  3. Challenge

    Test NAT Translation

    1. Go back to the SSH session for private-instance-1.

    2. Attempt to ping It should be successful.

    3. Go back to the SSH session for private-instance-2.

    4. Attempt to ping It should not be successful because we did not place instances in subnet-b behind our NAT gateway.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans