Using a Private NAT Gateway and Direct Connect to Enable Communications Between a VPC and an On-premises Data Center
Scenarios
In a hybrid cloud architecture, if the private IP address of a cloud server in a VPC is not trusted by an on-premises data center, the cloud server cannot communicate with the on-premises data center. To address this issue, you can configure a NAT gateway and use Direct Connect or VPN to enable communications between a VPC and an on-premises data center.
Solution Architecture
- A Direct Connect or VPN connection connects an on-premises data center to a transit VPC.
- A private NAT gateway translates the source or destination IP address into a transit IP address (private IP address trusted by the on-premises data center) in the transit VPC using an SNAT or DNAT rule.
Figure 1 Networking diagram
Solution Advantages
In a hybrid cloud network, the private IP addresses of ECSs in the VPC need to be mapped to those trusted by the on-premises data center to meet security compliance requirements.
Constraints
- The CIDR block of your on-premises data center cannot overlap with those of the transit VPC and the service VPC; otherwise, your on-premises data center will be unable to communicate with the service VPC.
- You need to define a CIDR block in the transit VPC to map private IP addresses from the service VPC. Generally, you use a private CIDR block or private IP addresses trusted by your on-premises data center.
Resource Planning
|
Resource |
Resource Name |
Description |
Quantity |
|---|---|---|---|
|
VPC |
VPC-Test01 |
The service VPC with the CIDR block of 192.168.0.0/24. |
1 |
|
VPC-Test02 |
The transit VPC with the CIDR block of 10.1.0.0/24. |
1 |
|
|
NAT gateway |
NAT-Private-Test |
The private NAT gateway deployed in VPC-Test01. |
1 |
|
NAT-Ext-Sub-IP-Test |
The transit IP address (10.1.0.10) in the transit VPC (VPC-Test02). |
1 |
|
|
Direct Connect connection |
DC-Test |
The Direct Connect connection that connects the on-premises data center to the transit VPC. |
1 |
|
ECS |
ECS-Test |
The ECS (private IP address: 192.168.0.10) purchased and deployed in the service VPC (VPC-Test01). |
1 |
|
On-premises data center |
IDC-Test |
CIDR block: 10.0.0.0/24; private IP address of an on-premises server: 10.0.0.62 |
1 |
- In this practice, the private IP address (192.168.0.10) of the ECS is mapped to the private IP address (10.1.0.10) trusted by the on-premises data center through the private NAT gateway.
- The VPC, NAT gateway, Direct Connect connection, and ECS must be in the same region.
Procedure
- Create a service VPC and a transit VPC.
For details, see Creating a VPC with a Subnet.
- Configure a Direct Connect or VPN connection between the on-premises data center and the transit VPC.
For details, see Create a Connection.
- Buy a private NAT gateway in the specified region and select the service VPC.
For details, see Buying a Private NAT Gateway.
- Assign a transit IP address.
Select VPC-Test02 as the transit VPC and manually assign the transit IP address of 10.1.0.10.
- Add an SNAT rule.
On the SNAT Rules tab of the private NAT gateway, click Add SNAT Rule and set Subnet to 192.168.0.0/24, the service subnet with the IP addresses that need to be mapped. Set Transit IP Address to the one assigned in 4.
- Add a DNAT rule.
On the DNAT Rules tab of the private NAT gateway, click Add DNAT Rule. Set the instance type of the local network to Server with the private IP address of 192.168.0.10 and select the transit IP address assigned in 4 as the transit IP address of the transit network. For details, see Adding a DNAT Rule.
- Configure routes.
- Add a route pointing to the private NAT gateway to the route table of the service VPC. Set Destination to 10.0.0.0/24.
- Add an inbound security group rule to allow traffic to the destination CIDR block that contains the IP address (10.0.0.62) of the on-premises server.
Verifying Network Connectivity
Test the network connectivity.
Log in to ECS-Test in the service VPC and ping the private IP address (10.0.0.62) of an on-premises server to verify the network connectivity.

Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot