By this point, you understand the relationship between a client and a server. How can you be sure that a request ends up at the correct server, and vice versa for responses?
A helpful hint might be to think about how you navigate in real life!
Consider a scenario where you meet up with your friends at someone’s house. If you know your friend's name (I'd sure hope so), you’ll never say, “Let’s meet at 40 North 5th Street, Brooklyn, NY 11249.” You’ll say, “Let’s meet at John's house!” John’s house is a lot easier to remember than a physical address. This is true on the web as well.
Behind the scenes, each machine on the internet has an identifier called an IP (Internet Protocol) address. It’s a series of numbers that represent the computer itself. You know how your house has a numeric address, like 40 North 5th Street?
Your computer also has a numeric address, except it is structured as 4 numbers separated by dots, like 18.104.22.168, for example. Every website also has an IP address! For example, here’s OpenClassrooms’ IP address: 22.214.171.124.
Domain Name System
But as you know, to get to OpenClassrooms, you don’t enter the IP address; you just tell your browser to go to openclassrooms.com.
This is the most important complement to IP addresses: the DNS. DNS stands for Domain Name System, and it is a global system that takes and translates human-readable names like “openclassrooms.com” to specific IP addresses.
When your computer's browser sends the request for the page openclassrooms.com, the browser searches behind the scenes for the IP address associated with openclassrooms.com. Once the matching IP address is found, your request is then sent off to the correct place for a response.
Without the DNS lookup process, we’d have to rely on entering IP addresses in order to get to our favorite websites, which is not very practical. Google.com is much easier to remember, than, say, 126.96.36.199. Moreover, every website has at least one IP address associated with it.
By accessing pages on the web using human-readable URLs instead of IP addresses, you get to have your cake and eat it too, thanks to DNS. You never end up lost on the web, and you don’t have to worry about getting directions to your favorite sites!