Blog

IP and Mobile Trends and Education

 

How does router work?

Author:


04.01.2018

As you might be aware, bits are a form of language for machines and packets are series (groups) of these bits that traverse the network. The mechanism via which these packets travel across the network is organized thanks to Internet Protocol (IP is set of common rules, structures and descriptions). In general, we have: END DEVICES (like laptops or smartphones) which produce SYMBOLS that we call BITS and form them into IP PACKETS ready to be sent away. The more the amount of information to be transmitted, the more amount of bits needs to be sent and more packets to be formed.

 

how does router work part1

 

These IP packets are sent along their path in the Network, which consists of routers responsible for proper packet routing towards destination.

How does router work p2

 

Now, what is so specific within IP packet that allows routers to understand which way to route the information(bits)? Every device sending and receiving IP packets has own unique address called simply, IP address. IP address is like our postal home address. Let’s look at an example: If someone wants to send a post card from Chicago to Atlanta he needs to write the destination postal address in Atlanta on the envelope. If such envelope gets to Chicago post office, it is checked against the destination postal address and forwarded to the Atlanta Post Office. Atlanta’s PO knows where to deliver the envelope based on destination postal address (which is local to Atlanta Post).

 

routers explained

 

The aim of IP address is very similar to postal address – it locates the sender and receiver within the network.

 

ip address

 

Because routers know the path towards destination they can forward the packets in the right direction! So when we think that routers are like post offices we can understand the so called routing process.

 

routing process

 

So far so good. but how does a router work and know how to route the packet?

 

How does router know where to route the packet?

Let’s take a closer look into router components and routing process. Routers have ports or more precisely interfaces that are interfacing with other network devices. Interfaces connect the links that are used in packet forwarding. Links can be cable, fiber or even wireless.

 

Routing process

Routing process:

  1. When a packet is coming on interface (ingress interface), the router needs to know which interface it has to use to send out the packet (egress interface).
  2. Router checks this against the ROUTING TABLE which has entries related to each known DESTINATION
  3. Each Routing ENTRY stores Destination ADDRESS and address of next device on the path called NEXT HOP device
  4. Now, having NEXT HOP address, router can determine the outgoing interface and sends the packet!!!

 

This is how it looks with the exact addressing:

routing towards destination

 

1. Device A sends the IP packet to device B which has address of 192.168.1.20. Such packet includes the destination IP Address (in packet header) of device B.

2. Packet comes to the Router 1 interface. Router analyses the destination IP of the packet  which is 192.168.1.20

  •   then performs the lookup into its routing entries to find the best matching destnation
  •   finds that to get to IP of device B packet should be sent out via Router 2 (via 10.254.2.1)
  •   then checks that the Router 2 is accessible on Interface 2
  •   now router has all information to send out the packet and sends it

The same process happens on every router along the path to destination.

How these rules apply to real life?

You may raise a question: does this theory apply to every (routing) device on the Internet? In short: yes. Imagine your Internet access at home. 99% of you have something like a WiFi router (like D-link, TP-link, Linksys, Cerberus, small Cisco etc.) you bought on ebay or your Internet provider lent/sold it to you. This kind of device is also router that uses described rules for packet routing. Such devices are not prepared for large networks, heavy utilization and performance but logic is the same. The logic in your small device at home  is: for all destinations (all IP addresses are marked as 0.0.0.0/0) route packets via 10.254.3.1 (just example) which is your ISP directly connected router. As simple as that.

 

Home wifi router

 

Stay connected and read next post on how does a router use routing table in detail!

To see other posts on network and wireless fundamentals see our explained section.

To subscribe to our mailing list for our online platform where you can learn all this visit GrandmetricWatch. We will let you know when it will be live.

Author

Marcin Bialy

Marcin Biały is Network and Security Architect with over 12 years of experience, with Service Provider and Enterprise networking background. He used to work for large service providers, global vendors and integration services companies as Network Architect, Leading Architect and Techincal Solution Manager positions. He designed, implemented and supported dozens large scale projects and infrastructure migrations, solved hundreds of tickets and spent hours with CLI and GUI of many flavors. Marcin is also holding industry recognizable certificates such as CCNP, CCNA, CCSI #35269, FCNSP #7207, FCNSA and more.

2 Comments
Fatemeh
12 September 2018 at 19:21

Nice explanation. Thank you for your great work!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code


 

Newsletter