URLs AND DNS
URLs AND DNS
Whenever you want to browse a website, play an online game, or collect your email,
you need to access the relevant server via its specific IP address.
Most servers have a user-friendly name that saves us from having to remember its
IP address. These are called domain names and each domain name maps to a
specific IP address.
Domain names are usually chosen to represent the name of the company or
organisation that is providing a service, so they are often easy to guess. The
domain name system converts domain names to the IP addresses needed to locate
resources on the internet. This saves you from having to remember the IP
addresses.
Domain name
The domain name is a hierarchy of names. In Figure 1:
● 'org' is the top-level domain
● 'raspberrypi' is the second-level domain
● 'www' is the sub-domain
The full domain name is www.raspberrypi.org. Many domain names will be made up
of more than three parts.
Sub-directory
The final part of the URL provides the path that needs to be followed on the
server to access the resource that has been requested. At the end of the path is
the file name. In Figure 1:
education/isaac/pages/quiz.html
shows that the resource is an HTML file — quiz.html — and the path to find the
resource on the server is education/Isaac/pages
What happens if the URL is not in the domain name server's lookup table?
This is why the domain name system comprises multiple domain name servers.
There is a hierarchy of DNS servers based on the hierarchical structure of the
domain names.
Imagine we are looking to resolve www.raspberrypi.org
● 'org' is the Top Level Domain.
● 'raspberrypi' is the Domain.
● 'www' is the Subdomain.
If the local domain name server does not find the URL in its lookup table, it passes
the request to a top-level domain name server. There are separate servers for
most top-level domains such as '.com' , '.org' and '.uk', each administered by a
different authority. The request is therefore passed to the domain name server
for '.org'
The top-level domain name server will probably know the IP address of the full URL
'www.raspberrypi.org' and it will reply with the IP address.
However, some organisations manage all the addresses of the subdomains for their
organisations. Hence if the top-level domain name server does not know the answer,
it will know the address of the domain name server that manages all the addresses
for the raspberrypi domain. The request will now be forwarded to that server.
The raspberrypi domain name server will know the IP address of all the
sub-domains within raspberrypi such as 'www.raspberrypi.org' and it will respond
with the correct IP address.
The results may have been cached with previous requests at all stages, so a full
look-up may not happen.
All of this happens in a few milliseconds and then your device gets the IP address
it needs to access the resource.