What is Routing?
Routing is the process of moving data across different networks or internetworks between hosts. Information is transmitted according to the IP networks and individual IP addresses of the hosts in question. You can read here what is computer computer network, its components and how does it works
A router is a device that connects two or more networks or subnetworks. It serves two primary functions: managing traffic between these networks by forwarding data packets to their intended IP addresses, and allowing multiple devices to use the same Internet connection by maintaining tables of information about other routers on the network or internetwork
In this diagram, we can be able to see one router that connects two different LANS and its able to relay data from one LAN network to another, the process that we call routing.
Routing works by choosing the best path for data packets to take across a network when traveling from one computer to another.
The routing process usually directs forwarding on the basis of routing tables. Routing tables maintain a record of the routes to various network destinations. Routing tables may be specified by an administrator, learned by observing network traffic or built with the assistance of routing protocols.
How does network routing work?
- Step 1: Computer sends a data packet to a router: – Computers attach IP addresses to packets just like you put an address label on a physical parcel. Routers use these addresses to work out the best routes. The origin computer usually connects to a local area network (LAN), while routers send packets from a LAN to another large network.
- Step 2: Router receives the packet and reads its IP address: – When a router gets an incoming packet of data, it pays attention to the IP address. Comparing this to internal routing tables, routers are able to establish which is the best route via which the packet should go.
- Step 3: Router forwards the packet: – Router uses route information to work out the next best network to help the packet take the next hop closer to its destination. The final hop count is the number of times a packet hops until it reaches the target.
- Step 4: The process repeats: – When the packet reaches a new network, a whole new router decides the next best hop for it to take. Because of this, routes that packets take are rarely direct. However, thanks to routing protocols, they are fast and efficient.
- Step 5: The final router sends the data packet to the destination computer: – When the data packet finally reaches a router in the same network as the destination address, it can route it directly to the device or server it was sent to.
So what does this look like in practice?
- For instance, when you send an email from a laptop connected to your office LAN, your LAN router receives instructions about the destination IP address. At this point, the email’s IP packets reach the edge of your LAN network.
- Here, your LAN router decides the route the email should take based on its routing table, sending it to the next network on its path.
- Because it’s unlikely that your LAN network directly connects to the destination network, the data packets will encounter different routers on their route in the internet. These other routers check the destination IP addresses of data packets passing their way and reroute them accordingly.
- Eventually, the email reaches a router connected to the server hosting your recipient’s email, which routes it to its final destination.
Packet switching is a digital connectionless network transmission process in which data is broken into suitably-sized pieces or blocks called packets for fast and efficient transfer via different network devices. See the diagram below for illustration where data from the sending computer is broken down into several packets while still on transit before reaching its destination, the receiving computer.
For example, when a computer attempts to send a file to another computer, the file is broken into packets so that it can be sent across the network in the most efficient way. These packets are then routed by network devices to the destination.
Process of packet switching
Each packet in a packet switching technique has two parts: a header and a payload. The header contains the addressing information of the packet and is used by the intermediate routers to direct it towards its destination. The payload carries the actual data.
A packet is transmitted as soon as it is available in a node, based upon its header information. The packets of a message are not routed via the same path. So, the packets in the message arrives in the destination out of order. It is the responsibility of the destination to reorder the packets in order to retrieve the original message.
Why Packet switching?
- Delay in delivery of packets is less, since packets are sent as soon as they are available.
- Switching devices don’t require massive storage, since they don’t have to store the entire messages before forwarding them to the next node.
- Data delivery can continue even if some parts of the network faces link failure. Packets can be routed via other paths.
- It allows simultaneous usage of the same channel by multiple users.
- It ensures better bandwidth usage as a number of packets from multiple sources can be transferred via the same link.