What is Routing in Networking, and How Does Routing Work?

Routing in networking is used to connect devices and systems worldwide. Routing’s primary job is to take data packets from one network and send them to another network. As network traffic grows, efficient and accurate routing is crucial to ensure data is delivered to the correct destination on time and with minimal or no losses. The recent Facebook outage was one eye-opener of how critical routing is. This article talks about routing in networking and discusses routing devices or routers, routing tables, different types of routing, and routing protocols.

What is routing in networking?

IP Routing in networking is the process of determining an IP-based path to a destination and moving data across this path from source to destination. It uses routers, routing tables, routing protocols, and algorithms to determine the most efficient path for forwarding the IP packet.

What is Routing in Networking and How does routing work?

Let us understand routing by the below real-world example.

To make the example simple and more routing centric, let’s remove the NAT possibility and take a scenario where your home computer and friend’s computer have public IP addresses directly configured on the Network Interface Cards(NICs).

Now let’s say you want to upload a file through FTP from your computer in your home to your friend’s FTP server. The first thing that would happen is that your computer’s host routing table would determine whether to send a packet to the local network, to a specific router interface, or to the default gateway address. Although it is a default gateway in most cases, you can check routes installed on your Windows PC by typing “route print” inside the command prompt.

Then the next step is for your home ISP router to determine the best path to take you to your friend’s ISP router. In our case, it will take the shorter route through ISP-1 Router –> ISP-2 Router (at the top), or it might take the longer path with less latency through ISP-1 Router –> ISP-3 Router –> ISP-2 Router (at the bottom). Routers are special devices efficient in making these kinds of routing decisions based on routing algorithms. Then this routing information is stored in routing tables on all the routers involved between you and your friend’s router. Routing tables help identify the best possible path to move data to the next hop.

Once the routing process has determined the best path, the first packet is forwarded along this path.

The above process happens again on your friend’s PC and home ISP router when the FTP server wants to connect to the FTP client running on your computer.

When both sides of the computers and routers know the best path to reach each other, FTP establishes the full connection (remember TCP three-way handshake), and then you can upload the file to the FTP server at your friend’s house.

What is a Router?

Router
Router Icon

A router works on layer 3 (network layer) of the OSI reference model, and it is a device that does routing, or you can say it routes packets between two or more computer networks. It does that by maintaining a long list of all its known routes in a table called a routing table.

Switches, hubs, and bridges work on layer 2 (data link layer) of the OSI model and are primarily used to distribute packets or frames on a local network or within a LAN. Devices on the LAN must forward the IP packet to a more Intelligent device (a gateway or a router) if the destination’s address is not within the local network’s scope, for example, the Internet.

Why do routers use a routing table?

Routers maintain an internal routing table to record all the known IP subnets and their corresponding current paths. The routing table helps routers decide how to route or send packets across network links to the correct destination—more on the routing table in the next blog post.

The routing table on a Cisco router or any other vendor’s router is called the Route Information Base (RIB). RIB information is presented in a formatted form when you type the “show ip route” command.

How does routing work?

When an IP packet reaches a router, the router opens the packet and checks the destination IP address to determine if it needs to be forwarded to another network or not. Then, the router checks the routing information base (RIB) to see if it contains a route to the destination network.

A typical IP packet field.

IP Packet Field Details

The packet is modified and forwarded through the appropriate interface if a match is found for the destination address. If no match is found in the routing information base (RIB), the packet is sent to the default gateway if one exists. If there is no default gateway, the packet will be dropped.

Let’s talk more about what happens when the match is found in the router’s routing table for the destination IP address. A router forwards a packet in three steps:

  1. Routing finds the next hop and the exit interface.
  2. The switching path switches or moves the packet across the backplane.
  3. The last step is to find and rewrite the layer2 address inside the IP packet, and then the packet is switched to the next hop via the outgoing interface.

I will write more about routing and switching paths in my next blog post.

What are the types of routing?

There are three types of routing.

  1. Static Routing
  2. Dynamic Routing
  3. Default Routing

What is Static Routing?

The name suggests that it is static, which means it does not update automatically as network conditions change. Instead, network administrators manually create static routes one by one.

Advantages of Static Routes:-

  • Static Routes are straightforward and not a burden on the router’s CPU so you can use a less expensive router.
  • Because only the system administrator has the authority to permit routing to specific networks, it increases the level of security.
  • Static routing is not chatty like Dynamic Routing as there is no transfer of data between the routers to track neighborship or exchange routes; this saves router CPU and memory.

Disadvantages of Static Routes:-

  • Adding each route manually to the routing table on a large network can be tedious for network administrators.
  • Static routing is more prone to routing loops than Dynamic routing.
  • In static routing scenarios, network administrators must have a good understanding of network topology. For a newly hired network administrator, this will become a nightmare to manage each route and device manually.

What is Dynamic Routing?

Contrary to static routes, dynamic routing automatically changes routes based on the state of the routing table in real-time.

Dynamic routing uses routing protocols to discover network destinations and determine the best paths to reach them based on various metrics – such as bandwidth, hop count, etc. In addition, routing protocols help build dynamic Routing Tables that are automatically updated as network conditions change.

The routing algorithms are the core part of routing protocol and are used to calculate the best route for an IP packet between two network nodes. There are three main routing algorithms: hop-by-hop, distance Vector, and Link State.

Some of the standard Dynamic routing protocols are:-

  1. Router Information Protocol – RIP
  2. Open Shortest Path First – OSPF
  3. Enhanced Interior Gateway Routing Protocol – EIGRP
  4. Intermediate System to Intermediate System – IS-IS
  5. Border Gateway Protocol – BGP

Advantages of Dynamic Routing:-

  • The setup process is short.
  • Choosing the best route to a remote network and discovering the remote network is more efficient with this dynamic routing.
  • As soon as the topology of the network changes, the router notifies all the other routers about it.
  • A dynamic Routing algorithm can generally detect and eliminate loops by reconfiguring routing tables.
  • Routers must be running the same dynamic routing protocol on both sides to exchange routes. For example, if a router on one side uses OSPF, then the other router must also use OSPF, or a neighborship will not establish.
  • Routers can use plain text passwords or MD5 passwords to establish a neighborship to enhance security.

Disadvantages of Dynamic Routing:-

  • Dynamic routing consumes more bandwidth to communicate with neighbors and maintain routing tables.
  • Convergence is another issue. If a larger network uses dynamic routing, then a change in one router’s routing table may take some time to propagate to all other routers in the network; this can lead to routing issues, and traffic congestion as temporary routing loops are created, and inferior network paths are chosen.
  • Although as a pre-requisite, routers on both sides must be running the same type of dynamic protocol to establish neighborship and exchange routes. But if a hacker somehow sniffs the type of dynamic protocol running, they can manipulate packets to hack the network.
  • Static routing is manual and hence more secure than dynamic routing.

What is Default Routing?

Default routing is used when a router is set up to send all packets to a next-hop single router. No matter which network the packet belongs to, it is sent to the router with a default routing setup.

Most of the time, stub routers use it. A stub router only has one way to connect to other networks. Additionally, routers or firewalls connected directly to the Internet use default routing to send all IP packets to ISP Internet routers.

Advantages of Default Routing:-

  • Default routing is easy to set up, and that is why it is mainly used in stub and home networks.
  • In most cases, the home router has a default routing preconfigured by default so that it can be initialized automatically when the router is powered on or rebooted.

Disadvantages of Default Routing:-

  • Because it forwards all packets towards a single router, it is prone to network attacks.
  • Default routing can also cause routing loops when packets from one device are sent to the default router and sent to the destination device. Routing loops happen due to the lack of granular, more customized, and specific paths.

Static Routing and Default Routing Configuration Example

Static Routing and Default Routing Sample Topology and configuration Example

Static Route Configuration on Cisco Routers:-

Static route syntax is “ip route (destination network) (destination subnet) (outgoing interface or next-hop Ip address)

For Router-2 to reach Networks 192.168.1.0/24 and 192.168.10.0/24 behind Router-1 and Router-3, respectively, Router-2 will need below static routes.

Router-2#configure terminal

Router-2(conf)#ip route 192.168.10.0 255.255.255.0 192.168.3.3

Router-2(conf)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

Router-1 and Router-3 will also need routing to reach back to the subnets on Router-2. We have used default routing on Router-1 and Router-3 to achieve reverse routing.

Router-1#configure terminal

Router-1(conf)#ip route 0.0.0.0 0.0.0.0 192.168.2.1

Router-3#configure terminal

Router-3(conf)#ip route 0.0.0.0 0.0.0.0 192.168.3.2

Conclusion

In conclusion, routing is the backbone of modern computer networks. The routing table inside routers plays a crucial role in sending packets from source to destination. Routing tables can be updated manually through static routing or automatically through Dynamic Routing Protocols. I hope you like the article, Thanks for reading.

Frequently Asked Questions (FAQs)

What is the function of routing?

Routing is all about finding an IP-based network path to deliver data from one point to another. Routing uses routers, routing protocols, algorithms, and routing tables to forward data efficiently.

What are some benefits of using routing in networking?

Some benefits of routing in networking are:-

  • Routing allows packets to be forwarded from one network interface to another based on their destination addresses.
  • You can also use routing for various purposes, including security, load balancing, and traffic management.
  • It ensures that the traffic sent to a particular destination is routed correctly by determining the most efficient path for forwarding the IP packet.
  • Routing can handle network changes and adjust its routing table accordingly.
  • It also allows you to direct traffic to specific applications or servers; for example, you can divert the normal traffic flow to specific devices with the more specific longer prefix static route (for example, a /32 route).
  • Routing is also used to determine the path taken from source to destination using utilities like traceroute.

What are the best practices for routing in a networking environment?

Some of the best practices for routing are:-

  • Use Dynamic routing protocols like OSPF, EIGRP, or IS-IS instead of Static routing to avoid manual updating the routing table every time something changes.
  • When using Dynamic routing, avoid using RIP due to its limitation on multiple technologies.
  • Use supernet to combine multiple contiguous subnets, making the routing table smaller and manageable.
  • Use a network map to visualize the different network paths available in your network topology. You can either create layer three and layer two diagrams manually or use management software to produce a network map dynamically.
  • Use robust layer three switches or routers with the appropriate CPU and memory to handle large routing tables.
  • Constantly monitor your network for any bottlenecks and adjust your routing methods accordingly to divert traffic towards better available paths.
  • Keep traffic patterns in mind when routing data traffic.

References

Routing – Wikipedia
Routing is the process of selecting a path for traffic in a network or between or across multiple networks. Broadly, routing is performed in many types of …

Leave a Reply

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