Friday, September 9, 2011

DNS Override

DNS server keeps website domain name and its IP address mapping. Public DNS servers are supposed to keep in sync (eventually consistence), so every browser (user agent) can do DNS lookup using different DNS servers, and get same IP address for same domain name.
Domain sharing is a technique to optimize web performance for parallel downloading, but it brings more DNS lookup effort on browser side. The lookup sequence is described below, and browse stops if found corresponding IP address, then loads the website.
  1. Browser cache
  2. Computer hosts file for a DNS entry (OS dns cache?)
  3. Default DNS server (this is usually ISP's or your employer's DNS server)
  4. Other DNS servers
  5. If domain name can not be resolved, browser will display "server not found" error page
DNS override is to change domain name to IP address mapping in step 2 or step3, so that local computer will point to another IP address for the same domain, but public users still connect to existing IP address for the same domain name.

Override DNS entry using local DNS server
In step 3, it is usually done in internal DNS server or local DNS server which is used internally in your corporate, and it will impact all employees. Change ISP's DNS sever is actually changing all public DNS servers, so override should not happen on this DNS server.

Override DNS entry using hosts file
It is kind of key-value pair mapping file for domain name and IP address. Here is the list of file path on different operating systems.
  1. Windows: C:\Windows\System32\etc\drivers\hosts
  2. Linux:  /etc/hosts
  3. Mac: /etc/hosts 
DNS Suffix
When you ipconfig /all, it will print out details about your network connections. Two more entries about DNS are Primary Dns Suffix (usually it is your computer registered domain) and DNS Suffix Search List (which is a list of your domains suffix when you connect using partial of FQDN).

For example, if the ipconfig /all output looks like below:

C:\Documents and Settings\mypc>ipconfig /all

Windows IP Configuration

        Host Name . . . . . . . . . . . . : mypc23434
        Primary Dns Suffix  . . . . . . . : example.local
        Node Type . . . . . . . . . . . . : Hybrid
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No
        DNS Suffix Search List. . . . . . : example.local

If you have some FQDN like test.example.local,,, then if you ping using short name test, exam or motor, you will get DNS suffix appended to find the FQDN.

No comments:

Post a Comment