Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page
Help Center/ Direct Connect/ Best Practices/ Connecting an On-Premises Data Center to Multiple VPCs in the Same Region Using Direct Connect and VPC Peering

Connecting an On-Premises Data Center to Multiple VPCs in the Same Region Using Direct Connect and VPC Peering

Updated on 2025-01-22 GMT+08:00

Scenario

Connect your on-premises network to the cloud and use VPC Peering to connect the VPCs in the same region so that your on-premises network can access all these VPCs.
CAUTION:

The CIDR block of each VPC must be unique.

Typical Topology

Procedure

  1. Configure Direct Connect to connect your on-premises data center to VPC A.

    1. Create a connection.
    2. Create a virtual gateway.

      When creating the virtual gateway, select VPC A and add the CIDR block of VPC B to the local subnet.

    3. Create a virtual interface.

  2. Create a VPC peering connection between VPC A and VPC B.

    1. Log in to the management console.
    2. On the console homepage, click in the upper left corner and select the desired region and project.
    3. Click to display Service List and choose Networking > Virtual Private Cloud.
    4. In the navigation pane on the left, click VPC Peering Connections.
    5. Click Create VPC Peering Connection.
    6. Configure the parameters based on Table 1.
      Figure 1 Creating a VPC peering connection
      Table 1 Parameters required for creating a VPC peering connection

      Parameter

      Example Value

      Description

      Region

      CN-Hong Kong

      Region where the VPC peering connection will be used.

      Region where the supplementary network interface will be created. Select the region nearest to you to ensure the lowest latency possible.

      VPC Peering Connection Name

      peering-001

      Specifies the name of the VPC peering connection.

      The name contains a maximum of 64 characters, which consist of letters, digits, hyphens (-), and underscores (_).

      Description

      -

      Provides supplementary information about the VPC peering connection.

      Local VPC

      VPC B

      Specifies the local VPC. Select VPC B from the drop-down list.

      Local VPC CIDR Block

      192.168.2.0/24

      Specifies the CIDR block of the local VPC.

      Account

      My account

      Specifies whether the VPC to peer with is from your account or another user's account.

      • My account: The VPC peering connection will connect two VPCs in your account.
      • Another account: The VPC peering connection will connect your VPC to another VPC in another account.

      Peer Project

      ap-southeast-1

      The project is selected in by default if Account is set to My account.

      In this example, VPC A and VPC B are created in region A, and the corresponding project of the account in region A is selected by default.

      Peer VPC

      VPC A

      Specifies the peer VPC. Select VPC A from the drop-down list.

      Peer VPC CIDR Block

      192.168.10.0/24

      Specifies the CIDR block of the peer VPC.

      The local and peer VPCs cannot have matching or overlapping CIDR blocks. Otherwise, the routes added for the VPC peering connection may not take effect.

    7. Click OK.

  1. Add routes for the VPC peering connection.

    1. Under Networking, click Virtual Private Cloud.
    2. In the navigation pane on the left, click VPC Peering Connections.
    3. Locate the VPC peering connection in the connection list.
    4. Click the name of the VPC peering connection to switch to the page showing details about the connection.
    5. Click the Local Routes tab.
    6. Add routes in the default route table. For details about the parameters, see Table 2.
      Table 2 Parameters required for adding routes for a VPC peering connection

      Parameter

      Example Value

      Description

      VPC

      VPC B

      Specifies a VPC that is connected by the VPC peering connection.

      Route Table

      rtb-VPC-B (default)

      Specifies the route table of the VPC. The routes will be added to this route table.

      Each VPC comes with a default route table to control the outbound traffic from the subnets in the VPC. In addition to the default route table, you can also create a custom route table and associate it with the subnets in the VPC. Then, the custom route table controls outbound traffic of the subnets.

      • If there is only the default route table in the drop-down list, select the default route table.
      • If there are both default and custom route tables in drop-down list, select the route table associated with the subnet connected by the VPC peering connection.

      Destination

      VPC A CIDR block: 192.168.10.0/24

      Specifies the CIDR block of the peer VPC, a subnet, or the private IP address of an ECS in the peer VPC.

      For details, see VPC Peering Connection Examples.

      Next Hop

      peering-001

      The default value is the current VPC peering connection. You do not need to specify this parameter.

      Description

      -

      (Optional) Provides supplementary information about the route.

      Enter up to 255 characters. Angle brackets (< or >) are not allowed.

      Add a route for the other VPC

      Selected

      If you select this option, you can also add a route for the other VPC connected by the VPC peering connection.

      To enable communications between VPCs connected by a VPC peering connection, you need to add forward and return routes to the route tables of the VPCs.

      VPC

      VPC A

      By default, the other VPC connected by the VPC peering connection is selected. You do not need to specify this parameter.

      Route Table

      rtb-VPC-A (default)

      Specifies the route table of the VPC. The routes will be added to this route table.

      Each VPC comes with a default route table to control the outbound traffic from the subnets in the VPC. In addition to the default route table, you can also create a custom route table and associate it with the subnets in the VPC. Then, the custom route table controls outbound traffic of the subnets.

      • If there is only the default route table in the drop-down list, select the default route table.
      • If there are both default and custom route tables in drop-down list, select the route table associated with the subnet connected by the VPC peering connection.

      Destination

      VPC B CIDR block: 192.168.2.0/24

      IP address in the VPC at the other end of the VPC peering connection. The value can be VPC CIDR block, subnet CIDR block, or ECS IP address.

      Next Hop

      peering-001

      The default value is the current VPC peering connection. You do not need to specify this parameter.

      Description

      -

      (Optional) Provides supplementary information about the route.

      Enter up to 255 characters. Angle brackets (< or >) are not allowed.

    7. Click OK.

      You can view the route in the route list.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback