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
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
Help Center/ NAT Gateway/ Best Practices/ Preserving Your Network with NAT Gateways During Cloud Migration/ Using a Specified IP Address to Access Hosts Outside a VPC

Using a Specified IP Address to Access Hosts Outside a VPC

Updated on 2024-11-08 GMT+08:00

Scenarios

The existing network architecture of the on-premises data center needs to be migrated to the cloud without any changes. In addition, servers can access external resources with a specified IP address.

In this best practice, department A needs to use a specified IP address (10.1.0.55) to access servers in a regulatory agency to upload required data after migrating its workloads to the cloud.

Solution Architecture

  • The regulatory agency allows requests only from specified IP address (10.1.0.55).
  • The server (192.168.0.3) in department A uses a private NAT gateway to translate 192.168.0.3 to the specified IP address (10.1.0.55) to periodically access the industry regulatory agency (10.10.0.5).
Figure 1 Logical topology

Solution Advantages

You can flexibly assign a transit IP address. All servers in the VPC can then use the transit IP address to access hosts outside the VPC.

Resource and Cost Planning

Table 1 Resource and cost planning

Resource

Parameter

CIDR Block/IP Address

Subnet Name

Description

VPC (CN-Hong Kong)

vpc-departmentA

192.168.0.0/24

subnet-A

VPC that workloads of department A are migrated to

vpc-transit1

10.1.0.0/24

ext_sub_T1

Transit VPC required by private NAT gateways

vpc-regulation

10.10.0.0/24

subnet-W

Simulated VPC of the regulatory agency

ECS (CN-Hong Kong)

ecs-departmentA

192.168.0.3

N/A

Server in department A, which can access servers in the industry regulatory agency

ecs-regulation

10.10.0.5

N/A

Simulated host of the regulatory agency

Transit IP address (vpc-transit1)

Transit IP address of department A

10.1.0.55

N/A

IP address assigned by the regulatory agency. Servers in department A use this IP address to access the regulatory agency.

Prerequisites

Creating a VPC

  1. Log in to the Huawei Cloud management console and select the CN-Hong Kong region.
  2. Under Networking, select Virtual Private Cloud. On the Virtual Private Cloud page displayed, click Create VPC.
  3. Configure a VPC for the regulatory agency based on Table 1 and click Create Now.

    • Region: Select CN-Hong Kong.
    • Name: Set it to vpc-regulation.
    • IPv4 CIDR Block: Set it to 10.10.0.0/24.
    • AZ: Select AZ1.
    • Name: Set it to subnet-W.
    • IPv4 CIDR Block: Retain the default value.
    • For parameters not mentioned, retain their default values or configure them as prompted.

Creating a Security Group

  1. Under Networking, select Virtual Private Cloud. In the navigation pane on the left, choose Access Control > Security Groups and click Create Security Group in the upper right corner.
  2. Configure the security group parameters and click OK.

    • Name: Set it to sg-regulation.
    • Template: Select General-purpose web server.
    • For parameters not mentioned, retain their default values or configure them as prompted.

  3. Locate sg-regulation and click Manage Rule in the Operation column. On the sg-regulation details page, click the Inbound Rules tab and delete all rules displayed.

  4. Click Add Rule to allow only the IP address 10.1.0.55 to access the regulatory agency. Configure the following parameters and click OK.

    • Priority: Set it to 1.
    • Action: Select Allow.
    • Protocol & Port: Select All.
    • Type: Select IPv4.
    • Source: Enter 10.1.0.55.

Creating an ECS

  1. Under Compute, select Elastic Cloud Server. On the Elastic Cloud Server page displayed, click Buy ECS.
  2. Based on Table 1, configure basic information about the ECS of the regulatory agency and click Next: Configure Network.

    • Billing Mode: Select Pay-per-use.
    • Region: Select CN-Hong Kong.
    • Specifications: You can select ECS specifications based on your project requirements. This example uses c6.large.2 as an example.
    • Image: Select Public image. This example uses a CentOS 8.0 image as an example.
    • For parameters not mentioned, retain their default values or configure them as prompted.

  3. Configure the ECS network information and click Next: Configure Advanced Settings.

    • Network: Select VPC vpc-regulation, select Manually specify IP address, and set the IP address to 10.10.0.5 planned in Table 1.
    • Security Group: Select sg-regulation.
    • EIP: Select Not required.
    • For parameters not mentioned, retain their default values or configure them as prompted.

  4. Set the ECS name and password and click Next: Confirm.

    • ECS Name: Set it to ecs-regulation.
    • Login Mode: Select Password and enter a password.
    • For parameters not mentioned, retain their default values or configure them as prompted.

  5. Confirm the ECS information, read the agreement and select the Agreement option, and click Submit to finish the ECS creation for the regulatory agency.
  6. In the ECS list, locate the ECS for the regulatory agency and click Remote Login in the Operation column. In the displayed dialog box, click Log In under Other Login Modes.
  7. Log in to the ECS as user root and check whether the private IP address of the ECS is the one you planned.

    ifconfig

Configuring Private NAT Gateways

To assign a transit IP address

  1. On the management console, under Networking, select NAT Gateway. In the left navigation pane, choose Private NAT Gateways. Click the Transit IP Addresses tab.

  2. Click Assign Transit IP Address and configure the parameters as follows:

    • Transit VPC: Select vpc-transit1.
    • Transit Subnet: Select ext_sub_T1.
    • Transit IP Address: Select Manual.
    • IP Address: Enter 10.1.0.55.

  3. Click the Private NAT Gateways tab and click private-nat-A.
  4. On the SNAT Rules tab, click Add SNAT Rule.

    • Subnet: Select Existing. The system automatically displays the subnet of department A.
    • Transit Subnet: Select ext_sub_T1.
    • Transit IP Address: Enter 10.1.0.55.

  5. After the SNAT rule parameters are configured, click OK.
  6. Go back to Network Console. In the navigation pane on the left, choose Route Tables and click rtb-vpc-departmentA. Confirm that the route from department A to private NAT gateway private-nat A has been added.

Configuring a VPC Peering Connection

  1. Under Networking, select Virtual Private Cloud. In the navigation pane on the left, choose VPC Peering Connections.
  2. Configure the following parameters and click OK.

    • Name: Set it to peering-TtoW.
    • Local VPC: Select vpc-transit1.
    • Peer VPC: Select vpc-regulation.
    • For parameters not mentioned, retain their default values or configure them as prompted.

Configuring Routes

  1. Choose Networking > Virtual Private Cloud. In the navigation pane on the left, choose Route Tables.
  2. Click rtb-vpc-transit1 to delete the existing 0.0.0.0/0 routing rule.
  3. Click Add Route, configure required parameters, and click OK.

    • Destination: Set it to 0.0.0.0/0.
    • Next Hop Type: Select VPC peering connection.
    • Next Hop: The system automatically displays the VPC peering connection.

  4. Go back to the Route Tables page, click rtb-vpc-regulation, and click Add Route.
  5. Configure route information and click OK.

    • Destination: Set it to 0.0.0.0/0.
    • Next Hop Type: Select VPC peering connection.
    • Next Hop: The system automatically displays the VPC peering connection.

Verifying that Department A Can Access the Regulatory Agency

  1. Under Computing, select Elastic Cloud Server and use VNC to log in to ecs-departmentA.
  2. On ecs-departmentA, verify that it can access the regulatory agency.

    ping 10.10.0.5

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