# GCP (Basic: Part 2)

## Step 1: Create two VPC using Google Cloud

VPC 1:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692817766350/1051ffff-53f8-49aa-b27e-d953d1bd945a.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692817786698/db4b92ef-3ae1-44e3-95eb-4bca38b897f5.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692817804691/5da779ed-7af7-4f27-b078-b7599e596cfe.png align="center")

VPC 2:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692817855099/827d3cd7-4ad6-4873-81e6-6d83fcbcc77a.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692817863577/030fb657-014c-4083-b483-fee35305d590.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692817870239/dc17eb26-0bbe-49fb-b114-d9fddd3198f5.png align="center")

## Step 2: Create Instances With Private and Public Subnet Network

User -&gt; IAP -&gt; VM

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692818328845/af871cc4-481a-4d5a-896e-9823570bb755.png align="center")

Identity-Aware Proxy (IAP) is a security feature offered by various cloud platforms, including Google Cloud Platform (GCP). It provides an additional layer of security for web applications and services by controlling access based on user identities and context.

IAP helps protect against unauthorized access and ensures that only authorized users can access your web applications and services. It's particularly useful for cloud-based applications that need to be accessible to users from various locations while maintaining strong security measures.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692818700934/5caea45f-f4da-4437-93a6-d53c8a3d6667.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692818717476/8fb425d7-e6d7-4608-8c73-18ec02f772d9.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692822589178/c49a7d0e-4d87-43d9-8904-175a3d896cdf.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692822594559/25abf157-441d-4cc5-a0a5-0c8db7cdf934.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692822848213/a9d0ee53-b45a-441c-aab7-ce3cc2456b44.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692822824850/7377c7fb-9aa7-43aa-95a8-2289537460b6.png align="center")

SNAT stands for "Source Network Address Translation." It's a networking technique used in computer networks to modify the source IP address of packets as they pass through a router or firewall. SNAT is commonly used to enable multiple devices on a local network to share a single public IP address when communicating with external networks, such as the internet.

## Step 3: Create Cloud NAT with Router

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692863693922/42f2f665-513b-42ee-88db-17cf1033e5ac.png align="center")

## Step 4: Enable Identity Aware Proxy, Create App and Give Access

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692822931524/07cc40c6-5628-4fbc-a5fe-1440cae3041d.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692823388695/836e6c0f-7b0b-4dad-884b-fe58e1c57130.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692823396587/eca98a76-c5fa-4e99-9beb-1fb88ea2ceef.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692823404469/5af54342-0705-45b6-ad25-9e9442c2b027.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692823415242/bd4702c7-94cc-45a2-8047-0c66f4c08992.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692823745159/f84907e1-b718-46bb-a9bf-10aeda467a9a.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692823849693/d7e78437-0796-4213-8b3b-7a1a70dc8fb1.png align="center")

Ip is matching

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692823943987/3769e7d2-1d2c-43bb-bc18-818211afab1f.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692824015157/57fd174f-df23-479f-9df9-d6048f98a0fa.png align="center")

## Day 2:

## Step 5: Create Firewall Rule and telnet to VM with public subnet

The command nc -l -p 80 uses the nc (netcat) utility to listen on port 80 for incoming connections. It's a simple way to create a network server that listens for connections on a specific port.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692857823943/0c1cd826-a056-4649-84a0-7e7e324deb20.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692857830206/9bf6fbad-0fbf-42a0-94d9-1aae24911c7b.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692857844995/556895c7-6fd8-4f4d-bdac-aa6eb86d5723.png align="center")

## Step 6: Create New Instance with Private Subnet with External Ip

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692858909704/94f9f65f-b6c3-4ab6-906d-94a81c104f8a.png align="center")

What we will trying to figure out

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692864436432/6b6b54e1-8519-4789-8879-41d53b71f19a.png align="center")

nslookup, traceroute m

GCP Private network will need NAT, Cloud Router but Public network just need External IP

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692865058565/22792f5c-77d4-4fa9-a9e4-b6661e035bfa.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692865107292/cd8f7aae-5d75-4f9f-99ce-78bb72ba6016.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692866566107/3127abf4-aa29-4de7-94fe-2c6c937ecbb6.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692866581561/715bafdd-1bc7-4d4b-ae1c-b584ee35df62.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692866594187/2a050049-06ef-4754-9d18-cd89b4a39663.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692866951551/cfe24ee8-0d07-4cc2-ae91-c24195467dd8.png align="center")
