In the modern world of wireless fidelity, we all sit at home or work with our devices connected to the router, and we get all the resources we request from it.
You won’t ever get the wrong data packet if the sender gives the right address and all your files get to you.
So how does a router coordinate the massive traffic that goes into and out of a network? How is it that everyone gets their data without mix-ups? Let us go under the hood and see how a router works;
How Do Routers Forward Packets?
Understanding the inner workings of computers and their components can be quite fulfilling and helpful in computer science.
One of the biggest uses of computers is data sharing, and routers are a big part of this, so you should understand how they work;
Hosts in computer networks transmit data files to other networks over routers, and it is the job of a router to get the packet to the receiver.
Unlike a hub, a router has to send the file only to the intended recipients, so it needs to know the recipient’s address in a network.
On the internet, every device has an IP address. Phones, laptops, computers, routers and any other device connected to the internet has a unique IP address that a router can use to identify it.
Data files can’t be sent as a whole, so the computers have to break them down into packets. These packets are faster and easier to transmit wirelessly.
When a computer sends data to another computer in a different network, the packets have the receiver computer’s IP address in their header. Each router uses a forwarding table to map the transmission of data.
The table maps the portion of a computer’s IP address to the router’s link interface. When a router receives a data packet, it matches the prefix of the recipient’s IP address with the entries present in its forwarding table.
The router then forwards the packet to the corresponding outbound link in its forwarding table. If the link is not in its table, it will forward the link to a router for a different network to search for the recipient IP address.
Routers work the same way you would if you go to a place, but you don’t know the route. You would go asking people until you got to where you needed to go. In this case, you are the data packet, and the people you ask for directions are the routers.
This way, data can go through multiple routers, but only the intended IP address will access it. The speeds will vary depending on the router configurations, but the basic working is forwarding packets.
What Is Packet Switching?
Packet switching is the basis of the working of routers. You, therefore, need to get a deeper understanding of what packet switching is since it will give you a better idea of what packet forwarding works in a router.
All applications that require the internet to function are called network applications. The hosts of these applications need to transmit data to one another over the net. This data can be video, audio, text or any other file type.
Instead of transferring an entire data element at once, the transmitting computer divides it into smaller data units; these units are called packets.
These packets will then get transmitted over a network to reach the designated host and get reassembled.
Routers or link-layer switches can work as packet switches in a network. The transmission of data packets in the form of small data packets is called packet switching.
Consider hosts A and B connected through a router and A wants to send data to B. Host A divides the file into three packets, with each packet having a size of L bits and moving at R bits/sec.
Therefore, the time needed to move one unit is L/R sec, and before this time is attained, the router would only have received a portion of the data. A router cannot forward the packets to the host until the whole packet gets to it.
It has to keep the packet until the others get to it, then it will push it to the receiver Host B. If the propagation delay is 0, then the router will receive and send the files to B at the same time. If there are numerous links, then the packets will have a longer delay time.
Once the first packet gets to the router, it sends it to host B while host A starts sending the second data packet to the router.
As B receives the first packet, the router receives the second packet, and this process repeats until all packets get to B.
If host A transmits at a speed equal to or less than the router’s, there won’t be a queuing delay. However, if the router is slower than host A, there will be a delay since host A will have to wait for the router to transmit before sending another packet.
The packets waiting to be sent are stored in the buffer, but the buffer has limited space. When a packet is sent and the buffer is full, either the incoming packet or one in the buffer will get dropped off; this is called packet loss.
What Is An IP Address?
IP addresses are used to transmit data between computers; thus, you should understand what an IP address is and how you can find yours. Each computer and smartphone has an IP address so let’s get into it;
Computers over the internet connect through underground cables or wirelessly. If you need to download a file from the internet, your computer needs to have an IP address.
This will enable other computers on the internet to locate your computer and send the download to it. The IP address is a series of numbers written in a certain format and can identify a computer on a network.
The internet protocol address is, in essence, your home address on the internet. Without the IP address, you would not get any resources from the internet since the servers will not know where to send the data you request.
Types Of IP Addresses
There are two types of IP addresses in use currently. Considering the number of internet devices on the planet, you must be wondering how there are enough addresses for each device so let’s get into it and give you an answer;
IP Version 4
IPV4 is made of four numbers separated by dots. Each number can range from 0 to 255 in decimal numbers, which is 00000000-11111111 in Binary. So each number is represented by eight binary digits.
This means that the whole address is represented by a series of 32 1s and 0s, simply a sequence of 32 bits, making IPV4 a 32-bit address. Since Binary has only two numbers, only 232 devices can have a unique IP address.
This brings the number to approximately 4.2 billion devices. This is a problem because there are many more devices on this planet than 4.2 billion, which leaves out more devices. This inadequacy brings up the need to use the IPV6 address, which is getting more embraced.
IP Version 6
IPV6 is a 128 bit IP address system; it is represented as a group of eight hexadecimal numbers separated by colons.
In Binary, this kind of IP address is written as a series of 128 1s and 0s, and each unique sequence is given to an internet device.
This system produces a possible 2128 IP addresses, which means that it will account for trillions of devices both now and in the future. If the number of devices ever surpasses the IPV6 values, then another version will be added to support that.
If you want to know your device’s IP address, you can go to any browser and type in “what is my IP” in the Google search window. The first series of numbers on your result page would be the public IP address for your device.
Conclusion
Routers break down data into smaller units called packets, and these packets are transmitted from the senders to recipients. Packet forwarding and packet switching are the basic concepts used in data transmission over routers.
A router gets the address for the receiver from the data packet and forwards the packet to that device.
If the intended address is not on a router, it will forward the packet to another router to search in its directory until the recipient is found.
IP addresses are used to identify each computer from the other. Your device must have an IP address for you to use the internet. Luckily, all devices made to connect to the internet come with IP addresses, so you don’t need to worry about it.