Internet companies have basically optimized DNS domain name resolution processing. Some companies will even build their own intelligent DNS resolution system to solve a series of problems existing in LocalDNS, such as domain name hijacking, call accuracy and real-time.

Today, HttpDNS has become one of the more common optimizations. HttpDNS is a service with DNS domain name resolution capability based on HTTP protocol. At present, major cloud vendors have built their own HttpDNS services. Such as Ali cloud HttpDNS, Tencent cloud HttpDNS and so on.

HttpDNS mechanism analysis

The principle of HttpDNS is very simple:

  • When a client accesses the HttpDNS resolution interface, the HttpDNS returns an optimal IP address from the IP address configured in the domain name configuration management system based on certain policies. If no, return to the original domain name and use carrier’s LocalDNS to resolve the domain name.
  • The client then sends a service protocol request to the obtained IP address. For an Http request, specify the host field in the header to send a standard Http request to the IP address.

HttpDNS explicitly represents the domain name resolution process. Bypassing the recursive domain name resolution process of LocalDNS, thus avoiding a series of problems of LocalDNS directly.

Based on the HttpDNS principle, it can be seen that HttpDNS needs to be highly available, which can easily become the bottleneck of the entire system. In addition, an efficient domain name resolution configuration management system is needed for domain name resolution and optimal policy management.

HttpDNS is a simple implementation idea

Let’s explore another simple implementation, using your own DNS system and dig command to implement the simple HttpsDNS service.

Here’s the idea:

  • 1. Configure the domain name and IP address in the company’s DNS system or a third-party DNS system to implement dynamic invocation by region or carrier.
  • 2. Develop HTTP API service to provide domain name query service interface.
  • 3. In the HTTP API service logic, obtain the IP address of the client, run the following command to query the resolved IP address of the domain name, and return the IP address.
Dig @ns server www.baidu.com +subnet= client IPCopy the code

This method utilizes the dynamic scheduling function of the DNS system and domain name IP management function, and provides THE DNS resolution capability of the Http protocol in combination with the Http API service. Bypassing the recursive query of LocalDNS, DNS hijacking and precision problems are solved.

This way, just a simple idea of exploration, which there are a lot of details need to be studied. DNS resolution is a strongly dependent service for service systems, and its availability and stability cannot be ignored.

Well, that’s all for today’s sharing. Welcome to leave a comment!

Follow the public account “Mr. Wu code nong”, you can get the latest articles in the first time. Reply keyword “go” “python” to get the learning materials I collected, also can reply keyword “small two”, add my WX to pull you into the technical exchange group, chat about technology chat about life ~