Connect multiple VPCs using Transit Gateway
KakaoCloud allows centralized traffic management between VPCs using Transit Gateway.
- Estimated time: 60 minutes
- User environment
- Recommended OS: MacOS, Ubuntu
- Region: kr-central-2
- Prerequisites
- VM access key pair
- Project Admin permissions
About this scenario
In this scenario, you will create two VPCs and connect them using Transit Gateway. The steps include:
- Create two VPCs. Each VPC uses one AZ and the default public subnet.
- Create a Transit Gateway and attach both VPCs to it.
- Configure static routing in Transit Gateway to direct traffic to each VPC based on CIDR blocks.
- Configure subnet route tables to route traffic through Transit Gateway to reach the destination VPC.
- Create VM instances in each subnet and verify connectivity using the
ping
command.
The scenario architecture is illustrated below:
Getting started
Step 1. Create VPC and subnets
VPCs provide logically isolated virtual network spaces, enabling flexible resource management on KakaoCloud. For more details, refer to the VPC documentation.
-
Go to KakaoCloud Console > VPC and click [Create VPC].
-
Create
vpc-a
using the following settings:Item Sub-item Value VPC Information VPC Name handson-vpc-a VPC IP CIDR Block 10.1.0.0/16 Availability Zone Number of AZs 1 First AZ kr-central-2-a Subnet Configuration Number of public subnets per AZ 1 Number of private subnets per AZ 0 -
Create
vpc-b
using the following settings:cautionEnsure the CIDR ranges of each VPC do not overlap. For example, if
vpc-a
uses10.1.0.0/16
, thenvpc-b
must use a distinct range like10.2.0.0/16
. Overlapping CIDR blocks will prevent communication between VPCs.Item Sub-item Value VPC Information VPC Name handson-vpc-b VPC IP CIDR Block 10.2.0.0/16 Availability Zone Number of AZs 1 First AZ kr-central-2-b Subnet Configuration Number of public subnets per AZ 1 Number of private subnets per AZ 0 -
Go to KakaoCloud Console > VPC > Subnets and verify the created network resources.
Step 2. Create and configure Transit Gateway
Transit Gateway simplifies the complexity of managing multiple VPC Peering
connections by providing centralized traffic management for inter-VPC and VPC-to-on-premises traffic. For more details, refer to the Transit Gateway documentation.
1. Create Transit Gateway
-
Go to KakaoCloud Console > Transit Gateway and click [Create Transit Gateway].
-
Enter the following settings for the Transit Gateway:
Item Description Transit Gateway Name handson-transit-gateway Default Association Enabled -
Verify that the resource has been created successfully.
2. Create attachments
-
Access the Attachment creation settings from the details page of the created Transit Gateway.
-
Add
handson-vpc-a
as anAttachment
to the Transit Gateway. -
Add
handson-vpc-b
as anAttachment
to the Transit Gateway. -
Verify that the
Attachments
have been added successfully.
3. Configure Transit Gateway routing
-
Access the Routing Table Details page connected to the Transit Gateway.
Go to KakaoCloud Console > Transit Gateway > Transit Gateway List Table, or navigate to KakaoCloud Console > Transit Gateway > Route Table.
-
In the Route tab, you can view static routes. Click [Add Static Route] to add a new route.
-
Add a static route to direct traffic with the destination
10.1.0.0/16
tohandson-vpc-a
.Item Value Destination 10.1.0.0/16 Target handson-vpc-a -
Add another static route to direct traffic with the destination
10.2.0.0/16
tohandson-vpc-b
.Item Value Destination 10.2.0.0/16 Target handson-vpc-b -
Verify that the static routes have been configured correctly.
Step 3. Configure subnet route policies
-
Navigate to Beyond Networking Service > VPC > Route Tables and check the list of route tables. Access the details of the main subnet's route table for both
handson-vpc-a
andhandson-vpc-b
, and modify the routing information. -
Access the route table details for the main subnet of
handson-vpc-a
. Click [Add Route] to add a new route. -
Add a route where the destination is the CIDR of
handson-vpc-b
, and sethandson-transit-gateway
as the target. -
Verify the added route information.
-
Access the route table details for the main subnet of
handson-vpc-b
. Click [Add Route] to add a new route. -
Add a route where the destination is the CIDR of
handson-vpc-a
, and sethandson-transit-gateway
as the target. -
Verify the added route information.
Step 4. Create instances and verify connectivity
-
Go to KakaoCloud Console > Virtual Machine > Instances and click [Add Instance] to create instances. Refer to the table below for the configurations.
Item Sub-item Instance 1 Instance 2 Basic Information Name handson-instance-a handson-instance-b Count 1 1 Image Ubuntu 20.04 Ubuntu 20.04 Instance Type m2a.large m2a.large Volume Root volume, 20GB, SSD Root volume, 20GB, SSD Key Pair {User Key Pair}
{User Key Pair}
Network VPC handson-vpc-a handson-vpc-b Subnet main handson-vpc-b Security Group {Refer below}
{Refer below}
-
Configure security policies to enable communication. Refer to the table below:
Policy Inbound Inbound Outbound Protocol ICMP TCP ALL Source 10.0.0.0/8 {User Public IP}/32
0.0.0.0/0 Port Number - 22 - Policy Description ping ssh all infoUse online tools like WhatIsMyIP.com to check your public IP address.
-
Assign a public IP to the instance and connect via SSH.
Connect via SSHssh ubuntu@{INSTANCE_PUBLIC_IP} -i {KEY_PAIR}
-
After connecting, verify communication between instances using the
ping
command. The image below shows the result of usingping
frominstance-a
invpc-a
toinstance-b
invpc-b
.Ping from instance-a to instance-bping {INSTANCE_PRIVATE_IP}
The following image shows the result of using
ping
frominstance-b
invpc-b
toinstance-a
invpc-a
.