Understanding Network Devices
Introduction (High level View) :
Internet is massive global system of interconnected devices. It is made up in layers.
Lets see the Layers of Internet :
Layer 1 : The Backbone (Tier 1 Network) :
Internet is a massive global system .Companies like AT&T, Verizon, Lumen, TATA Communications own the submarine cables (Thick fiber optic cables on the bottom of ocean) and the fiber lines across the country.
These companies connect their network together in buildings called IXPs (Internet Exchange Points). They agree to each other to share data for free. (like “If you will carry my traffic, then i will carry yours“).

Layer 2 : The Middleman (Tier 2 Network) :
National Companies like Jio/Airtel in India and Comcast in US. These companies don’t own the submarine cables they pay the Tier-1 Network provider companies to use their network for sending data across the world.
Layer 3 : The Final Destination (Tier 3 Network) :
Your Local ISP. Which brings the fiber cable to your home. It pays to the Tier-2 network providers.
or You paying directly to the Tier-2 Network providers. (Jio/Airtel).
What’s the difference between the Internet and the WWW?
These two things are not same. Internet is like the hardware. The Massive global system of interconnected networks. Whereas the WWW is like the software running on the top of internet. WWW Consists the HTML, CSS and images that are on the internet using HTTP protocol.
We can use the internet without WWW. Like sending an email via SMTP. But we can’t use the WWW without the internet.
Why Do we need to know all of this?
Whenever you surf internet and opens a webpage. It instantly opens. But behind the scene it has covered a long physical journey. It travels through real copper wires, fiber optic submarine cables, and a lot of network devices in between (like modem, router, switch, firewall, load balancer etc.)
So In this article we will study about these devices. What they do? How they do?
Network Devices :
The Modem (The Translator) :
SO, Problem is that the devices we use or the computer uses the digital signal (Binary 0s and 1s). But whereas the cables and wires which connects these devices to the internet uses Analog Signals (Continuous wave of voltage, light or radio frequencies). Because of which these devices/computer and the cables/wires are not able to directly carry each other’s signals.
So, we need a device which can convert digital signals into analogs for wires/cables and analog signals into digital for computer/devices.
Here comes the Modem, It works like a translator. It performs two jobs :
Modulation (Sending) : It takes the packet (digital signal) from your computer/device and modulates it or we say converts it into analog carrier wave to send it to ISP.
Demodulation (Receiving) : It receives the packet (Analog Signal) back from ISP. It reconstructs it into the digital signal (0s and 1s).
Imagine we have a person who speaks in French and a Person who speaks Hindi. Both of them don’t know each others language. So, we need a translator between them. who know both’s language and can translate for both of them. (like using google translator).

The Router (The Navigator) :
Our ISP (Internet Service Provider) provides us a Public IP address (which is unique globally and visible to world). But in our home we may have multiple devices (like laptop, phone, playstation etc) which require to access the internet. But for sending and receiving data (packets) how do we distinguish which device is communicating to the internet at that time.
So to solve this problem we use a network device router that act as gateway. It connects two or more different networks together (usually the Local Home Network and the Global Internet).
It is not just a connector. It is an intelligent device that manages traffic. It decides which device will get which IP address, where the packet go?.
Router Working :
Ports of Router:
Router has many ports. let’s see about them :
The WAN(Wide Area Network) Port :
It is usually in blue/yellow color. It connects to the modem (which connects to the ISP).
This port holds our public IP (e.g.
103.1.1.1) This is the address which is visible to internet/world.The LAN(Local Area Network) Port :
It is usually in black/orange color. These are usually 4 ports in a router. These ports connects to our devices (like laptop, pc, TV etc.)
These ports have a built-in switch. They all are connected together internally. Here router assigns itself an IP address the Gateway IP (e.g.
198.168.1.1).
Three Functions of Router :
DHCP Server (Dynamic Host Configuration Protocol) :
When your phone connects to the Wi-Fi, it has no id with which it can communicate.
The router runs the DHCP program which checks all the available IP addresses (e.g.
192.168.2to192.168.254) and then assign a unique private IP address to your phone. Let say it assigned192.168.5IP address to your phone.NAT (Network Address Translation) :
When your phone (
192.168.5) wants to communicate with internet. Here comes the problem It has private IP. Which can’t exist over the public internet.So, router does what it fetches the packet from your phone. It swaps its private IP with Public IP before sending the request.
When Internet replies it replies to your public IP. router checks the NAT table -which keeps the track of active conversations and send it back to your phone.
The Routing (Packet Forwarding) :
It finds the direction of the packet. When a packet arrives to the router. It checks its destination IP and the routing table -which keeps the address of connected networks. If it is something like (
192.168.1.x) It send the packet to the LAN Port. If it is something like (0.0.0.0) or anything else it send it to the WAN port.

HUB VS SWITCH :
These are the devices which has multiple ports to connect multiple devices together to a local area network (LAN). For example, in office or in a Computer Lab.
A) HUB (The DUMB Box) :
It act as the central connection point. On receiving incoming data packet, it broadcast (send to all) it to
every connected port.
Due to which it lead to traffic (collisions) and insecure as it broadcast to every port.
“It is just like a teacher who announces your test marks openly in front of whole class instead of telling you privately.”

B) Switch (The Smart Box) :
It has a memory called MAC Address Table.
When we connect a device to switch. It store that device’s MAC Address (hardware ID) in this table.
So, when ever a device want to send packet to another connected device. switch opens a direct path only between those two devices. Preventing collisions and securing the data transfer.
It allows multiple conversations to occur at the same time.
It is opposite from the HUB. It is the teacher who tells your test score only to you not in front of whole class.
Firewall (The Guard) :
As you know the internet is full of malicious bots and hackers which always tries to find open door(port) to your server. So they can hack into your system.
So, to solve this we use Firewall. A firewall act as filter between a trusted network (your) and an untrusted network (internet). It inspects each packet. It blocks malicious, unauthorized data or cyber threats on rule based filtering.
Hardware Firewall : A physical device that sits before the router.
Software Firewall : An application on the OS like ufw in linux and the Windows Defender in Windows.
“Firewall is just like the Guard at Your College gate. Checking each student’s Id. Allowing only your college’s students and restricting outsiders.”

Load Balancer (The Distributor) :
Imagine you made a website. which went viral. Now 1,00,000 of users trying to login in your website at the same moment. But you have a single server(Computer) which has limited RAM and CPU. If it exceeds the potential of server the server will crash.
So, you decide to use 10 servers instead of a single server. but now the problem is that how to evenly distribute that huge traffic of 1,00,000 users among these servers.
Here, Comes the Solution The Load Balancer. It sits in front of your servers and act as reverse proxy. It do two jobs :
Distribution : It receives the incoming request and forwards it to the healthiest server based on algorithm (like server 1, then server 2, then server 3 ….)
Healthy Checks : It constantly keep checking the servers. If server 3 crashes it stops sending traffic to the server 3. Preventing user from seeing error page.

Putting all Together (Real World Flow) :
1) User (you) side :
You make a HTTP request with your laptop.
Switch : Connects the laptop to the local network.
Router : Swap the private IP with public IP and Send next.
Modem : Convert digital packet into the analog signal for the wire/cables.
2) The Internet (ISP) :
- The signal travels through the IPS’s infrastructure(fiber cables/wire) to reach the destination data center.
3) The Data Center (server side) :
Firewall : Scans the packet. If it is safe it passes.
Load Balancer : Receives the packet. send it to the free server (e.g. Server 5).
Switch : Directs the Packet towards the Server 5.
Web Server : Process the request and sends back the website.