So what exactly happens when you type “davidxia.com” into your browser’s address field and hit “Enter”?
A website is simply a collection of online content ranging from text documents to images to video. All this content lives in physical machines called servers. Servers listen for incoming calls or requests from web browsers or applications and respond with the appropriate content.
Think of the Internet as having a giant Yellowpages phone book
So how does this content get from a machine that could be halfway around the world to your computer? Every machine that’s connected to the Internet is assigned a number called an Internet Protocol address or IP address, e.g. 173.255.229.187. They are not assigned domain names like “davidxia.com.” This is the job of special servers called name servers. Together these name servers make up the Domain Name System, which translates “davidxia.com” into 173.255.229.187.
DNS is like the Yellowpages. When you ask your browser to go to “davidxia.com,” your browser first calls a name server and asks for the address of the machine hosting my website. It’s like me calling a telephone operator and asking for someone’s phone number. The name server returns an IP address that your browser subsequently calls.
Here’s a cartoon illustrating this idea.
DNS records
In addition to IP addresses, DNS associates other types of data with domains. The actual IP address is called the address record or A record. A canonical name record (CNAME) defines an alias for a domain. If I registered “davidxia.net” and wanted it to go to “davidxia.com” I would make the former a CNAME for the latter. A mail exchange record maps a domain name to a list of mail exchange servers for that domain. This is how you can use Gmail with your custom domain. Name server (NS) records indicate which DNS servers are the authoritative record holders for the domain. Text (TXT) records hold arbitrary data.
Whenever a record is changed, it can take up to 48 hours for the changes to propagate throughout the Internet. This is because DNS is hierarchical. To improve efficiency, DNS servers store query results for a finite period of time. This time is indicated by the time-to-live (TTL) in each record. So when you visit “davidxia.com,” chances are you’re not hitting the main name server but rather a subordinate and closer one that’s cached the result and can return the information to your computer faster.
A more detailed description of DNS records.