What is IP routing?
IP routing is the process of sending packets from a host on one network to another host on another, remote network. This process is done by routers. Routers examine the destination IP address of a packet , determine the next-hop address, and forward the packet.
Routers use routing tables to determine a next hop address to which the packet should be forwarded.
Consider the following example of IP routing:
Host A wants to communicate with host B, but host B is on another network. Host A is configured to send all packets destined for remote networks to router R1. Router R1 receives the packets, examines the destination IP address and forwards the packet to the outgoing interface associated with the destination network.
A default gateway is a router that hosts use to communicate with other hosts on remote networks. A default gateway is used when a host doesn’t have a route entry for the specific remote network and doesn’t know how to reach that network. Hosts can be configured to send all packets destined to remote networks to a default gateway, which has a route to reach that network.
The following example explains the concept of a default gateway more thoroughly.
Host A has an IP address of the router R1 configured as the default gateway address. Host A is trying to communicate with host B, a host on another, remote network. Host A looks up in its routing table to check if there is an entry for that destination network. If the entry is not found, the host sends all data to the router R1. Router R1 receives the packets and forwards them to host B.
Routing tableEach router maintains a routing table and stores it in RAM. A routing table is used by routers to determine a path to a destination network. Each routing table consists of the following entries:
1. network destination and a network subnet mask – specifies a range of IP addresses
2. remote router – IP address of the router used to reach that network
3. outgoing interface – outgoing interface the packet should go out to reach the destination network
There are three different methods for populating a routing table:
• directly connected subnets
• using static routing
• using dynamic routing
Each of this method is described in the following chapters.
Consider the following example. Host A wants to communicate with host B, but host B is on another network. Host A is configured to send all packets destined for remote networks to the router. The router receives the packets, checks the routing table to see if it has an entry for the destination address. If it does, the router forwards the packet out the appropriate interface port. If the router doesn’t find the entry, it discards the packet.
As you can see from the output above, this router has two directly connected routes to the subnets 10.0.0.0/8 and 192.168.0.0/24. The character „C“ in the routing table indicates that a route is a directly connected route. The router will be able to route packets received from host A to host B.