OpenResty Edge can be used directly as an authoritative DNS server. In this tutorial, you will learn how to OpenResty Edge Configure DNS records and geographical location based DNS dispatching rules in.

Add DNS record

Let's go OpenResty Edge Admin Web Console for. This is a sample deployment of our console. Each user has its own local deployment.

Screenshot

Enter the DNS application management interface.

Screenshot

Click the "openresty.net" application to see how the DNS application is configured in actual use.

Screenshot

First, you can see the DNS record map, which visually shows the resolution of different regions.

Screenshot

You can select different sub domains here.

Screenshot

The map can be turned on or off through this switch.

Screenshot

After clicking Add DNS Record, a new line of records will appear in the list.

Screenshot

Screenshot

You can select the type of record.

Screenshot

Enter the sub domain name of the record, such as "blog".

Screenshot

You can limit that only specific client addresses can be resolved to this record.

Screenshot

"Any" means no restriction.

Screenshot

Limit by CIDR.

Screenshot

For example, 192.168.1.1/24.

Screenshot

You can also limit the region, such as "Singapore".

Screenshot

Here we do not impose restrictions.

Screenshot

Here is the resolution result. You can enter the IP address directly.

Screenshot

You can also select the gateway cluster of Edge.

Screenshot

For example, "aws london".

Screenshot

This is the expiration time of the record.

Screenshot

You can select different units.

Screenshot

This is the switch of active and standby records. When there is no active record or the health check of the active record fails, the standby record will be used.

Screenshot

At the same time, Edge also supports health check of DNS records to avoid returning unavailable results.

Screenshot

Click "Add" after configuration.

Screenshot

Test DNS records

Next, let's look at the IP address of the network node in the DNS record just configured.

Screenshot

You can see that the IP address ends with. 240.

Screenshot

Then use the dig command to query DNS.

You can see that the IP address of the gateway node in the gateway cluster we just selected is returned.

Screenshot

When multiple results need to be returned, multiple DNS records can be added.

Click the "Add" button again.

Screenshot

Enter the domain name "blog".

Screenshot

Select another gateway cluster "aws us east".

Screenshot

Click to add this record.

Screenshot

Now there are two DNS records about "blog. openrest. net".

Screenshot

Then go to the "Gateway Cluster" interface again and check the IP address of the "aws us east" gateway cluster.

This IP address ends with. 84.

Screenshot

Then use the "dig" command again to query.

As you can see, the result is correct.

Screenshot

You do not need to manually create all DNS records. Click this button to automatically generate a DNS scheme based on geographical location.

Screenshot

Configure authoritative DNS server

Next, continue to introduce DNS configuration.

Select Authoritative DNS Servers.

Screenshot

The configuration here is the result of SOA records.

Screenshot

Then we take Google Domains as an example to demonstrate how to resolve DNS domain name servers to Edge.

Screenshot

Select the DNS tab.

Screenshot

Select Global DNS settings.

Screenshot

Add glue record and enter the domain name and IP address of the Edge Node.

Screenshot

Return to the previous page.

Screenshot

Then select Custom name servers.

Screenshot

Click "manage name servers"

Screenshot

Enter the domain name previously configured in "Global DNS Settings"

Screenshot

Finally, click this button to switch to the customized domain name server.

Screenshot

You have successfully configured Google Domains

Screenshot

Let's return to the Edge Admin interface to continue introducing DNS configuration.

This "User Group" is used for access control.

Screenshot

If you like this tutorial, please subscribe to this blog site and our YouTube Channel or Station B channel thank you!

About the author

Zhang Yichun is open source OpenResty ® Project founder and OpenResty Inc. CEO and founder of the company.

Zhang Yichun (Github ID: agentzh) was born in Jiangsu, China, and now lives in the U.S. Bay Area. He was an advocate and leader of China's early open source technology and culture, and once worked for many internationally renowned high-tech enterprises, such as Cloudflare Yahoo, Alibaba, the pioneer of "edge computing", "dynamic tracking" and "machine programming", has more than 22 years of programming and 16 years of open source experience. As the leader of open source projects with more than 40 million global domain name users, he OpenResty ® High tech enterprises created by open source projects OpenResty Inc. It is located in the center of Silicon Valley in the United States. Its two main products OpenResty XRay (Utilize Dynamic tracking Technology) and OpenResty Edge (The all-purpose gateway software most suitable for microservices and distributed traffic), widely favored by many listed and large enterprises worldwide. Besides OpenResty, Zhang Yichun has contributed more than one million lines of code to many open source projects, including Linux kernel, Nginx LuaJIT GDB SystemTap LLVM , Perl, etc., and has written more than 60 open source software libraries.

Follow us

If you like this article, please follow us OpenResty Inc. Corporate Blog Site You are also welcome to scan our WeChat official account:

Our

translate

We provide English version Original text and Chinese translation (this article). We also welcome readers to provide translations in other languages. As long as the full text translation is not omitted, we will consider using it. Thank you very much!