How the Internet Works
IP Addresses and DNS
In this lesson you will
- Explain what an IP address is
- Describe what DNS does and why it matters
- Walk through a DNS lookup step by step
Introduction
For data to arrive at the right place, every device needs an address. But you type names like learnataiera.com, not numbers. DNS connects the two.
IP addresses
An IP address is a number that identifies a device on a network, like a postal address for a house. Two versions are in use:
- IPv4: four numbers from 0 to 255 separated by dots, for example
192.0.2.1. - IPv6: a much longer address written in hexadecimal, created because IPv4 addresses are running out.
Addresses starting 192.168 are private, used inside homes and offices. Your router has a public address that the wider internet sees.
DNS: the phone book of the internet
The Domain Name System (DNS) turns a name you can remember into the IP address a computer needs.
Without DNS you would have to remember a number for every site. A domain name such as example.com is easy for people. DNS does the lookup in a fraction of a second.
Quick quiz
What does DNS do?
A lookup, step by step
When you type a website name:
- Your browser checks if it already knows the address (a cache).
- If not, it asks a DNS resolver, usually run by your internet provider or a public service.
- The resolver asks the system of DNS servers, starting from the top, until one that knows the domain answers with the IP address.
- The answer comes back, is remembered for a short time, and your browser connects to that address.
Useful things to know
- A domain has several records. An A record points a name to an IPv4 address, and an MX record says where email goes.
- Changes to DNS can take time to spread because of caching. This delay is controlled by a value called TTL.
- Many "the site is down" problems are actually DNS problems.
Try it yourself
In a terminal, run nslookup example.com (it works on Windows, macOS and Linux). Look for the IP address in the answer. Try another site and compare.
Summary
- An IP address identifies a device on a network.
- DNS translates domain names into IP addresses.
- Lookups use caches and resolvers, so changes can take a while to spread.
Lesson complete
+20 XP
Nice work. Keep going while it is fresh.
Sources and further reading