You are on page 1of 54

Chapter 5 – Part 3

Delivery, Forwarding,
and Routing of IP Packets
Objectives
Upon completion you will be able to:

• Understand the different types of delivery and the connection


• Understand forwarding techniques in classful addressing
• Understand forwarding techniques in classless addressing
• Understand how a routing table works
• Understand the structure of a router

TCP/IP Protocol Suite


5.1 DELIVERY
The network layer supervises delivery, the handling of the packets by the
underlying physical networks. Two important concepts are the type of
connection and direct versus indirect delivery.

The topics discussed in this section include:

Connection Types
Direct Versus Indirect Delivery

TCP/IP Protocol Suite


Figure 5.1 Direct delivery

TCP/IP Protocol Suite 3


Figure 5.2 Indirect delivery

TCP/IP Protocol Suite 4


5.2 FORWARDING
Forwarding means to place the packet in its route to its destination.
Forwarding requires a host or a router to have a routing table. .

The topics discussed in this section include:


Forwarding Techniques
Forwarding with Classful Addressing
Forwarding with Classless Addressing
Combination

TCP/IP Protocol Suite 5


Figure 5.3 Next-hop method

TCP/IP Protocol Suite 6


Figure 5.4 Network-specific method

TCP/IP Protocol Suite 7


Figure 5.5 Host-specific routing

TCP/IP Protocol Suite 8


Figure 5.6 Default routing

TCP/IP Protocol Suite 9


Figure 5.7 Simplified forwarding module in classful address without subnetting

TCP/IP Protocol Suite 10


Example 1

Figure 5.8 shows an imaginary part of the Internet.


Show the routing tables for router R1.

See Next Slide

TCP/IP Protocol Suite 11


Figure 5.8 Configuration for routing, Example 1

TCP/IP Protocol Suite 12


Example 1 (Continued)

Solution
Figure 5.9 shows the three tables used by router R1.
Note that some entries in the next-hop address
column are empty because in these cases, the
destination is in the same network to which the router
is connected (direct delivery). In these cases, the next-
hop address used by ARP

See Next Slide

TCP/IP Protocol Suite 13


Figure 5.9 Tables for Example 1

TCP/IP Protocol Suite 14


Example 2

Router R1 in Figure 5.8 receives a packet with


destination address 192.16.7.14. Show how the packet
is forwarded.
Solution
The destination address in binary is 11000000 00010000
00000111 00001110. A copy of the address is shifted 28 bits to
the right. The result is 00000000 00000000 00000000 00001100
or 12. The destination network is class C. The network address
is extracted by masking off the rightmost 8 bits of the
destination address; the result is 192.16.7.0. The table for Class
C is searched. The network address is found in the first row.
The next-hop address 111.15.17.32. and the interface m0 are
passed to ARP.
TCP/IP Protocol Suite 15
Example 3

Router R1 in Figure 5.8 receives a packet with destination


address 167.24.160.5. Show how the packet is forwarded.
Solution
The destination address in binary is 10100111 00011000
10100000 00000101. A copy of the address is shifted 28 bits to
the right. The result is 00000000 00000000 00000000
00001010 or 10. The class is B. The network address can be
found by masking off 16 bits of the destination address, the
result is 167.24.0.0. The table for Class B is searched. No
matching network address is found. The packet needs to be
forwarded to the default router (the network is somewhere else
in the Internet). The next-hop address 111.30.31.18 and the
interface number m0 are passed to ARP.
TCP/IP Protocol Suite 16
Figure 5.10 Simplified forwarding module in classful address with subnetting

TCP/IP Protocol Suite 17


Example 4

Figure 5.11 shows a router connected to four subnets.

TCP/IP Protocol Suite 18


Example 4 (Continued)

Note several points. First, the site address is


145.14.0.0/16 (a class B address). Every packet with
destination address in the range 145.14.0.0 to
145.14.255.255 is delivered to the interface m4 and
distributed to the final destination subnet by the
router. Second, we have used the address x.y.z.t/n for
the interface m4 because we do not know to which
network this router is connected. Third, the table has
a default entry for packets that are to be sent out of
the site. The router is configured to apply the mask
/18 to any destination address.
TCP/IP Protocol Suite 19
Example 5

The router in Figure 5.11 receives a packet with


destination address 145.14.32.78. Show how the
packet is forwarded. (The mask is /18)

Solution
The mask is /18. After applying the mask, the subnet
address is 145.14.0.0. The packet is delivered to ARP
with the next-hop address 145.14.32.78 and the
outgoing interface m0.

TCP/IP Protocol Suite 20


Example 6

A host in network 145.14.0.0 in Figure 6.11 has a


packet to send to the host with address 7.22.67.91.
Show how the packet is routed.

Solution
The router receives the packet and applies the mask
(/18). The network address is 7.22.64.0. The table is
searched and the address is not found. The router
uses the address of the default router (not shown in
figure) and sends the packet to that router.

TCP/IP Protocol Suite 21


Note:

In classful addressing we can have a


routing table with three columns;
in classless addressing, we need at
least four columns.

TCP/IP Protocol Suite 22


Figure 5.12 Simplified forwarding module in classless address

TCP/IP Protocol Suite 23


Example 7

Make a routing table for router R1 using the


configuration in Figure 6.13.

See Next Slide

Solution
Table 6.1 shows the corresponding table.

See the table after the figure.

TCP/IP Protocol Suite 24


Figure 5.13 Configuration for Example 7

m3

TCP/IP Protocol Suite 25


Table 5.1 Routing table for router R1 in Figure 5.13

TCP/IP Protocol Suite 26


Example 8

Show the forwarding process if a packet arrives at R1


in Figure 5.13 with the destination address
180.70.65.140.
Solution
The router performs the following steps:
1. The first mask (/26) is applied to the destination
address. The result is 180.70.65.128, which does not
match the corresponding network address.

See Next Slide

TCP/IP Protocol Suite 27


Example 8 (Continued)

2. The second mask (/25) is applied to the


destination address. The result is 180.70.65.128,
which matches the corresponding network address.
The next-hop address (the destination address of the
packet in this case) and the interface number m0
are passed to ARP for further processing.

TCP/IP Protocol Suite 28


Example 9

Show the forwarding process if a packet arrives at R1


in Figure 5.13 with the destination address
201.4.22.35.

Solution
The router performs the following steps:

See Next Slide

TCP/IP Protocol Suite 29


Example 9 (Continued)

1. The first mask (/26) is applied to the destination address. The


result is 201.4.22.0, which does not match the corresponding
network address (row 1).
2. The second mask (/25) is applied to the destination address.
The result is 201.4.22.0, which does not match the
corresponding network address (row 2).
3. The third mask (/24) is applied to the destination address.
The result is 201.4.22.0, which matches the corresponding
network address. The destination address of the package and
the interface number m3 are passed to ARP.

TCP/IP Protocol Suite 30


Example 10

Show the forwarding process if a packet arrives at R1


in Figure 5.13 with the destination address
18.24.32.78.
Solution
This time all masks are applied to the destination
address, but no matching network address is found.
When it reaches the end of the table, the module gives
the next-hop address 180.70.65.200 and interface
number m2 to ARP. This is probably an outgoing
package that needs to be sent, via the default router, to
some place in the Internet.
TCP/IP Protocol Suite 31
Figure 5.15 Address aggregation

TCP/IP Protocol Suite 32


5.3 ROUTING
Routing deals with the issues of creating and maintaining routing tables.

The topics discussed in this section include:

Static Versus Dynamic Routing Tables


Routing Table

TCP/IP Protocol Suite 33


Figure 5.18 Common fields in a routing table

TCP/IP Protocol Suite 34


IP routing
◼ What is IP routing?
◼ IP routing is the process of sending packets from a
host on one network to another host on a different
remote network.
◼ This process is usually 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.
IP routing
◼ 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.
Default gateway
◼ 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.
Default gateway
◼ The following example explains the concept of a
default gateway more thoroughly.

◼ Hosts can be configured to send all packets


destined to remote networks to a default gateway,
which has a route to reach that network.
Default gateway
◼ 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 Table
◼ Each router maintains a routing table and stores it
in RAM. A routing table is used by routers to
determine the path to the destination network.
Each routing table consists of the following
entries:
• network destination and subnet mask – specifies a
range of IP addresses.
• remote router – IP address of the router used to reach
that network.
• outgoing interface – outgoing interface the packet
should go out to reach the destination network.
Routing Table
◼ There are three different methods for populating a
routing table:
• directly connected subnets
• using static routing
• using dynamic routing
◼ 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.
Routing table

◼ 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 does not find the entry, it
discards the packet.
Routing table
◼ We can use the show ip route command from the
enabled mode to display the router’s routing table

◼ From the output above, the 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.
Routing Table

◼ So when host A sends the packet to host B, the


router will look up into its routing table and find
the route to the 10.0.0.0/8 network on which host
B resides. The router will then use that route to
route packets received from host A to host B.
Connected routes
◼ Subnets directly connected to a router’s interface
are added to the router’s routing table. Interface has
to have an IP address configured and both interface
status codes must be in the up state.
◼ A router will be able to route all packets destined
for all hosts in subnets directly connected to its
active interfaces.
◼ Consider the following example. The router has two
active interfaces, Fa0/0 and Fa0/1. Each interface
has been configured with an IP address and is
currently in the up-up state, so the router adds these
subnets to its routing table.
Connected routes

◼ From the output above, the 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.
Static Route
◼ By adding static routes, a router can learn a route
to a remote network that is not directly connected
to one of its interfaces.
◼ Static routes are configured manually by typing
the global configuration mode command ip route
DESTINATION_NETWORK SUBNET_MASK
NEXT_HOP_IP_ADDRESS.
◼ This type of configuration is usually used in
smaller networks because of scalability reasons.
We have to configure each route on each router.
Static Route
◼ A simple example to understand the concept of
static routes.

◼ Router A is directly connected to router B.


Router B is directly connected to the subnet
10.0.1.0/24. Since that subnet is not directly
connected to Router A, the router does not know
how to route packets destined for that subnet.
However, it can be configured that route
manually on router A.
Static Route
◼ First, consider the router A’s routing table
before we add the static route:
Static Route
◼ Use the static route command to configure router A
to reach the subnet 10.0.0.0/24. The router now has
the route to reach the subnet.
Static Route
◼ The character S in the routing table indicates that a route
is a statically configured route.
◼ Another version of the ip route command exists. It does
not need to specify the next-hop IP address. It can rather
be specified the exit interface of the local router.
◼ In the example above we could have typed the ip route
DEST_NETWORK NEXT_HOP_INTERFACE command
to instruct router A to send all traffic destined for the
subnet out the right interface. In our case, the command
would be
ip route 10.0.0.0 255.255.255.0 Fa0/0.
Dynamic routes
◼ A router can learn dynamic routes if a routing protocol is enabled.
A routing protocol is used by routers to exchange routing
information with each other.
◼ Every router in the network can then use information to build its
routing table. A routing protocol can dynamically choose a different
route if a link goes down, so this type of routing is fault-tolerant.
◼ Also, unlike with static routing, there is no need to manually
configure every route on every router, which greatly reduces the
administrative overhead.
◼ It only need to be defined which routes will be advertised on a
router that connect directly to the corresponding subnets – routing
protocols take care of the rest.
Dynamic routes
◼ The disadvantage of dynamic routing is that it increases memory and
CPU usage on a router, because every router has to process received
routing information and calculate its routing table.
◼ To better understand the advantages that dynamic routing protocols
bring, consider the following example:

◼ Both routers are running a routing protocol, namely EIGRP. There is no


static routes on Router A, so R1 does not know how to reach the subnet
10.0.0.0/24 that is directly connected to Router B.
◼ Router B then advertises the subnet to Router A using EIGRP(Enhanced
Interior Gateway Routing Protocol) . Now Router A has the route to
reach the subnet.
Static & Dynamic Routing Table

Static routing table is one with manual entries while


dynamic routing table is one which is updated
automatically by the routing protocols.

Nowadays, Internet is so large that it requires


dynamic routing as update is necessary when a link is
down or a change in the network.

TCP/IP Protocol Suite 54

You might also like