What is the Internet?
To understand what the purpose of a router is, we also have to understand how the internet functions. It may seem a little complicated, but when you break it down, it really isn’t.
The internet is a wide area network of different servers and different networks all over the world. They connect to each other at millions of different points, making a web, hence the name, World Wide Web. To talk to each other, these networks use a specific language called TCP/IP, which stands for Transmission Control Protocol/Internet Protocol. This language is designed specifically for networks, and allows all the different devices in the world to talk to, and understand one another.
The fundamental part of internet traffic is called a packet. It contains a header, payload and other information not relevant to us right now. The header is like the destination zip code. It is the IP address of where the packet is going, which tells the network where to send it. The payload is the actual data being transported, which could be part of an email, a file segment or a request for a new web page, anything really.
Networks, large and small are all controlled by routers. They route traffic, hence their name. They have large databases called "IP Tables" which can hold millions of IP addresses. The router looks at the header of a packet and checks to see if that IP address is connected to it. If not, it looks to see which of its other network connections is the quickest way to that destination. It chooses the next router in the chain and sends it along. This process is repeated all along the chain or "network path" until the packet has reached the destination computer. While this may seem a laborious task, it actually happens lightning fast, and only adds milliseconds to the average journey time.
Letter and Numbers
Imagine you go into a hotel looking for someone who is supposed to be visiting your town. You ask the receptionist if Mr Smith is staying there. The receptionist looks at the records to see if he is there and tells you he isn’t, but suggests there might be a Mr Smith in the next hotel along. You go to the next hotel and ask the receptionist for Mr Smith. This process is repeated until a receptionist you ask finds a Mr Smith in the hotel and sends you to his room.
In this analogy, you are the packet, and the receptionist is the router .
To explain a little more, say you’re surfing the net at www.brighthub.com. To get there, you typed the address into your browser, or clicked a link to it. Your browser knows that to get to Bright Hub it needs the IP address of it. To get anywhere the computer needs to know the IP address of the destination. The names are only for us humans.
Each internet provider has DNS servers, or Domain Name Servers, which are databases of domain names. This database is a massive list of what domain name can be reached by what IP address. These servers compare www.brighthub.com to its list and finds that one is 220.127.116.11.
These lists are constantly refreshed with new information, and if that DNS server doesn’t know what IP address belongs to www.brighthub.com then it will query the massive DNS servers in the internet core which holds all the records for all the websites in that country.
Finding the IP Address
The server reports back to your computer and tells it to get to Bright Hub it needs to send all packets to 18.104.22.168. Once this query has been done, all traffic is then routed from your computer to the internet routers. The router will query its IP tables and see where to send traffic so it can get to 22.214.171.124. This is repeated along the whole journey until the last router in the chain recognizes that the IP address is attached to it, and sends the traffic to the server.
Home routers work in exactly the same way, just on a smaller scale. It will know what computers are connected to it, and what IP addresses they have. When traffic comes in with a specific destination, the router knows exactly which computer to send it to, completing the cycle described above.