If your Internet connection starts acting up, the first thing you do is go up to your router, switch it off and turn it back on and in most cases, this fixes the issues you are facing. However, not a lot of us understand the role a router plays in connecting us to the Internet.
In this article, we will be looking at what a router is, what it does and how it connects you to the Internet.
Also read: How to find MAC address on Windows?
A router is a networking device which is responsible for managing traffic on your network. This traffic is in the form of data packets, and a router is responsible for sending each packet to the right destination. Apart from this, routers are also responsible for providing security and connecting different networks together.
Routers might not look like a sophisticated device from the outside, but like any other computing device, they are equipped with a CPU, RAM, and flash memory. All this hardware enables routers to route traffic efficiently and even run open-source firmware.
In a household setting, a router (residential gateway) connects different devices to create a Local Area Network. Once this network has been set up, all the devices in the network can communicate with one another over different communication channels.
Going one step further, if you want to connect your Local Area Network to the Internet, all you need to do is connect your router to an Internet Service Provider through a modem, and all the devices on your LAN can access the Internet simultaneously. Therefore, if you look at it, a router is your network’s gateway to the Internet and the first line of defence between the public or private network you’re connected to and through any other network on the web.
As a router is responsible for managing the traffic on a network, you can block traffic entering your network and assign priority in the way your traffic should be routed. In terms of security, your router can encrypt traffic, connect to VPN servers, and run NAT firewalls to protect your network from threats on the Internet.
Also read: What is an IP Address? How does it work?
How does a router work?
Each data packet sent on a network, be it a Local Area Network or the Internet, has an IP header attached to it, which contains information about the source and destination address for the data, and a router uses this information to send data to the right device.
When a data packet reaches a router, it looks at the destination IP address of the data packet and tries to find the best route. To find the route for a data packet, the router uses a routing table that contains information regarding the devices and networks connected to it and the fastest way to get to them. These tables are stored in the RAM and can be created dynamically using routing algorithms or statically by manual configuration.
Once the router has the best path to reach a device, it sends this data to a forwarding table which finds the MAC address and communication media to which the device is connected and sends the data.
For more complex networks like the Internet, routers share routing tables with one another using routing information protocols. This helps routers to use routing algorithms effectively, enabling them to find the fastest route to reach a device. This intercommunication of routers helps make the Internet reliable as routers can alter the path taken by a data packet if a path is over congested or is unavailable for data transfer
Also read: What’s the difference between IPv4 and IPv6?
What happens when your router connects to an ISP?
Once your Internet Service Provider connects to your router through a modem, the router is given a public IP address, and any device on the Internet can see this address. All devices on your network use this address as a gateway to connect to the Internet.
When a device connects to your router, it acts as a DHCP server and assigns a private IP address to every device. These private addresses can’t be seen by devices on the Internet as the router translates these addresses using Network Address Translation (NAT). This is why port forwarding is required to access devices on a Local Area Network through a router.
If you are curious and want to look at all the routers your data goes through when you are looking for a website, you can type the tracert command in the Windows command prompt alongwith the website you want to visit.