- 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
Table of Contents
-
Challenge
SSH into Private Instances and Confirm Lack of External Internet Connectivity
-
From the web console, go to the top left menu and select Compute Engine.
-
Click the SSH button next to both private-instance-1 and private-instance-2 to open SSH sessions.
-
In each SSH session, attempt to ping google.com. It should be unsuccessful.
-
Leave the SSH windows up, and go back to the web console.
-
-
Challenge
Create a Cloud NAT Gateway
-
From the web console, go to the top left menu and select first Network Services, then Cloud NAT.
-
Click Get started.
-
Name the gateway "nat-1".
-
Under the VPC network menu, select custom-network.
-
Set region to us-central1.
-
Under the Cloud Router menu, select Create new router.
-
Name the router "nat-router".
-
Click Create.
-
Under NAT mapping - Source, change the source to "Custom".
-
Under the Subnet name menu, select subnet-a.
-
Leave all other settings as defaults, and click Create. After about 15 seconds, your Cloud NAT gateway should be up and running.
-
-
Challenge
Test NAT Translation
-
Go back to the SSH session for private-instance-1.
-
Attempt to ping google.com. It should be successful.
-
Go back to the SSH session for private-instance-2.
-
Attempt to ping google.com. It should not be successful because we did not place instances in subnet-b behind our NAT gateway.
-
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.