CS455 Sylabus

### The IP-Forwarding Algorithm

• The IP Forwarding Algorithm:

• Flow chart of the IP forwarding algorithm:

• Explanation:

1. Node (computer or router) receives an IP packet (inside an Ethernet frame !!!)

 It will first extract the IP packet and Examine the destination IP address (in the IP protocol header)

2. First, it check whether the destination IP address is one of the IP addresses in the IP forwarding table

 If so, the IP packet is sent of the corresponding network interface (Because the IP destination is on one of the IP networks attached to the node)

3. Otherwise, check whether the destination IP address is one of the IP addresses in the routing table

 If so, the IP packet is sent of the corresponding router

4. Otherwise, check if the routing table has a default entry

 If so, the IP packet is sent of the corresponding default router

5. Final option: drop the packet.... (cannot find a route to the destination)

• IP forwarding example 1

• Example 1:

• IP host/node x7 sends a message to IP destination host/node y9:

• x7 runs the IP forwarding algorithm:

1. Destination y9's network ID is y

2. Look up y in the forwarding table

 Network ID y is not in the forwarding table.... So it will check the routing table

3. Look up y in the routing table

 Network ID y is not in the routing table So it try to use the default route

4. Host x7 will use the default route: (default, A) for routing

Result: x7 sends the message to A

• Router A runs the IP forwarding algorithm:

1. Destination y9's network ID is y

2. Look up y in the forwarding table

 Network ID y is not in the forwarding table.... So it will check the routing table

3. Look up y in the routing table

 Network ID y is not in the routing table So it try to use the default route

4. Router A will use the default route: (default, B) for routing

Result: router A sends the message to router B

• Router B runs the IP forwarding algorithm:

1. Destination y9's network ID is y

2. Look up y in the forwarding table

 Network ID y is found in the forwarding table !!!!

Result: router B sends the message directly on the network interface #3:

• IP forwarding example 2

• Example 2:   node z9 sends a message to node x7:

• We will start looking at this example when the IP packet has arrived at router B:

• The following diagram summarizes the routing decisions:

(Shorten) explanation:

• IP forwarding algorithm run at router B

 Destination x7's network ID is x x is not in the forwarding table so it uses the routing table Router B will use the entry: (Net x, A) for routing

Result: B sends the message to A

• IP forwarding algorithm run at router A:

 Destination x9's network ID is x x is found in the forwarding table !!!

Result: router A sends the message to the network attached to its port #1

• IP forwarding example 3

• Forwarding example 3: x7 sends a message to z9

• The following diagram summarizes the routing decisions:

Notes:

• IP forwarding algorithm run at x7

 Destination z9's network ID is z z is not in the forwarding table so it uses the routing table Host x7 will use the entry: (default, A) for routing

Result: x7 sends the message to A

• IP forwarding algorithm run at router A:

 Destination z9's network ID is z z is not in the forwarding table, so it uses the routing table Router A will use the entry: (default, B) for routing

Result: router A sends the message to router B

• IP forwarding algorithm run at router B:

 Destination z9's network ID is z z is not in the forwarding table, so it uses the routing table Router B will use the entry: (default, C) for routing

Result: router B sends the message to C

The message will eventuall get to D and then to the network z....

• Summary:

• Key points:

• A node (computer or router) can always tell if the destination of an IP packet is located on its own network by the network IDs in its Forwarding Table

 If the destination is on one of its own networks, it will send the IP-packet directly to the destination in a physical (Ethernet or Token bus) frame.

• If the destination is not on its own network, the node will send the IP-packet to a neighboring router (a router that is connected to node)

 This neighboring router is always given in the routing table.

• Note:

 Some text book considers the IP forwarding table as as special section of the IP routing table