Computer Networks: A Systems Approach, 5e
Larry L. Peterson and Bruce S. Davie
Chapter 3
Internetworking
Copyright © 2010, Elsevier Inc. All rights Reserved 1
Chapter 3
Internetworking
What is internetwork
An arbitrary collection of networks interconnected to provide
some sort of host-host to packet delivery service
A simple internetwork where H represents hosts and R represents routers
2
Chapter 3
Internetworking
What is IP
IP stands for Internet Protocol
Key tool used today to build scalable, heterogeneous
internetworks
It runs on all the nodes in a collection of networks and defines the
infrastructure that allows these nodes and networks to function as
a single logical internetwork
A simple internetwork showing the protocol layers
3
Chapter 3
IP Service Model
Packet Delivery Model
Connectionless model for data delivery
Best-effort delivery (unreliable service)
packets are lost
packets are delivered out of order
duplicate copies of a packet are delivered
packets can be delayed for a long time
Global Addressing Scheme
Provides a way to identify all hosts in the network
4
Chapter 3
Packet Format
Version (4): currently 4
Hlen (4): number of 32-bit words
in header
TOS (8): type of service (not
widely used)
Length (16): number of bytes in
this datagram
Ident (16): used by fragmentation
Flags/Offset (16): used by
fragmentation
TTL (8): number of hops this
datagram has traveled
Protocol (8): demux key (TCP=6,
UDP=17)
Checksum (16): of the header
only
DestAddr & SrcAddr (32)
5
Chapter 3
IP Fragmentation and Reassembly
Each network has some MTU (Maximum
Transmission Unit)
Ethernet (1500 bytes), FDDI (4500 bytes), PPP (532
bytes)
Strategy
Fragmentation occurs in a router when it receives a
datagram that it wants to forward over a network
which has (MTU < datagram)
Reassembly is done at the receiving host
All the fragments carry the same identifier in the Ident
field
Fragments are self-contained datagrams
IP does not recover from missing fragments
6
Chapter 3
IP Fragmentation and Reassembly
IP datagrams traversing the sequence of physical networks
7
Chapter 3
IP Fragmentation and Reassembly
Header fields used in IP fragmentation. (a) Unfragmented packet; (b) fragmented packets.
8
Chapter 3
Global Addresses
Properties
globally unique
hierarchical: network + host
4 Billion IP address, half are A type, ¼ is B type, and 1/8 is C type
Format
Dot notation
10.3.2.4
128.96.33.81
192.12.69.77
9
Chapter 3
IP Datagram Forwarding
Strategy
every datagram contains destination's address
if directly connected to destination network, then forward to host
if not directly connected to destination network, then forward to
some router
forwarding table maps network number into next hop
each host has a default router
each router maintains a forwarding table
Example (router R2)
10
Chapter 3
IP Datagram Forwarding
Algorithm
if (NetworkNum of destination = NetworkNum of one of my
interfaces) then
deliver packet to destination over that interface
else
if (NetworkNum of destination is in my forwarding table)
then
deliver packet to NextHop router
else
deliver packet to default router
For a host with only one interface and only a default router in its forwarding
table, this simplifies to
if (NetworkNum of destination = my NetworkNum)then
deliver packet to destination directly
else
deliver packet to default router
11
Chapter 3
IP ADDRESSING
SUBNETTING & CIDR
12
Chapter 3
Understanding IP Addresses
An IP address is an address used in order to
uniquely identify a device on an IP network.
The address is made up of 32 binary bits, which
can be divisible into a network portion and host
portion with the help of a subnet mask.
The 32 binary bits are broken into four octets (1
octet = 8 bits).
Each octet is converted to decimal and separated
by a period (dot). For this reason, an IP address is
said to be expressed in dotted decimal format (for
example, 172.16.81.100). The value in each octet
ranges from 0 to 255 decimal, or 00000000 -
11111111 binary.
13
Chapter 3
Understanding IP Addresses
Here is how binary octets convert to
decimal: The right most bit, or least
significant bit, of an octet holds a value of
20. The bit just to the left of that holds a
value of 21. This continues until the left-
most bit, or most significant bit, which
holds a value of 27. So if all binary bits are
a one, the decimal equivalent would be
255 as shown here:
14
Chapter 3
Understanding IP Addresses
1 1 1 11111
128 64 32 16 8 4 2 1
(128+64+32+16+8+4+2+1=255)
Here is a sample octet conversion when not all of
the bits are set to 1.
0 1000001
0 64 0 0 0 0 0 1 (0+64+0+0+0+0+0+1=65)
And this is sample shows an IP address
represented in both binary and decimal.
10. 1. 23. 19 (decimal)
00001010.00000001.00010111.00010011 (binary)
15
Chapter 3
Understanding IP Addresses
These octets are broken down to provide
an addressing scheme that can
accommodate large and small networks.
There are five different classes of
networks, A to E. The focus is on
addressing classes A to C, since classes D
and E are reserved.
16
Chapter 3
Understanding IP Addresses
Given an IP address, its class can be
determined from the three high-order bits.
17
Chapter 3
Understanding IP Addresses
18
Chapter 3
Understanding IP Addresses
In a Class A address, the first octet is the
network portion, so the Class A example in
figure has a major network address of
1.0.0.0 - 127.255.255.255. Octets 2, 3, and
4 (the next 24 bits) are for the network
manager to divide into subnets and hosts
as he/she sees fit. Class A addresses are
used for networks that have more than
65,536 hosts (actually, up to 16777214
hosts!).
19
Chapter 3
Understanding IP Addresses
In a Class B address, the first two octets
are the network portion, so the Class B
example in figure has a major network
address of 128.0.0.0 - 191.255.255.255.
Octets 3 and 4 (16 bits) are for local
subnets and hosts. Class B addresses are
used for networks that have between 256
and 65534 hosts.
20
Chapter 3
Understanding IP Addresses
In a Class C address, the first three octets
are the network portion. The Class C
example in figure has a major network
address of 192.0.0.0 - 233.255.255.255.
Octet 4 (8 bits) is for local subnets and
hosts - perfect for networks with less than
254 hosts.
21
Chapter 3
Network Masks
A network mask helps you know which
portion of the address identifies the
network and which portion of the address
identifies the node. Class A, B, and C
networks have default masks, also known
as natural masks, as shown here:
Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
22
Chapter 3
Network Masks
An IP address on a Class A network that has
not been subnetted would have an
address/mask pair similar to: 8.20.15.1
255.0.0.0. To see how the mask helps you
identify the network and node parts of the
address, convert the address and mask to
binary numbers.
8.20.15.1 =
00001000.00010100.00001111.00000001
255.0.0.0 =
11111111.00000000.00000000.00000000
23
Chapter 3
Network Masks
Once you have the address and the mask
represented in binary, then identifying the
network and host ID is easier. Any address
bits which have corresponding mask bits
set to 1 represent the network ID. Any
address bits that have corresponding
mask bits set to 0 represent the node ID.
24
Chapter 3
Network Masks
8.20.15.1 =
00001000.00010100.00001111.00000001
255.0.0.0 =
11111111.00000000.00000000.00000000
-----------------------------------
net id | host id
netid = 00001000 = 8
hostid = 00010100.00001111.00000001 = 20.15.1
25
Chapter 3
Understanding Subnetting
Subnetting allows you to create multiple
logical networks that exist within a single
Class A, B, or C network. If you do not
subnet, you are only able to use one
network from your Class A, B, or C
network, which is unrealistic.
26
Chapter 3
Understanding Subnetting
Each data link on a network must have a unique
network ID, with every node on that link being a
member of the same network.
If you break a major network (Class A, B, or C) into
smaller subnetworks, it allows you to create a
network of interconnecting subnetworks.
Each data link on this network would then have a
unique network/subnetwork ID.
Any device, or gateway, connecting n
networks/subnetworks has n distinct IP addresses,
one for each network / subnetwork that it
interconnects.
27
Chapter 3
Understanding Subnetting
In order to subnet a network, extend the natural mask
using some of the bits from the host ID portion of the
address to create a subnetwork ID. For example, given a
Class C network of 204.17.5.0 which has a natural mask
of 255.255.255.0, you can create subnets in this manner:
204.17.5.0 - 11001100.00010001.00000101.00000000
255.255.255.224-1111111.11111111.11111111.11100000
--------------------------|sub|----
28
Chapter 3
Understanding Subnetting
By extending the mask to be
255.255.255.224, you have taken three bits
(indicated by "sub") from the original host
portion of the address and used them to
make subnets.
With these three bits, it is possible to create
eight subnets. With the remaining five host ID
bits, each subnet can have up to 32 host
addresses, 30 of which can actually be
assigned to a device.
Since host ids of all zeros or all ones are not
allowed
29
Chapter 3
Understanding Subnetting
204.17.5.0 255.255.255.224 host address range 1 to 30
204.17.5.32 255.255.255.224 host address range 33 to 62
204.17.5.64 255.255.255.224 host address range 65 to 94
204.17.5.96 255.255.255.224 host address range 97 to 126
204.17.5.128 255.255.255.224 host address range 129 to
158
204.17.5.160 255.255.255.224 host address range 161 to
190
204.17.5.192 255.255.255.224 host address range 193 to
222
204.17.5.224 255.255.255.224 host address range 225 to
254
30
Chapter 3
Understanding Subnetting
Note: There are two ways to denote these
masks. First, since you are using three bits
more than the "natural" Class C mask, you
can denote these addresses as having a 3-bit
subnet mask.
Or, secondly, the mask of 255.255.255.224
can also be denoted as /27 as there are 27
bits that are set in the mask. This second
method is used with CIDR.
One of these networks can be described with
the notation prefix/length. For example,
204.17.5.32/27 denotes the network
204.17.5.32 255.255.255.224.
31
Chapter 3
Subnetting
32
Chapter 3
Understanding Subnetting
The network subnetting scheme in this
section allows for eight subnets, and the
network might appear as:
33
Chapter 3
Understanding Subnetting
Notice that each of the routers in figure is
attached to four subnetworks
One subnetwork is common to both
routers.
Also, each router has an IP address for
each subnetwork to which it is attached.
Each subnetwork could potentially support
up to 30 host addresses.
34
Chapter 3
Understanding Subnetting
This brings up an interesting point. The
more host bits you use for a subnet mask,
the more subnets you have available.
However, the more subnets available, the
less host addresses available per subnet.
For example, a Class C network of
204.17.5.0 and a mask of 255.255.255.224
(/27) allows you to have eight subnets,
each with 32 host addresses (30 of which
could be assigned to devices).
35
Chapter 3
Understanding Subnetting
If you use a mask of 255.255.255.240 (/28), the break
down is:
204.17.5.0 - 11001100.00010001.00000101.00000000
255.255.255.240- 11111111.11111111.11111111.11110000
--------------------------|sub |---
Since you now have four bits to make subnets with, you
only have four bits left for host addresses. So in this case
you can have up to 16 subnets, each of which can have up
to 16 host addresses (14 of which can be assigned to
devices).
36
Chapter 3
Understanding Subnetting
Take a look at how a Class B network
might be subnetted. If you have network
172.16.0.0 ,then you know that its natural
mask is 255.255.0.0 or 172.16.0.0/16.
Extending the mask to anything beyond
255.255.0.0 means you are subnetting.
You can quickly see that you have the
ability to create a lot more subnets than
with the Class C network.
37
Chapter 3
Understanding Subnetting
If you use a mask of 255.255.248.0 (/21), how
many subnets and hosts per subnet does this
allow for?
172.16.0.0 -
10101100.00010000.00000000.00000000
255.255.248.0 -
11111111.11111111.11111000.00000000
-----------------| sub |-----------
You are using five bits from the original host bits
for subnets. This allows you to have 32 subnets
(25). After using the five bits for subnetting, you are
left with 11 bits for host addresses. This allows
each subnet so have 2048 host addresses (211),
2046 of which could be assigned to devices.
38
Chapter 3
Exercise
Given the Class C network of
204.15.5.0/24, subnet the network in order
to create the network in figure with the host
requirements shown.
39
Chapter 3
Examples
Looking at the network shown in figure,
you can see that you are required to create
five subnets. The largest subnet must
support 28 host addresses. Is this possible
with a Class C network? and if so, then
how?
You can start by looking at the subnet
requirement. In order to create the five
needed subnets you would need to use
three bits from the Class C host bits. Two
bits would only allow you four subnets (22).
40
Chapter 3
Examples
Since you need three subnet bits, that
leaves you with five bits for the host
portion of the address. How many hosts
does this support? 25 = 32 (30 usable).
This meets the requirement.
Therefore you have determined that it is
possible to create this network with a
Class C network. An example of how you
might assign the subnetworks is:
41
Chapter 3
Examples
netA: 204.15.5.0/27 host address range 1 to 30
netB: 204.15.5.32/27 host address range 33 to
62
netC: 204.15.5.64/27 host address range 65 to
94
netD: 204.15.5.96/27 host address range 97 to
126
netE: 204.15.5.128/27 host address range 129
to 158
42
Chapter 3
VLSM Example
In all of the previous examples of subnetting,
notice that the same subnet mask was applied for
all the subnets. This means that each subnet has
the same number of available host addresses.
You can need this in some cases, but, in most
cases, having the same subnet mask for all
subnets ends up wasting address space.
For example, in the above exercise, a class C
network was split into eight equal-size subnets;
however, each subnet did not utilize all available
host addresses, which results in wasted address
space. Figure illustrates this wasted address
space.
43
Chapter 3
VLSM Example
44
Chapter 3
VLSM Example
Figure illustrates that of the subnets that are
being used, NetA, NetC, and NetD have a lot
of unused host address space.
It is possible that this was a deliberate design
accounting for future growth, but in many
cases this is just wasted address space due
to the fact that the same subnet mask is
being used for all the subnets.
Variable Length Subnet Masks (VLSM) allows
you to use different masks for each subnet,
thereby using address space efficiently.
45
Chapter 3
VLSM Example
Given the same network and requirements
as in Exercise develop a subnetting
scheme with the use of VLSM, given:
netA: must support 14 hosts
netB: must support 28 hosts
netC: must support 2 hosts
netD: must support 7 hosts
netE: must support 28 host
46
Chapter 3
VLSM Example
Determine what mask allows the required number of hosts.
netA: requires a /28 (255.255.255.240) mask to support 14
hosts
netB: requires a /27 (255.255.255.224) mask to support 28
hosts
netC: requires a /30 (255.255.255.252) mask to support 2
hosts
netD*: requires a /28 (255.255.255.240) mask to support 7
hosts
netE: requires a /27 (255.255.255.224) mask to support 28
hosts
* a /29 (255.255.255.248) would only allow 6 usable host
addresses
therefore netD requires a /28 mask.
47
Chapter 3
VLSM Example
The easiest way to assign the subnets is to assign
the largest first. For example, you can assign in
this manner:
netB: 204.15.5.0/27 host address range 1 to 30
netE: 204.15.5.32/27 host address range 33 to 62
netA: 204.15.5.64/28 host address range 65 to 78
netD: 204.15.5.80/28 host address range 81 to 94
netC: 204.15.5.96/30 host address range 97 to 98
This can be graphically represented as shown in
Figure 5:
48
Chapter 3
VLSM Example
49
Chapter 3
CIDR
Classless Interdomain Routing (CIDR) was
introduced to improve both address space
utilization and routing scalability in the
Internet. It was needed because of the
rapid growth of the Internet and growth of
the IP routing tables held in the Internet
routers.
50
Chapter 3
CIDR
CIDR moves away from the traditional IP
classes (Class A, Class B, Class C, and so
on).
In CIDR , an IP network is represented by
a prefix, which is an IP address and some
indication of the length of the mask.
Length means the number of left-most
contiguous mask bits that are set to one.
So network 172.16.0.0 255.255.0.0 can be
represented as 172.16.0.0/16.
51
Chapter 3
CIDR
CIDR also depicts a more hierarchical
Internet architecture, where each domain
takes its IP addresses from a higher level.
This allows for the summarization of the
domains to be done at the higher level.
52
Chapter 3
Classless Addressing
Classless Inter-Domain Routing
A technique that addresses two scaling concerns in
the Internet
The growth of backbone routing table as more and more
network numbers need to be stored in them
Potential exhaustion of the 32-bit address space
Address assignment efficiency
Arises because of the IP address structure with class A, B,
and C addresses
Forces us to hand out network address space in fixed-size
chunks of three very different sizes
A network with two hosts needs a class C address
Address assignment efficiency = 2/255 = 0.0078=.78%
A network with 256 hosts needs a class B address
Address assignment efficiency = 256/65535 = 0.0039= .39%
53
Chapter 3
Classless Addressing
Exhaustion of IP address space centers on exhaustion of
the class B network numbers
Solution
Say “NO” to any Autonomous System (AS) that requests a class
B address unless they can show a need for something close to
64K addresses
Instead give them an appropriate number of class C addresses
What is the problem with this solution?
54
Chapter 3
Classless Addressing
Problem with this solution
Excessive storage requirement at the routers.
If a single AS has, say 16 class C network
numbers assigned to it,
Every Internet backbone router needs 16 entries in its
routing tables for that AS
This is true, even if the path to every one of these
networks is the same
If we had assigned a class B address to the AS
The same routing information can be stored in one
entry
Efficiency = 16 × 255 / 65, 536 = 6.2%
55
Chapter 3
Classless Addressing
CIDR tries to balance the desire to minimize the
number of routes that a router needs to know
against the need to hand out addresses
efficiently.
CIDR uses aggregate routes
Uses a single entry in the forwarding table to tell the
router how to reach a lot of different networks
Breaks the rigid boundaries between address classes
56
Chapter 3
Classless Addressing
Consider an AS with 16 class C network numbers.
Instead of handing out 16 addresses at random, hand
out a block of contiguous class C addresses
Suppose we assign the class C network numbers from
192.4.16 through 192.4.31
Observe that top 20 bits of all the addresses in this range
are the same (11000000 00000100 0001)
We have created a 20-bit network number (which is in between
class B network number and class C number)
57
Chapter 3
Classless Addressing
Requires to hand out blocks of class C addresses that
share a common prefix
The convention is to place a /X after the prefix where X is
the prefix length in bits
For example, the 20-bit prefix for all the networks
192.4.16 through 192.4.31 is represented as 192.4.16/20
By contrast, if we wanted to represent a single class C
network number, which is 24 bits long, we would write it
192.4.16/24
58
Chapter 3
Classless Addressing
How do the routing protocols handle this
classless addresses
It must understand that the network number may be of
any length
Note that representing a network address
in this way is similar to the <mask, value>
approach used in subnetting, as long as
masks consist of contiguous bits starting
from the most significant bit.
All routers must understand CIDR addressing
59
Chapter 3
Classless Addressing
Route aggregation with CIDR
60
Chapter 3
IP Forwarding Revisited
IP forwarding mechanism assumes that it can
find the network number in a packet and then
look up that number in the forwarding table
We need to change this assumption in case of
CIDR
CIDR means that prefixes may be of any length,
from 2 to 32 bits
61
Chapter 3
IP Forwarding Revisited
It is also possible to have prefixes in the forwarding
tables that overlap
Some addresses may match more than one prefix
For example, we might find both 171.69 (a 16 bit prefix)
and 171.69.10 (a 24 bit prefix) in the forwarding table of
a single router
A packet destined to 171.69.10.5 clearly matches both
prefixes.
The rule is based on the principle of “longest match”
171.69.10 in this case
A packet destined to 171.69.20.5 would match 171.69
and not 171.69.10
62