top of page

GCP Cloud NAT

  • Writer: Anand Nerurkar
    Anand Nerurkar
  • Sep 15, 2023
  • 2 min read

ree

ree
ree

create new project


ree

create instance


ree

ree

above setting will make aure that vm does not have external ip address


ree

ree

ree

we are trying to get update, but it wont b/c vm is having private ip , it can not connect to internet. so we will set up NAT


we need to first reserve ip addresses for the NAT, so goto vpc nw->ip addresses->reserve external ip address


ree

ree

ree

goto cloud nat


ree

ree


ree

ree

ree

ree

now ssh to ur vm and get update , it shold work now


ree

This is the default NAT Rule get applied so that it can connect internet and download update.

ree

ree

now VM make use of Cloud NAT and connect to internet and download update.


Cloud NAT Rule

==

This is the defaut rule created when you create Cloud NAT.

ree

scenario

--

we need to connect to different 2 3rd party system from our vm , so we can set up routing rules as below

we will reserve 2 more static ip address for each 3rd party system above.

rule 1 - connect 1st 3rd party system with static ip 1

rule 2 - connect 2nd 3rd party system with static ip 2

else connect to default rule


step1

--

reserve ip addres as below


ree

we will simulate 3rd party system with vm as below

ree

we will deploy below python app into one of our vm


ree

ssh into 3rd party vm as below

ree

We have deployed python app to this 3rd party system and it is accessible on port 5000

so we need to create firewall rule for port -tcp-5000


now hit below url , you can see python app running

ree

ree

so both 3rd party system up and running


now we will set up cloud NAT rule for both 3rd party system as below


ree

ree

rule 2 for system2

==



ree

ree

ssh to instnace1 and hit 1st 3rd party url :5000


ree

Thus when we hit 1st 3rd party ip address:5000, it make use of NAT rule and forward it to NAT Rule1



 
 
 

Recent Posts

See All

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
  • Facebook
  • Twitter
  • LinkedIn

©2024 by AeeroTech. Proudly created with Wix.com

bottom of page