Configure Private Zone to resolve a domain name to a private IP address within a VPC.
Workflow
Prerequisites
-
A VPC and a vSwitch have been created. For this tutorial, use the CIDR block
192.168.0.0/16for the VPC and192.168.0.0/24for the vSwitch. Create and delete a VPC and a vSwitch. -
An ECS instance has been created in the VPC to host a demo service. Note its private IP address (for example, 192.168.0.83). Resources within the same VPC (such as
vpc-hangzhou) can access the service atdemo.example.com. Purchase and use an ECS instance.
Procedure
Step 1: Add a zoneUser Defined Zones
-
Sign in to the Alibaba Cloud DNS console for Private Zone.
-
In the left-side navigation pane, choose Authoritative Zone > User Defined Zones. Then, click Add Zone.
-
On the Add Zone page, configure the following parameters.
Authoritative Zone: Enter
example.com.Recursive Resolution Proxy for Subdomain Names: Keep enabled (default).
Leave other parameters at their defaults.
ImportantYou can change the effective scope at any time. We recommend that you configure the scope after adding DNS records.
If a VPC is linked to a zone with no records, DNS queries for the domain from that VPC fail because they are not recursively forwarded to public DNS servers.
Step 2: Add a DNS record
-
Sign in to the Alibaba Cloud DNS console for Private Zone.
-
Navigate to Authoritative Zone > User Defined Zones. Find your zone and click Settings in the Actions column.
-
On the Settings tab, click Add Record and configure the following parameters.
Record Type: Select A.
Hostname: Enter
demo.Record Value: Enter
192.168.0.83.
Step 3: Configure effective scope
-
Sign in to the Alibaba Cloud DNS console for Private Zone.
-
Navigate to Authoritative Zone > User Defined Zones. Find your zone and click Effective Scope in the Actions column.
-
In the Effective Scope panel, select the VPC that you want to associate with this zone.

Step 4: Verify resolution
-
Create another ECS instance in the same VPC for testing. Purchase and use an ECS instance.
-
Sign in to the new ECS instance and run the following command:
curl demo.example.com
If the correct IP address is returned, the configuration is successful.
If no service is running on the destination instance, run
ping demo.example.comto verify DNS resolution.