IP Routing

* IP layer in end-system hosts and in the router work together to route packets from source to destination.
* IP layer in each host and router maintains a routing table, which is used to route the packets based on IP address.
* If a destination host is directly connected to the originating host by a link or by a LAN, then the packet is sent directly to destination host using appropriate network interface, otherwise, the routing table specifies that the packet is to send to default gateway.
* When a router receives an IP packet from one of the network interfaces, then router examines its routing table to see whether the packet is destined to itself or not, if so, delivers to router’s own address, then the router determines the next–hop router and associated network interface, and then forwards the packet.
* Each row in routing table must provide information like: destination IP address, IP address of next-hop router, several flag fields, outgoing network interface, and other information such as subnet mask, physical address.
* H flag indicates whether the route in the given row is to a host (H=1) or to a
network.
* G flag indicates whether the route in the given row is to a router (gateway, G=1) or to a directly connected destination (G=0).
* Each time a packet is to be routed, the routing table is searched in the following order.
* First, the destination column is searched to see whether table contains an entry for complete destination IP address.
* If so, then IP packet is forwarded according to next-hop entry and G flag.
* Second, if the table does not contain complete destination IP address, then routing table is searched for the destination network ID.
* If an entry found, the IP packet is forwarded according to next-hop entry and G flag.
* Third, if table does not contain destination network ID, the table is searched for default router entry, and if one is available, the packet is forwarded there.
* Finally if none of the above searches are successful, the packet is declared
undeliverable and an ICMP “host unreachable error” packet is sent back to

originating host.

0 comments