IP routing
IP routing is performed on the data which describes the path that data follows to reach from
source to destination in the network. Through IP routing only the shortest path for the data is
determined to reach the destination which decreases cost and data is sent in minimum time. IP
routing uses different protocols and technologies for different networks. For IP routing we
require some basics of IP addresses, routers, and different networks.
IP Routing:
IP routing is the process that defines the shortest path through which data travels to reach from
source to destination. It determines the shortest path to send the data from one computer to
another computer in the same or different network. Routing uses different protocols for the
different networks to find the path that data follows. It defines the path through which data
travel across multiple networks from one computer to other. Forwarding the packets from
source to destination via different routers is called routing. The routing decision is taken by the
routers.
Terminologies:
Autonomous System (AS): The collection of networks managed and supervised by a single
entity or organization is called an autonomous system.
Router: A router is a device that forwards the data using routing through multiple networks.
Routing Table: A routing table is a table present in the router which stores the routing
information.
Different Types of Routing:
There are three different types of routing:
1. Static Routing
2. Dynamic Routing
3. Default Routing
Static Routing: In this type of routing the routing table is updated by the network administrator.
Dynamic Routing: In this type of routing the routing table is automatically updated using
routing protocols.
Default Routing: In this type of routing the router is configured to send all the data towards a
specific router. This routing is generally used with the stub routers.
How does IP routing work?
When the data is sent from the source to the destination the TCP and other protocols of the
source work and form an IP packet that is sent to the network. When an IP packet is sent to the
network from the source it has to pass through multiple routers to reach the destination. The
router in the network gets the destination address from the packet and through its routing table
identifies the next router information to which the data packet has to be passed. The routing
table of the router includes various information about the next router, its cost, and other
necessary information. The router takes the routing decision with the help of routing protocols
and a routing table to which next router the packet has to be sent to find the best route to reach
the destination. Different packets can be sent through different paths but all the packets reach
their intended destination. When the packets reach the destination through different routers it
sends them to the TCP for further processing.
Routing Protocols:
For taking routing decisions router needs various routing protocols and a routing table. The
routing protocols are divided into two domains:
1. Interdomain Routing protocols
2. Intradomain Routing protocols
Interdomain Routing Protocols:
This routing is used among the autonomous networks and it includes Path Vector
Routing(PVR).
Path Vector Routing:
Path vector routing uses path vectors for routing.
Border Gateway Protocol(BGP) is used in PVR for making routing decisions.
Types of Routing Protocol
Intra domain Routing Protocols:
This routing is used within the autonomous networks and it includes two types of
routing: Distance Vector Routing(DVR) and Link State Routing(LSR).
Distance Vector Routing:
Distance vector routing uses distance vectors for routing.
It uses the Bellman-Ford algorithm for the computation of various distances.
Routing Information Protocol(RIP) is used in DVR for making routing decisions.
DVR suffers from count to infinity problem which can be solved using split-horizon or
route poisoning.
Link State Routing:
Link State routing uses the state of the link for routing.
It uses the Dijkstra algorithm for the computation of various distances.
Open Shortest Path First (OSPF) is used in LSR for making routing decisions.
LSR suffers from heavy traffic due to flooding which can be solved by the TTL field.
Routing Tables in Computer Network
Routers:
A Router is a networking device that forwards data packets between computer network. This
device is usually connected to two or more different networks. When a data packet comes to a
router port, the router reads address information in packet to determine out which port the packet
will be sent. For example, a router provides you with the internet access by connecting your
LAN with the Internet.
When a packet arrives at a Router, it examines destination IP address of a received packet and
make routing decisions accordingly. Routers use Routing Tables to determine out which
interface the packet will be sent. A routing table lists all networks for which routes are known.
Each router’s routing table is unique and stored in the RAM of the device.
Routing Table:
A routing table is a set of rules, often viewed in table format, that is used to determine where
data packets traveling over an Internet Protocol (IP) network will be directed. All IP-enabled
devices, including routers and switches, use routing tables. See below a Routing Table:
Destination Subnet mask Interface
128.75.43.0 255.255.255.0 Eth0
128.75.43.0 255.255.255.128 Eth1
192.12.17.5 255.255.255.255 Eth3
default Eth2
The entry corresponding to the default gateway configuration is a network destination of 0.0.0.0
with a network mask (netmask) of 0.0.0.0. The Subnet Mask of default route is always 0.0.0.0 .
Entries of an IP Routing Table:
A routing table contains the information necessary to forward a packet along the best path
toward its destination. Each packet contains information about its origin and destination. Routing
Table provides the device with instructions for sending the packet to the next hop on its route
across the network.
Each entry in the routing table consists of the following entries:
1. Network-ID:
The network ID or destination corresponding to the route.
2. Subnet-Mask:
The mask that is used to match a destination IP address to the network ID.
3. Next-Hop:
The IP address to which the packet is forwarded
4. Outgoing-Interface:
Outgoing interface the packet should go out to reach the destination network.
5. Metric:
A common use of the metric is to indicate the minimum number of hops (routers crossed) to
the network ID.
Routing table entries can be used to store the following types of routes:
Directly Attached Network IDs
Remote Network IDs
Host Routes
Default Route
Destination
When a router receives a packet, it examines the destination IP address, and looks up into its
Routing Table to figure out which interface packet will be sent out.
How are Routing Tables populated?
There are ways to maintain Routing Table:
Directly connected networks are added automatically.
Using Static Routing.
Using Dynamic Routing.
These Routing tables can be maintained manually or dynamically. In dynamic routing, devices
build and maintain their routing tables automatically by using routing protocols to exchange
information about the surrounding network topology. Dynamic routing tables allow devices to
“listen” to the network and respond to occurrences like device failures and network congestion.
Tables for static network devices do not change unless a network administrator manually
changes them.
Route Determination Process (finding Subnet ID using Routing Table):
Consider a network is subnetted into 4 subnets as shown in the above picture. The IP Address
of the 4 subnets are:
200.1.2.0 (Subnet a)
200.1.2.64 (Subnet b)
200.1.2.128 (Subnet c)
200.1.2.192 (Subnet d)
Then, Routing table maintained by the internal router looks like:
Destination Subnet Mask Interface
200.1.2.0 255.255.255.192 a
200.1.2.64 255.255.255.192 b
200.1.2.128 255.255.255.192 c
200.1.2.192 255.255.255.192 d
Default 0.0.0.0 e
To find its right subnet (subnet ID), router performs the bitwise ANDing of destination IP
Address mentioned on the data packet and all the subnet masks one by one.
If there occurs only one match, router forwards the data packet on the corresponding
interface.
If there occurs more than one match, router forwards the data packet on the interface
corresponding to the longest subnet mask.
If there occurs no match, router forwards the data packet on the interface corresponding to
the default entry.
Route summarization
Example : Find the summarized route for the networks 10.1.1.0/24, 10.1.3.0/24, and 10.1.9.0/24,
1. Convert the IP addresses to binary:
- 10.1.1.0 = 00001010 00000001 00000001 00000000
- 10.1.3.0 = 00001010 00000001 00000011 00000000
- 10.1.9.0 = 00001010 00000001 00001001 00000000
2. Identify the common bits:
- The first two octets (10.1) are consistent across all three addresses.
- In the third octet:
- 00000001 (1) for 10.1.1.0
- 00000011 (3) for 10.1.3.0
- 00001001 (9) for 10.1.9.0
- The first four bits of the third octet are common: 0000.
3. Summarized Network Address:
- The first two octets (10.1) and the first four bits of the third octet give us:
- This results in 10.1.0.0.
4. Determine the new subnet mask:
- The original subnets were /24.
- We have four bits of the third octet plus the full two octets, resulting in a prefix of /20.
The summarized route is 10.1.0.0/20.