DNS, linking names with IP addresses

In previous parts, we have so far talked about how IP addresses work, how Subnet Masks determine which IP network that a computer belongs to, and how a computer can send traffic to other IP networks via a Default Gateway, which is the router’s IP address.

But as a user, you rarely need to bother much about IP addresses, which is somewhat lucky since they can be hard to remember. Instead, you are used to relying on something called Domain Names to connect to things on the Internet, for example www.homenethowto.com or www.apple.com
Those names are called Domain Names and make it easier for us people to remember how to access the services on the Internet that we want to connect to.

But when computers send traffic to each other they must use IP addresses as destinations, even if the traffic is going to a web server that has an associated domain name. Therefore, the computer must have a way to translate the names that we use to IP addresses that the computer can use. The translation is made by DNS, which stands for Domain Name System, a system for translating back and forth between IP addresses and DNS names or domain names.

DNS is served by a large number of servers on the Internet which can reply to queries about domain names. The DNS servers are owned by different companies and organisations, for example ISPs, web hosting companies and similar. When you buy or lease an Internet connection from an ISP they also always provide DNS as a service to you, and your home router will also automatically learn about and use those DNS servers.

For a computer to be able to look up which IP address that a particular domain name has got, the computer must first find its way to a DNS server. Luckily the computer can obtain this information from the home router. When the computer gets its IP address from the home router, then the router also passes along information about which DNS server that the computer should use.

A server is really just a regular computer. The difference is that the server is specifically made to be good at hosting one or more services to other computers on the network. A DNS server, for example, could just as well be any regular home PC with an installed program that can reply to incoming DNS queries.

But most often, servers on the Internet are more expensive high-end varieties of computers that are made to be durable even when powered on indefinitely. They have hardware components that are made to be able to handle many queries simultaneously from many different users. In addition, they are made to be mounted in special Rack mounts in data centers and as such have different appearances to a normal home computer.

But you can more or less think of a server as a regular computer made for a specific purpose that it is really good at.

A lot of home routers tell the computers on the LAN to send their DNS queries to the home router itself. The home router will then either answer directly if it already knows the answer, or it will forward the query to a DNS server on the Internet.

DNS query from a computer to its Home Router

When a computer wants to browse to a domain name it queries the DNS server for what IP address that domain name has got. Once it gets a DNS response back containing the IP address of the domain name it can use that IP address as its destination for the traffic.

There are also home routers that simply tell the computers on the LAN to send their DNS queries directly to the DNS servers of the ISP. This works just as well. Since the DNS servers are on the Internet on another IP network the computer cannot ask its DNS questions directly to the DNS servers. Each query must pass via the Default Gateway which is the router. So the DNS queries are still going from the computer via the home router to the DNS servers on the Internet. The difference is that the home router just forwards the traffic and does not have to handle the actual DNS query itself. It just passes along the query without looking at the contents.

DNS query from a computer directly to a DNS server

Previous part:
Default Gateway, finding other IP networks

Next part:
Giving the computer an IP address