Scenarios
In a multi-cloud architecture or a hybrid cloud architecture, the services in the data center and the Alibaba Cloud Virtual Private Cloud (VPC) need to access each other by using Domain Name System (DNS) resolution. If you have enabled the connection between two isolated network environments through a Virtual Private Network (VPN) or leased line, you can follow this topic to achieve real-time access between services deployed in two isolated network environments.
Prerequisites
Two isolated network environments have been connected through VPNs or leased lines. For more information, see IPsec-VPN.
Schematic diagram
Expected results
If you use an ECS instance in an Alibaba Cloud VPC to query the domain name
app.example.com
, the request is forwarded to the external DNS server through the outbound endpoint.If you use an Internet Data Center (IDC) or an ECS instance on Alibaba Cloud to query domain name
test.oss-cn-hangzhou-internal.aliyuncs.com
, the local DNS server forwards the request to Alibaba Cloud DNS PrivateZone through the inbound endpoint.NoteIn this example,
test.oss-cn-hangzhou-internal.aliyuncs.com
is an OSS internal endpoint. Chnage the endpoint based on your business requirements.
Procedure
Scenario 1: Use a VPC to access an on-premises DNS
Create an outbound endpoint. In this example,
192.168.100.74
and192.168.192.219
are created. For more information, see Create an outbound endpoint.Create a forwarding rule: In this example,
example.com
serves as the forward zone. The IP addresses and ports of external DNS servers are not provided by Alibaba CLoud DNS. In this example,192.168.100.100
and192.168.100.200
are used. For more information, see Create a forwarding rule.ImportantIf
example.com
has been set as a built-in authoritative zone, be sure to enable subdomain recursive resolution proxy.Specify an effective range for the forwarding rule: The forwarding rule must take effect in the VPCs where ECS instances are located. For more information, see Specify an effective scope for a forwarding rule.
Run the
dig app.example.com
command on the ECS instances in the VPC for verification.
Scenario 2: Use an on-premises server to access Alibaba CLoud DNS
You can create an inbound endpoint on the Service Address tab of Alibaba Cloud Private DNS. In this example,
192.168.0.176
and192.168.100.163
are used as inbound service IP addresses.WarningThe forwarding rule must take effect in the inbound VPC within the effective scope of the built-in authoritative zone
oss-cn-hangzhou-internal.aliyuncs.com
. Otherwise, domain name resolution does not take effect.ImportantOn the Service Address tab, you can customize an IP address for an Alibaba Cloud Private DNS server within a specific VPC in Alibaba Cloud. This feature is applicable to scenarios where the CIDR block of your local DNS server conflicts with the default IP addresses of Alibaba Cloud Private DNS, and where the Alibaba Cloud DNS is only effective within a specific VPC. In this example,
100.100.2.136
and100.100.2.138
are used as the default IP addresses.If the CIDR block of your on-premises network does not conflict with the default IP addresses of Private DNS, the default IP address can be used for DNS resolution.
Add a forwarding rule for local DNS servers to forward all requests matching
oss-cn-hangzhou-internal.aliyuncs.com
to the IP addresses for an inbound endpoint.You can run the command
dig test.oss-cn-hangzhou-internal.aliyuncs.com
on your local DNS server for verification.