Week7 - Selesfia/ComputerNetwork GitHub Wiki
Create VPC Network (Auto and Custom)
Auto
- Go to GCP platform -> VPC Networks -> Create VPC Networks
- Give it a name "mygcp1"
- Subnet Creation Mode -> Auto
- Firewall Rules -> allow-icmp, allow-ssh
- Click create
Custom
- Go to GCP platform -> VPC Networks -> Create VPC Network
- Give it a name "mygcp2"
- Subnet Creation Mode -> Custom
- Subnet -> Edit subnet -> Give a name "asia-ast1" -> Choose region -> IPv4 range "192.168.1.0/24"
- Click create
Creating Firewall Rule1
- Go to Network Securities -> Firewall Policies -> Create Firewall Rule
- Give a name "mygcp1-allow-ssh" -> Network choose "mygcp1" -> Target change to "All instances in the network" -> Source IPv4 "0.0.0.0/0"
- Protocols and ports -> TCP "22"
Creating Firewall Rule2
- Go to Network Securities -> Firewall Policies -> Create Firewall Rule
- Give a name "mygcp2-allow-ssh" -> Network choose "mygcp2" -> Target change to "All instances in the network" -> Source IPv4 "0.0.0.0/0"
- Protocols and ports -> TCP "22" -> Other "icmp"
Create 2 VM
(VM1)
- Compute Engine -> New Instance
- Give a name "myvm-myvpc1" -> Change to N1 and Ubuntu
- Advance Options -> Network Interface -> Network -> Choose "mygcp1"
- Click create
(VM2)
- Compute Engine -> New Instance
- Give a name "myvm-myvpc2" -> Change to N1 and Ubuntu
- Advance Options -> Network Interface -> Network -> Choose "mygcp2"
- Click create
Create Peering Connection
Peering Connection 1
- Go to VPC Network Peering -> Create Peering Connection -> Continue
- Give a name "myvpc1-mygcp2" -> Your VPC Network "mygcp1" -> VPC Network name "mygcp2"
- Click create
Peering Connection 2
- Go to VPC Network Peering -> Create Peering Connection -> Continue
- Give a name "myvpc2-mygcp1" -> Your VPC Network "mygcp2" -> VPC Network name "mygcp1"
- Click create
Check Connection
- Connect SSH for both VM
- At VM1
$ ip addr show #to check ip address
- At VM2
$ ping 10.140.0.2
PS : Remember to delete the resources that you created if you don't use it anymore.
22/10/2024