0% found this document useful (0 votes)
50 views152 pages

Chapter 4.2

Uploaded by

Pratham Suhasia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views152 pages

Chapter 4.2

Uploaded by

Pratham Suhasia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 152

Network Layer

Protocols:
ARP, IPv4, ICMPv4,
IPv6
McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Figure 20.1 Protocols at network layer

» In the Internet model or the TCP/IP suite, there are 5 network layer
protocols:
» ARP,
» RARP,
» IP,
» ICMP and
» IGMP.
» Fig. 20.1 below shows these protocols:

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Network layer Protocols, (IP)

» The main protocol of network layer is IP.


» IP protocol is responsible for host-to-host delivery of datagrams from
source to destination.
» Current version of IP is called IPv4, but new version IPv6 is becoming
dominant.
» IP needs services of other protocols.

» E.g. ARP protocol is used to find the MAC (physical address) of the next
hop. (RARP is another protocol, which is, however, becoming obsolete
as it is replaced by DHCP).
» MAC is passed to data-link layer, with IP datagram to be inserted into the
encapsulating frame.
» During datagram delivery, IP needs the services of ICMP to handle
unusual situations such as occurrence of any error.
» IP is designed for uni-cast (1-source to 1-destinition )delivery, but
multimedia and other new applications in the Internet need multi-casting
(1-source to many destinations) delivery, so IP needs the services of
another protocol called IGMP.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


20.1 ARP (MAC and IP addresses)

» The Internet is made of a combination of physical networks connected


by devices such as routers.
» A packet starting from a source host may pass through several different
physical networks before finally reaching the destination host.
» An IP address is an universally unique inter-network address, and thus
network level the host and routers are recognized by their IP address.
» But packets pass through physical networks to reach hosts and routers.
» At physical network, the hosts and routers are recognized by their MAC
addresses.

» A MAC address is a local address, its influence is unique locally but not
necessarily universally.
» MAC address and IP address are two different identifiers.
» IP and MAC both are required as physical network, such as
Ethernet, can have different protocols at the network layer, such as
IP and IPX (Novell), at the same time.
» Similarly a packet at a network layer such as IP may pass through
different physical networks such as Ethernet and Token Ring.
» So delivery of a packet to a host or a router requires two levels of
addressing: IP and MAC.
» We need to be able to map an IP address to its corresponding MAC
address.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


20.1 ARP

Mapping

Packet Format

Encapsulation

Operation

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ARP (Mapping, types and STATIC MAPPING)

» Mapping is of two types:


» Static Mapping.
» Dynamic Mapping.

STATIC MAPPING:
» Creating a table that associates an IP address with a MAC address.
» This table is stored in each machine in the network.
» Each machine, which knows IP address of another machine on the
network, can consult to this table for MAC address.
» This method has some limitations as MAC addresses changes the
following ways:
» A machine could change its network card, resulting a new MAC
address.
» In some LANs (e.g. LocalTalk (Apple)), the MAC address changes
every time the computer is turned ON.
» A mobile computer can move from one physical network to another,
resulting in a change in its MAC address.

» To implement these changes the static mapping table must be updated


periodically.
» But this overhead could affect the network performance.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ARP (Mapping, types and DYNAMIC MAPPING)

» Mapping is of two types:


» Static Mapping.
» Dynamic Mapping.

DYNAMIC MAPPING:
» In dynamic mapping each time a machine knows one of the two
addresses, it can use a protocol to find the other one.
» Two protocols have been designed to perform dynamic mapping:
» Address Resolution Protocol (ARP) and
» Reverse Address Resolution Protocol (RARP).
» ARP maps an IP address to a MAC address.
» RARP maps a MA address to an IP address. (RARP is becoming obsolete
as it is replaced by DHCP).

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ARP Operation

» ARP associates an IP address with its MAC Address.


» On a typical physical network, such as LAN, each device is identified by
a physical or station address that is usually printed on the NIC (Network
Interface Card).
» Anytime a host or a router needs to find the MAC address of another
host or router on its network, it sends an ARP query packet.
» This packet includes
» The physical and IP address of the sender and
» IP Address of the receiver.
» The query is broadcasted over the network. (as shown in Fig 20.2 in next
slide).

» Every host or router on the network receives and processes the ARP
query packet.
» But only the intended recipient recognizes its IP address and sends
backs an ARP response packet.
» The response packet contains:
» The recipient's IP and physical address.
» The packet is uni-cast directly to inquirer using the physical address
received in the ARP query packet.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.2 ARP operation

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.3 ARP packet

» Fig. 20.3 shows the format of an ARP packet:

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ARP Packet Fields:

HTYPE (Hardware Type):


» 16-bit field defining the type of network on which ARP is running.
» As ARP can be used on any physical network, so each LAN has been
assigned an integer based on its types.
» E.g. Ethernet is given type 1.
PTYPE (Protocol Type):
» 16-bitfield defining the protocol using ARP.
» ARP can be used with any higher-level protocol.
» E.g. the value of this field for IPv4 is 0800 16.
HLEN (Hardware Length):
» 8-bit field defining the length of the physical address in bytes.
» E.g. for Ethernet the value is 6.
PLEN (Protocol Length):
» 8-bit field defining the length of the IP address in bytes.
» E.g. for the IPv4 protocol the value is 4.
OPER (Operation):
» 16-bit field defining the type of packet.
» Two packet types are defined.
» ARP request (1).
» ARP reply (2).

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ARP Packet Fields:

SHA (Sender Hardware Address):


» This is a variable length field defining the physical address of the sender.
» E.g. for Ethernet this field is 6-Bytes long.
SPA (Sender Protocol Address):
» This is a variable length field defining the logical (e.g. IP) address of the
sender.
» E.g. for the IP protocol, this field is 4-Bytes long.
THA (Target Hardware Address):
» This is a variable length field defining the physical address of the target.
» E.g. for Ethernet this field is 6-Bytes long.
» For an ARP request message, this field is all 0s because the sender does
not know the physical address of the target.
TPA (Target Protocol Address):
» This is a variable length field defining the logical (e.g. IP) address of the
target.
» E.g. for the IPv4 protocol, this field is 4-Bytes long.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.4 Encapsulation of ARP packet

» An ARP packet is encapsulated directly into a link frame.


» E.g. in Fig. 20.4 below an ARP packet is encapsulated in an Ethernet
frame.
» Note that the type field indicates that the data carried by the frame are an
ARP packet.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ARP-OPEARTION: Steps involved in ARP functions on the Internet.

1. The sender knows the IP address of the target. (how sender obtains will
be discussed after words).
2. IP asks ARP to create an ARP request message, filling:
» The sender IP and Physical address and
» The target IP address.
» The target physical address field is filled with 0s (as unknown).
3. The message is passed to data-link layer where it is encapsulated in a
frame.
» Using the physical address of the sender as source address and
» The physical broadcast address as the destination address.
4. Because the frame is broadcasted every host or router receives the
frame.
» All stations removes the message and pass it to ARP.
» All machines except the targeted drop the packet.
» The target machine recognizes the IP address.
5. The target machine replies with an ARP reply message that contains the
physical address.
» The message is uni-cast.
6. The sender receives the reply message as gets the physical address of
the target machine.
7. The IP datagram which carries data for target machine, is now
encapsulated in a frame and is uni-cast to the destination.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ARP-OPEARTION: 4 Different Cases (when ARP services are used)

1. The sender is a host and wants to send a packet to another host on the
same net-work.
» In this case, the IP Address must be mapped to a physical address
is the destination IP address in the datagram header.
2. The sender is a host and wants to send a packet to another host on
another network.
» In this case, the hosts looks at its routing table and finds the IP
address of the next hop (router) for the destination.
» The IP address of the router becomes the IP address that must be
mapped to a physical address.
3. The sender is a router that has received a datagram destined for a host
on another network.
» It checks its routing table and finds the IP address of the next router.
» The IP address of the next router becomes the IP address that must
be mapped to a physical address.
4. The sender is a router that has received a datagram destined for a host
in the same network.
» The destination IP address of the datagram becomes the IP address
that must be mapped to a physical address.

Fig. 20.5 in next slides shows the scenario.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.5 Four cases using ARP

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Note:

An ARP request is broadcast; an ARP


reply is uni-cast.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Example 1
A host with IP address 130.23.3.20 and physical address
B23455102210 has a packet to send to another host with IP address
130.23.43.25 and physical address A46EF45983AB. The two hosts
are on the same Ethernet network. Show the ARP request and reply
packets encapsulated in Ethernet frames.

Solution

Figure 20.6 shows the ARP request and reply packets. Note that the ARP
data field in this case is 28 bytes, and that the individual addresses do not
fit in the 4-byte boundary. That is why we do not show the regular 4-byte
boundaries for these addresses. Note that we use hexadecimal for every
field except the IP addresses.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.6 Example 1

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


20.2 (Internet Protocol) IP

» The Internet Protocol (IP) is the host-to-host network layer delivery


protocol for the Internet.
» IP is an unreliable and connectionless protocol  a best-effort delivery
service.
» The best-effort means IP provides no error control or flow control.
» IP uses only an error detection mechanism and discards the packet it it
is corrupted.
» IP does its best to deliver a packet to its destination, but with no
guarantees.
» If reliability is important, IP must be paired with a reliable protocol such
as TCP (at the transport layer).
» IP is also a connectionless protocol for a packet switching network
which uses the datagram approach means:
» Packets may arrive at the destination out of order,
» Packets may be corrupted or lost during transmission.

» So again IP relies of higher-level protocols to take care of these


problems.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


20.2 IP

Datagram

Fragmentation

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.7 IP datagram

» Packets in IP are called data-grams.


» Fig. 20.7 below shows the IP data-gram format.
» A data-gram is a variable length packet consisting of two main parts:
1. Header and
2. Data.
» Header is 20 to 60 Bytes in length and contains information essential to
routing and delivery.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IP DATA-GRAM header fields:

VER (Version):
» This field defines the version of IP.
» Currently the version is 4 (IPv4), however version 6 (IPv6) might totally
replaces version 4 in the near future.
HLEN (Header Length):
» This field defines the length of the header in 4-Byte words.
» Its value must be multiplied by 4 to give the length in Bytes.
» Because of the option field the length of the header is variable.
Differentiated Services:
» This field defines the class of the data-gram for quality of service
purpose.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IP DATA-GRAM header fields:

Total Length:
» This field defines the total length (header plus data) of the IP data-gram
in Bytes.
» To find the data coming from the upper layer, subtract the header length
from the total length.
» The header length can be found by multiplying the value in HLEN field by
4.

Length of data = total length – header length

» Since the field is 16-bits, the total length of the IP data gram is limited to
65.535 (216-1)Bytes, of which 20 to 60 Bytes are the header and rest is
data from upper layer.
» Although 65,535 Bytes are large, the size of IP data-gram may increase in
the near future as the underlying technologies allow even more
throughput (using more bandwidth).

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Note:

The total length field defines the total


length of the datagram including the
header.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IP DATA-GRAM header fields:

Total Length:
» These fields are discussed in later slides in fragmentation section.
Time to Live:
» This fields is used to control the maximum number of hops (routers)
visited by data-gram.
» When a source host sends the data-gram, it stores a number in this field.
» The value is approximately two times the maximum number of routers
between any to hosts.
» Each router that processes the data-gram decrements this number by 1.
» If the value after decrement is zero, the router discards the data-gram.
» The whole purpose is to prevent a datagram from becoming errant, going
from one outer to another.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.8 IP DATA-GRAM Fields: Protocol:

Multiplexing
Protocol:
» This fields defines the higher-level protocol that uses the services of the
IP layer.
» An IP data-gram can encapsulates data from several higher-level
protocols such as TCP, UDP, ICMP and IGMP.
» This field specifies the final destination protocol to which the IP
datagram should be delivered.
» In other words since the IP multiplexes and de-multiplexes data from
different higher-level protocols, the value of this field helps in the de-
multiplexing process when the data-gram arrives at its final destination
as shown in Fig. 20.8 below:

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Table 20.1 IP DATA-GRAM Fields: Protocol:

Multiplexing table
Protocol:
» The value of this field for different higher-level protocols is shown in
Table 20.1 below:

VALUE PROTOCOL
1 ICMP
2 IGMP
6 TCP
17 UDP
89 OSPF

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IP DATA-GRAM header fields:

Checksum:
» The checksum in IP packet covers only the header, not the data.
» There are two good reasons for this:
» All high-level protocols that encapsulates data in the IP data-gram have
checksum field that covers the whole packet.
» The header for IP data-gram changes with each visited router, but the
data do not.
» So the checksum includes only the part that has changed.
» If the data are included, each router must recalculate the checksum for
the whole packet , which increases processing for each router.
» Fig. 20.9 in next slide shows an example of checksum calculation for an
IP header without options.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IP DATA-GRAM header fields: Fig. 20.1: example of checksum calculation

Checksum:
» Fig. 20.9 in next slide shows an example of checksum calculation for an
IP header without options.
» The header is divided into 16-bits sections.
» The value of checksum field is set to zero.
» All the sections are added and the sum is complemented.
» The result is inserted in checksum field.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IP DATA-GRAM header fields:

Source Address:
» This field defines the IP address of the source.
» This field must remain unchanged during the time the IP datagram
travels from the source host to the destination host.
Destination Address:
» Defines the IP address of the destination.
» This field must remain unchanged during the time the IP data-gram
travels from the source host to destination host.
Options:
» Options field, as name implies, are not required for every datagram.
» They are used for network testing and debugging.
» Although options are not required part of IP header, option processing is
required of the IP software.
» So al standards must be able to handle options if they are present in the
header.
» Options are of several types.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IP  Fragmentation:

» A datagram can travel through different networks.


» Each router:
» De-capsulate the IP datagram from the frame it receives,
» Process it and
» Then encapsulate it in another frame.
» The format and size of the received frame depend on the protocol used
by the physical network through which the frame has just traveled.
» The format and size of the sent frame depend on the protocol used by
physical network through which the frame is going to travel.

» E.g. a router connects as Ethernet network to an ATM network, receives a


frame in the Ethernet format ad sends a from in the ATM format.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.10 IP Fragmentation

MTU (Maximum Transfer Unit)

» Each data-link layer has its own frame format.


» One of the fields defined in the format is the maximum size of the data
field.
» In other words, when datagram is encapsulated in a frame,
» The total size of the datagram must be less than this minimum size,
» Which is defined by restriction imposed by the hardware and
software used in the network.

» As shown in Fig. 20.10 below:

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IP Fragmentation MTU (Maximum Transfer Unit)

» To make the IP independent f the physical network, the packagers


decided to make the maximum length of the IP datagram equal to the
largest Maximum Transfer Unit (MTU), defined so for. (65,535 Bytes).
» This makes transmission more efficient if we use a protocol with MTU of
this size.
» However, for other physical networks, we must divide the datagram to
make it possible to pass through these networks.
» This is called Fragmentation.

» When a datagram is fragmented, each fragment has its own header with
most of the fields repeated but some changed.
» A fragmented datagram may itself be fragmented if it encounters a
network with an even smaller MTU.
» So datagram can be fragmented several times before it reached the final
destination.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IP Fragmentation MTU (Maximum Transfer Unit)

» A datagram can be fragmented by the source host or any router in the


path.
» The re-assembly is however done only by the distention host, because
each fragment becomes an independent datagram.

» As the fragmented data-grams can travel through different routes, and


we can never control or guarantees which route a fragment may take.
» So its logical to do the re-assembly at the final destination.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IP Fragmentation Fields related to fragmentation in IP header

Identification:
» Identifies the datagram originating from the source host.
» When a datagram is fragmented the value in the identification field is
copied into all fragments.
» So all fragments have the same identification number.
» The identification number helps the destination in re-assembling the
datagram.
Flags:
» A 3-bit field.
» The first bit is reserved.
» Second field called do not fragment, if it is 1, the machine must not
fragment the datagram.
» If it cannot pass the datagram through any available
physical networks, it discards the datagram and sends an
ICMP error message to the source host.
» If its value is 0, the datagram can be fragmented if
necessary.
» The third bit is called the more fragment it, if it is 1 it means the
datagram is not the last fragment , there are more fragments to
come after this one.
» If its value is 0, it means this is the last or the only
fragment.
McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
IP Fragmentation Fields related to fragmentation in IP header

Fragmentation offset:
» 13-bit field shows the relevant position of this fragment with respect to
the whole datagram.
» It is the offset of the datagram in the original datagram measured in units
of 8 Bytes.
» The offsets is measured in units of 8 Bytes because the length of offset
field is 13 bits long and cannot represent a sequence of bytes greater
than 8191.
» This forces hosts or routers that fragment a datagram to choose the size
of each fragment so that the first Bytes number is divisible by 8.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.11 Fragmentation example

» Fig. 20.11 in next slide shows a datagram with:


» A data size f 4000Bytes,
» Fragmented into 3 parts.
» The first fragment carries bytes 0 to 1399. (offset = 0/8 = 0).
» The second fragment carries bytes 1400 o 2799 (offset = 1400/8= 175).
» The third fragment carries bytes 280 to 3900 (offset= 2800/8 = 350 ).

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Internet Control Message Protocol (ICMP)

» IP has no built-in mechanism for error reporting and error-correction.


» What happen if something goes wrong?
» What happens if a router discard a datagram because it cannot find
a router to final destination?
» What happen if time-to-live field is zero?
» What happen if the final destination host must discard all fragments
of a datagram? because it has hot received all fragments within a
predetermined time-limit.
» IP also lacks a mechanism for host and management queries.
» A host some times needs to determine if a router or another host is
alive.
» Sometimes a network manager needs information from another host
or router.

» Internet Control Message Protocol (ICMP) has been designed to


compensate for the above two deficiencies of IP.
» ICMP does not correct errors , it simply reports them.
» ICMP is a companion to IP.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


20.3 ICMP

Types of Messages

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.12 ICMP encapsulation

» ICMP itself is a network layer protocol.


» However its messages are not passes directly to data-link layer.
» The messages are first encapsulated inside IP data-grams before going
to the lower-layer as shown in Fig.20.12 below:

» The value of the protocol field in IP datagram is 1, as indication that the


IP data are an ICMP message.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages.

» ICMP messages are divided into two broad categories:

1. Error Reporting messages.


2. Query Messages.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages:

Error-Reporting Messages:

» Although technology has produced increasingly reliable transmission


media, errors still exist and must be handled.
» As IP is not concerned with error-checking and error-control so ICMP
was designed to compensate this.
» However ICMP only REPORT errors, error CORRECTION is left to the
higher –level protocols.

» Error-Reporting messages are always sent to the original host because


the only information available in the the data-gram about the route is the
source and destination IP addresses.
» ICMP uses the source IP address to send the error message to the
source (originator) of the data-gram.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Note:

ICMP always reports error messages


to the original source.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.13 Error-reporting messages

» 5 Types of errors are handled.


» Fig. 20.13 below shows them:

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Destination Unreachable.

Destination Unreachable:

» The router or the host sends a destination unreachable message back to


source host that initiated the datagram: when,
» The router cannot route a datagram or
» A host cannot deliver a datagram,
» The datagram is discarded.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Source Quench.

Source Quench:

» IP connectionless protocol which uses, data-grams.


» Connectionless mechanism of IP results in lack of flow control and
congestion control.
» The lack of flow control can create a major problem in the operation of
source-destination delivery.
» The source host never knows if the destination host has been
overwhelmed with data-grams.
» The lack of congestion control creates a major problem in routers that
are supposed to forward the packets.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Note:

There is no flow control or congestion


control mechanism in IP.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Source Quench.

Source Quench:

» The source-quench message in ICMP has been designed to a kind of


flow control and congestion control to IP.
» When a router or host discards a datagram due to congestion, it sends a
source-quenched message to sender of the datagram.
» This Source-quench message has two purposes:
1. It informs the source that the datagram has been discarded.
2. It warns the source that there is congestion somewhere in the path
and that the source should slow down (quench) the sending
process.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Time Exceeded.

Time Exceeded:

» The time exceeded message is generated in two cases:

1. The router that receives the datagram with value of 0 in TTL field
discards the datagram.
» At the time of discarding the datagram a time-exceeded
message must be sent by router to the original source.

2. When all fragments that make up a message do not arrive at the


destination host within host.
» So a time-exceeded message is generated.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Parameter Problem.

Parameter Problem:

» An ambiguity in the header part of a datagram can create serous


problems as the datagram travels through the Internet.
» If a router or the destination host discovers an ambiguous or missing
value in any field of datagram.
» so in this case router discards the datagram ands sends a parameter-
problem message back to source.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Redirection.

Redirection:

» When a router needs to send a packet destined for another network, it


must know the IP address of the next appropriate router.
» The same is true if the sender is a host.
» Both router and hosts must have a routing table to find the address of
the router or the next router.
» Router take part in the routing update process, and hosts are supposed
to be updated constantly.
» Routing is dynamic.

» For efficiency reasons the host do not take part in the routing update
process, because there are many more hosts in the internet than the
routers.
» Updating the routing tables of hosts dynamically produces unacceptable
traffic.
» The hosts usually use static routing.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Redirection.

Redirection:

» For efficiency reasons the host do not take part in the routing update
process, because there are many more hosts in the internet than the
routers.
» Updating the routing tables of hosts dynamically produces unacceptable
traffic.
» The hosts usually use static routing.
» When a host comes-up, its routing table has a limited number of entries.
» It usually knows the IP address of one router, the default router.
» For this reason, the host may send a datagram, which is destined for
another network, the wrong router.
» In this case, the router that receives the datagram will forward the
datagram to correct router.
» However, to update the routing table of a host, it sends a redirection
message back to this host.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Query. (Fig. 20.14 Query Messages)

Query:

» In addition to error reporting, ICMP can diagnose some network


problems.
» This is accomplished through query messages.
» In this type of ICMP messages, a node sends a message that is answered
in a specific format by the destination node.
» Fig. 20.14 below shows a group of four different pairs of messages.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Query Echo Request And Reply:

Echo Request and Reply:

» Echo-Request and Echo-Reply messages are designed for diagnostic


purposes.
» Network managers and users utilize this pair of messages to identify
network problems.
» The combination of echo–request and echo-reply messages determines
whether two systems (hosts or routers) can communicate with each
other.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Query Time-stamp Request and Reply:

Time-Stamp Request and Reply:

» Two machines (hosts or routers) can use time-stamp-request and time-


stamp-reply messages. To determine the round-trip time needed for an
IP datagram to travel between them.
» It can also be used to synchronize the clocks in two machines.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Query Address Mask Request and Reply:

Address Mask Request and Reply:

» The IP address of a host contains a network address, subnet address,


and host identifier.
» A host may know it’s a full address, but it may not know which part of the
address defines the network and sub-network address and which part
corresponds to the host identifier.
» In this case, the host can sends an Address Mask Request Message to a
router.
» The router then sends a mask in an Address Mask Reply Message.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMP  Types of Messages  Error-Reporting Messages

Query Router Solicitation and Advertisement:

Router Solicitation and Advertisement:

» As a host that wants to send data to a host on another network needs to


know the address of routers connected to its own network.
» Also, the host must know if the routers are alive and functioning.
» The router-solicitation and router-advertisement messages can help in
this situation.
» A host can broadcast (or multicast) a router-solicitation message.
» The router or routers that receives the solicitation message broadcast
their routing information using the route-advertisement message.
» A router can also periodically send router-advertisement message even
if no host has solicited.

» Note that when a router sends out an advertisement, it announces not


only its own presence but also the presence of all routers on the
network of which is aware.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


20.4 IPv4 (deficiencies)

» The network layer protocol in the Internet is currently IPv4.


» IPv4 provides the host-to-host communication between systems in the
Internet.
» Although IPv4 is well designed, data communications has evolved since
the inception of IPv4 in the 1970s.
» IPv4 has some deficiencies that make it unsuitable for the fast-growing
Internet, including:

» IPv4 has two-level address structure (netid and hostid) categorized into
five classes (A, B, C,D and E). The use of address is inefficient.

» The Internet must accommodate real-time audio and video transmission.


This type of transmission requires minimum delays strategies and
reservation of resources not provided in IPv4 design.

» The Internet must accommodate encryption and authentication of data


for some applications. Originally, no security mechanism was provided
by IPv4.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


20.4 IPv6 Evolution:

» To overcome these deficiencies , Internet Protocol, version 6 (IPv6), also


known as Internetworking protocol, next generation (IPng), was
proposed and is now a standard.
» The internet protocol was extensively modified to accommodate the
unforeseen growth of Internet.
» The format and length of IP addresses were changed along with the
packet format.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 Advantages over IPv4:

» The next-generation IP, or IPv6 has some advantages over IPv4:

Larger Address Space:


» An IPv6 address is 128 bits long.
» As compared to IPv4 which is 32-bit, so a huge increase in address
space (296 addresses).

Better Header Format:


» IPv67 has a new header format in which options are separated from base
header and inserted, when needed, between the base header and upper
layer-layer data.
» This simplifies and speeds up the routing process because most of the
options do not need to be checked by routers.

New Options:
» IPv6 has new options to allow for additional functionalities.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 Advantages over IPv4:

Allowance for extension:


» IPv6 is designed to allow the extension of the protocol if required by new
technologies and applications.

Support for Resource Application:


» In IPv6 the type-of-service field has been removed, but a mechanism
called flow label has been added.
» Flow label enables the source to request special handling of the packet.
» This mechanism can be used to support traffic such as real time audio
and video.

Support for more functionality:


» The encryption and authentication options in IPv6 provide confidentiality
and integrity of the packet.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


20.4 IPv6

IPv6 Addresses
Categories of Addresses
IPv6 Packet Format
Fragmentation
ICMPv6
Transition

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.15 IPv6 address

» IPv6 addresses consist of 16-Bytes (octets).


» It is 128-bits long.
» Fig. 20.15 below shows this concept .

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 address  Hexadecimal Colon Notation

» IPv6 uses Hexadecimal Colon Notation to make addresses more


readable.
» 128-bits are divided into 8-sections, each 2-Byte in length.
» 2-Bytes in hexadecimal notation requires 4-hexadecimal digits.
» So the address contains of total 32-hexadecimal digits, with every 4-
digits separated by a colon.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 address  Abbreviation:

Figure 20.16 Abbreviated address

» IP addresses in hexadecimal notation are still very long, in spite of the


fact that many of the digits are zero.
» So we use abbreviated addresses.
» ONLY the leading zeros of a section (4-Digits between 2-Colons) can be
omitted.
» As 0074 can be written as 74 and 0000 can be written as 0.
» 3210 abbreviation can NOT be possible.
» Fig. 20.16 below shows this concept:

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 address  Abbreviation:

Figure 20.17 Abbreviated address with consecutive zeros

» Further abbreviation is possible only if there are consecutive sections


consisting of zeros only.
» We can then remove the zeros all together and replace them with a
double semicolon.
» This type of abbreviation is allowed only once per address.
» If there are two runs of zero sections, only ONE of them can be
abbreviated.
» Re-expansion of the abbreviated address is simple, by aligning the
unabbreviated portions and insert zeros to get the original expanded
address.
» Fig. 20.17 below shows this concept:

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 address  CIDR Notation:

Figure 20.18 CIDR address

» IPv6 allows classless addressing and CIDR notation.


» Fig. 20.18 below shows how can we define a prefix of 60-bits using CIDR.
»

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 address  Categories of Addresses:

» IPv6 defines three types of addressing:

1. Uni-cast,
2. Any-cast, and
3. Multicast.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 address  Categories of Addresses:

Uni-Cast Addresses:
» A uni-cast address defines a single computer.
» The packet sent to the uni-cast address must be delivered to that
specific host.

Any-cast Address:
» Any-cast Address defines a group of computers with addresses, that
have the same prefix.
» E.g. all computers connected to the same physical network share the
same prefix address.
» A packet sent to an any-cast address must be delivered to exactly one of
the members of the group  the closest or the most easily accessible.

Multicast Address:
» A multicast address defines a group of computers that may or may not
share the same prefix and may or may not be connected to the same
physical network.
» A packet sent to a multicast address must be delivered to each member
of the set.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.19 Format of an IPv6 datagram

» Fig. 20.19 below shows the packet format of IPv6.


» Each packet is composed of mandatory
1. base header (40 Bytes) and
2. pay-load.
» The pay load consists of 2 parts.
1. Optional and
2. Extension headers and data from upper layer. (65,535 Bytes)

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 Packet Format  Base Header Fields:

» Base Header has the following 8-Fields:

Version:
» 4-bit field defines the version number of the IP.
» E.g. for the IPv6 the value is 6.

Priority:
» 4-bit field defines the priority of the packet with respect to traffic
congestion.

Flow Label:
» 3-Bytes field, designed to provide special handling for a particular flow
of data.

Payload Length:
» 2-Byte field, defines the total length of the IP datagram, excluding the
base header.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 Packet Format  Base Header Fields:

Next Header:
» 8-bit field defining the header that follows the base header in the
datagram.
» The next header either:
1. One of the optional extension headers used by IP or
2. The header for an upper layer protocol such as TCP or UDP.
» Each extension header also contains this field.

Hop Limit:
» 8-bit field which serves the same purpose as the TTL (time-to-live) field
in IPv4.

Source Address:
» 16-Byte field contains the Internet Address that identifies the original
source of the datagram.

Destination Address:
» 16-Byte field contains the Internet Address that usually identifies the
final destination of the datagram.
» However, if source rerouting is used, this field contains the address of
the next router.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv6 Packet Format  Extension Headers:

» The length of the base header is 16-Bytes.


» However, to give more functionality to the IP datagram, base header can
be followed by up to 6 extension headers.
» Many of theses headers are optional in IPv4.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Fragmentation

» The concept of fragmentation is same as in IPv4.


» However, the place where fragmentation takes place, differs.
» In IPv4 the source or a router is required to fragment IF the size of the
datagram is larger than the MTU of the network over which the datagram
should travel.

» In IPv6 only the original source can fragment.


» A source must use a path MTU discovery technique to find the smallest
MTU supported by any network on the path, as fragment using this
knowledge.

» If the source does not use the path MTU discovery technique, it must
fragment the datagram to a size of 756-Bytes or smaller.
» This is the minimum size of MTU required for each network connected to
the Internet.
» Fragmentation in IPv6 is handled by one of the options in the extension
header.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Fragmentation  Authentication and Privacy:

» IPv6 provides authentication and privacy using options in the extension


header.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


ICMPv6

» IPv6 provides authentication and privacy using options in the extension


header.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.20 Comparison of network layers in version 4 and version 6

» ICMPv4 has been modified as ICMPv6 to make it suitable for IPv6.


» ICMPv6 follows the same strategy and purpose as ICMPv4 does.
» Some protocols which are independent, in version 4 are also now part of
ICMPv6.
» ARP and IGMP in version 4 are combined in ICMPv6.
» RARP is dropped from the suit as it is seldom used.

» Fig. 20.20 below compares the network layer of version 4 to that of


version 6.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 20.21 Three transition strategies

» IPv4 to IPv6 transition cannot happen suddenly because of the huge


number of systems on the Internet.
» It takes a considerable amount of time before a system in the Internet
can move from IPv4 to IPv6.
» The transition should be smooth to prevent any problems between IPv4
and IPv6 systems.

» Three strategies have been devised by the IETF to make the transition
period smoother as shown in Fig. 20.21 below:

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv4 to IPv6 Transition strategies  Dual Stack:

Figure 20.22 Dual Stack:


» It is recommended that all hosts, before migrating completely to version
6, have a dual stack of protocols.
» So station should run IPv4 and IPv6 simultaneously until all the Internet
uses IPv6. (layout of the dual stack configuration is shown below)
» The source host queries the DNS before deciding which IP version is
used for sending the packet to destination.
» If the DNS returns IPv4 address, the source host sends an IPv4 packet.
» If the DNS returns IPv6 address, the source host sends an IPv6 packet.

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv4 to IPv6 Transition strategies  Tunneling:

Figure 20.23 Tunneling:


» Tunneling is used when two computer using IPv4 want to communicate
and packet must pass through a region that uses IPv4.
» To pass through the region the packet must have an IPv4 address.
» So IPv6 packet is encapsulated in an IPv4 packet when the packet enters
the region.
» The IPv6 packet leaves the capsule when it exits the region.
» It seems as if the IPv6 packet is enters a tunnel at one end and emerges
at the other end.
» To make it clear that the IPv4 packet is carrying IPv6 packet as data the
protocol value is set to 41.
» Fig. 20.23 below shows this concept:

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IPv4 to IPv6 Transition strategies  Tunneling:

Figure 20.24 Header Translation:

» Header translation is necessary when the majority of the Internet has


moved to IPv6, but some systems still use IPv4.
» E.g. the sender wants to use the IPv6 but the receiver does not
understand IPv6.
» Tunneling does not work in this situation.
» In this case the header format must be changed totally through the
header translation.
» The header of the IPv6 packet is converted to an IPv4 header as shown in
Fig. 20.24 below:

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


IGMP

McGraw-Hill © The McGraw-Hill Companies, Inc., 2004


Figure 10.1 Position of IGMP in the network layer

TCP/IP Protocol Suite 84


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
10.1 GROUP
MANAGEMENT
IGMP is a protocol that manages group membership. The IGMP
protocol gives the multicast routers information about the membership
status of hosts (routers) connected to the network. .

TCP/IP Protocol Suite 85


Note:

IGMP is a group management


protocol. It helps a multicast
router create and update a
list of loyal members related
to each router interface.

TCP/IP Protocol Suite 86


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
10.2 IGMP MESSAGES
IGMP has three types of messages: the query, the membership report,
and the leave report. There are two types of query messages, general and
special.

The topics discussed in this section include:

Message Format

TCP/IP Protocol Suite 87


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Figure 10.2 IGMP message types

TCP/IP Protocol Suite 88


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Figure 10.3 IGMP message format

TCP/IP Protocol Suite 89


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Table 10.1 IGMP type
field

TCP/IP Protocol Suite 90


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
10.3 IGMP OPERATION
A multicast router connected to a network has a list of multicast
addresses of the groups with at least one loyal member in that network.
For each group, there is one router that has the duty of distributing the
multicast packets destined for that group.

The topics discussed in this section include:

Joining a Group Leaving a Group


Monitoring Membership

TCP/IP Protocol Suite 91


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Figure 10.4 IGMP operation

TCP/IP Protocol Suite 92


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Figure 10.5 Membership report

TCP/IP Protocol Suite 93


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Note:

In IGMP, a membership report is sent


twice, one after the other.

TCP/IP Protocol Suite 94


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Figure 10.6 Leave report

TCP/IP Protocol Suite 95


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Note:

The general query message does not


define a particular group.

TCP/IP Protocol Suite 96


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Figure 10.7 General query message

TCP/IP Protocol Suite 97


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Example
1

Imagine there are three hosts in a network as shown in Figure


10.8.

A query message was received at time 0; the random delay time


(in tenths of seconds) for each group is shown next to the
group address. Show the sequence of report messages.

See Next Slide

TCP/IP Protocol Suite 98


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Figure 10.8 Example 1

TCP/IP Protocol Suite 99


McGraw-Hill © The McGraw-Hill Companies, Inc., 2004
Example 1
(Continued)

Solution The events occur in


this sequence:
a.Time 12: The timer for 228.42.0.0
in host A expires and a membership report is sent, which is received
by the router and every host including host B which cancels its timer
for 228.42.0.0.

b.Time 30: The timer for 225.14.0.0


in host A expires and a membership report is sent, which is received
by the router and every host including host C which cancels its timer
for 225.14.0.0.

c.Time 50: The timer for 238.71.0.0


in host B expires and a membership report is sent, which is received
by the router and every host.See Next Slide

TCP/IP Protocol Suite 10


McGraw-Hill © The McGraw-Hill Companies, Inc., 02004
Example 1
(Continued)

d. Time 70: The timer for 230.43.0.0 in host C expires and a membership
report is sent, which is received by the router and every host including host
A which cancels its timerfor 230.43.0.0.

Note that if each host had sent a report for every group in its
list, there would have been seven reports; with this strategy
only four reports are sent.

TCP/IP Protocol Suite 10


McGraw-Hill © The McGraw-Hill Companies, Inc., 12004
10.4 ENCAPSULATION
The IGMP message is encapsulated in an IP datagram, which is itself
encapsulated in a frame.

The topics discussed in this section include:

IP Layer
Data Link Layer
Netstat Utility

TCP/IP Protocol Suite 10


McGraw-Hill © The McGraw-Hill Companies, Inc., 22004
Figure 10.9 Encapsulation of IGMP packet

TCP/IP Protocol Suite 10


McGraw-Hill © The McGraw-Hill Companies, Inc., 32004
Note
:
The IP packet that carries an IGMP
packet has a value of 2 in its protocol
field.

TCP/IP Protocol Suite 10


McGraw-Hill © The McGraw-Hill Companies, Inc., 42004
Note
:
The IP packet that carries an IGMP
packet has a value of 1 in its
TTL field.

TCP/IP Protocol Suite 10


McGraw-Hill © The McGraw-Hill Companies, Inc., 52004
Table 10.2 Destination IP
addresses

TCP/IP Protocol Suite 10


McGraw-Hill © The McGraw-Hill Companies, Inc., 62004
Figure 10.10 Mapping class D to Ethernet physical address

TCP/IP Protocol Suite 10


McGraw-Hill © The McGraw-Hill Companies, Inc., 72004
Note:

An Ethernet multicast
physical address is in the
range 01:00:5E:00:00:00
to 01:00:5E:7F:FF:FF.

TCP/IP Protocol Suite 10


McGraw-Hill © The McGraw-Hill Companies, Inc., 82004
Example
2

Change the multicast IP address 230.43.14.7 to an Ethernet


multicast physical

Solution We can do this in two steps:


a.We write the rightmost 23 bits of the IP address in hexadecimal. This can
be done by changing the rightmost 3 bytes to hexadecimal and then
subtracting 8 from the leftmost digit if it is greater than or equal to 8. In
our example, the result is 2B:0E:07.

b.We add the result of part a to the starting Ethernet multicast address,
which is (01:00:5E:00:00:00). The result is

01:00:5E:2B:0E:07

TCP/IP Protocol Suite 10


McGraw-Hill © The McGraw-Hill Companies, Inc., 92004
Example
3

Change the multicast IP address 238.212.24.9 to an Ethernet


multicast address.

Solution
a.The right-most three bytes in hexadecimal are D4:18:09. We need
to subtract 8 from the leftmost digit, resulting in 54:18:09..

b.We add the result of part a to the Ethernet multicast


starting
address. The result is
01:00:5E:54:18:09

TCP/IP Protocol Suite 11


McGraw-Hill © The McGraw-Hill Companies, Inc., 02004
Figure 10.11 Tunneling

TCP/IP Protocol Suite 11


McGraw-Hill © The McGraw-Hill Companies, Inc., 12004
Example
4
We use netstat with three options, -n, -r, and -a. The -n option gives the
numeric versions of IP addresses, the -r option gives the routing table, and
the -a option gives all addresses (unicast and multicast). Note that we show
only the fields relative to our discussion.
$ netstat -nra
Kernel IP routing table
Destination Gateway Mask Flags Iface
153.18.16.0 0.0.0.0 255.255.240.0 U eth0
169.254.0.0 0.0.0.0 255.255.0.0 U eth0
127.0.0.0 0.0.0.0 255.0.0.0 U lo
224.0.0.0 0.0.0.0 224.0.0.0 U eth0
0.0.0.0 153.18.31.254 0.0.0.0 UG eth0

Any packet with a multicast address from 224.0.0.0 to 239.255.255.255 is


masked and delivered to the Ethernet interface.

TCP/IP Protocol Suite 11


McGraw-Hill © The McGraw-Hill Companies, Inc., 22004
10.5 IGMP PACKAGE

We can show how IGMP can handle the sending and receiving of IGMP
packets through our simplified version of an IGMP package. In our
design an IGMP package involves a group table, a set of timers, and four
software modules.

The topics discussed in this section include:

Group Table Timers


Group-Joining Module Group-Leaving Module Input Module
Output Module

TCP/IP Protocol Suite 11


McGraw-Hill © The McGraw-Hill Companies, Inc., 32004
Figure 10.12 IGMP package

TCP/IP Protocol Suite 11


McGraw-Hill © The McGraw-Hill Companies, Inc., 42004
Figure 10.13 Group table

TCP/IP Protocol Suite 11


McGraw-Hill © The McGraw-Hill Companies, Inc., 52004
Congestion Control
24-1 DATA
TRAFFIC

The main focus of congestion control and quality of


service is data traffic. In congestion control we try to
avoid traffic congestion. In quality of service, we try to
create an appropriate environment for the traffic. So,
before talking about congestion control and quality of
service, we discuss the data traffic itself.

24.
117
Figure 24.1 Traffic descriptors

24.
118
Figure 24.2 Three traffic profiles

24.
119
24-2 CONGESTION

Congestion in a network may occur if the load on the


network—the number of packets sent to the network—is
greater than the capacity of the network—the number of
packets a network can handle. Congestion control
refers to the mechanisms and techniques to control the
congestion and keep the load below the capacity.

24.
120
Congestion Control Algorithms
• Congestion - the situation in which too
many packets are present in the subnet.
Causes of Congestion
• Congestion occurs when a router receives
data faster than it can send it
– Insufficient bandwidth
– Slow hosts
– Data simultaneously arriving from multiple
lines destined for the same outgoing line.
• The system is not balanced
– Correcting the problem at one router will
probably just move the bottleneck to another
router.
Congestion Causes More Congestion
– Incoming messages must be placed in queues
• The queues have a finite size
– Overflowing queues will cause packets to be dropped
– Long queue delays will cause packets to be resent
– Dropped packets will cause packets to be resent
• Senders that are trying to transmit to a congested
destination also become congested
– They must continually resend packets that have been
dropped or that have timed-out
– They must continue to hold outgoing/unacknowledged
messages in memory.
Congestion Control versus Flow Control
• Flow control
– controls point-to-point traffic between sender
and receiver
– e.g., a fast host sending to a slow host
• Congestion Control
– controls the traffic throughout the network
24-3 CONGESTION CONTROL

Congestion control refers to techniques and mechanisms


that can either prevent congestion, before it happens, or
remove congestion, after it has happened. In general,
we can divide congestion control mechanisms into two
broad categories: open-loop congestion control
(prevention) and closed-loop congestion control
(removal).

24.10
Congestion Control

• When one part of the subnet (e.g. one or more


routers in an area) becomes overloaded,
congestion results.
• Because routers are receiving packets faster than
they can forward them, one of two things must
happen:
– The subnet must prevent additional packets from
entering the congested region until those already
present can be processed.
– The congested routers can discard queued packets to
make room for those that are arriving.

11
Two Categories of Congestion Control

• Open loop solutions


– Attempt to prevent problems rather than
correct them
– Does not utilize runtime feedback from the
system
• Closed loop solutions
– Uses feedback (measurements of system
performance) to make corrections at runtime.
General Principles of Congestion Control
• Analogy with Control Theory:
– Open-loop, and
– Closed-loop approach.

• Open-loop approach
– Problem is solved at the design cycle
– Once the system is running midcourse correction are NOT made.
– Tools for doing open-loop control:
• Deciding when to accept new traffic,
• Deciding when to disregard packets and which ones.
• Making scheduling decision at various points in the network.
• Note that all those decisions are made without regard to the current state of the
network.
General Principles of Congestion Control

• Closed-loop approach
– It is based on the principle of feedback-loop. The approach has
three parts when applied to congestion control:
1. Monitor the system to detect when and where congestion occurs,
2. Pass this information tot places where action can be taken
3. Adjust system operation to correct the problem.
Figure 24.5 Congestion control
categories

24.15
Warning Bit/ Backpressure
• A special bit in the packet header is set by the
router to warn the source when congestion is
detected.
• The bit is copied and piggy-backed on the ACK
and sent to the sender.
• The sender monitors the number of ACK
packets it receives with the warning bit set
and adjusts its transmission rate accordingly.

16
Figure 24.6 Backpressure method for alleviating congestion

24.17
Choke Packets
• A more direct way of telling the source to
slow down.
• A choke packet is a control packet
generated at a congested node and
transmitted to restrict traffic flow.
• The source, on receiving the choke packet
must reduce its transmission rate by a
certain percentage.
• An example of a choke packet is the ICMP
Source Quench Packet.

18
Figure 24.7 Choke
packet

24.19
Open-Loop Control
• Network performance is guaranteed to all
traffic flows that have been admitted into the
network
• Initially for connection-oriented networks
• Key Mechanisms
– Admission Control
– Policing
– Traffic Shaping
– Traffic Scheduling
Admission Control
• Flows negotiate contract with
network
Peak rate
• Specify requirements:
– Peak, Avg., Min Bit rate
Bits/second

– Maximum burst size


Average rate
– Delay, Loss requirement
• Network computes resources
needed
– “Effective” bandwidth
• If flow accepted, network
Time allocates resources to ensure
QoS delivered as long as
Typical bit rate demanded by a
source conforms to contract
variable bit rate information
source
Policing
• Network monitors traffic flows continuously to ensure
they meet their traffic contract
• When a packet violates the contract, network can discard
or tag the packet giving it lower priority
• If congestion occurs, tagged packets are discarded first
• Leaky Bucket Algorithm is the most commonly used
policing mechanism
– Bucket has specified leak rate for average contracted rate
– Bucket has specified depth to accommodate variations in arrival
rate
– Arriving packet is conforming if it does not result in overflow
Traffic Shaping
• Another method of congestion control is to
“shape” the traffic before it enters the
network.
• Traffic shaping controls the rate at which
packets are sent (not just how many). Used
in ATM and Integrated Services networks.
• At connection set-up time, the sender and
carrier negotiate a traffic pattern (shape).
• Two traffic shaping algorithms are:
– Leaky Bucket
– Token Bucket
The Leaky Bucket Algorithm
• The Leaky Bucket Algorithm used to control
rate in a network. It is implemented as a
single-server queue with constant service
time. If the bucket (buffer) overflows then
packets are discarded.
The Leaky Bucket Algorithm

(a) A leaky bucket with water. (b) a leaky bucket


with packets.
Leaky Bucket Algorithm, cont.
• The leaky bucket enforces a constant output rate
(average rate) regardless of the burstiness of the
input. Does nothing when input is idle.
• The host injects one packet per clock tick onto
the network. This results in a uniform flow of
packets, smoothing out bursts and reducing
congestion.
• When packets are the same size (as in ATM cells),
the one packet per tick is okay. For variable length
packets though, it is better to allow a fixed number
of bytes per tick. E.g. 1024 bytes per tick will allow
one 1024-byte packet or two 512-byte packets or
four 256-byte packets on 1 tick.
Figure 24.19 Leaky
bucket

24.
142
Figure 24.20 Leaky bucket
implementation

24.
143
Note
A leaky bucket algorithm shapes bursty traffic into fixed-rate traffic by averaging the
data rate. It may drop the packets if the bucket is full.

24.
144
Note
The token bucket allows bursty traffic at a regulated maximum rate.

24.
145
Leaky Bucket Traffic Shaper
Size N
Incoming traffic Shaped traffic
Server

Packet

• Buffer incoming packets


• Play out periodically to conform to parameters
• Surges in arrivals are buffered & smoothed out
• Possible packet loss due to buffer overflow
• Too restrictive, since conforming traffic does not need to
be completely smooth
Token Bucket Algorithm
• In contrast to the LB, the Token Bucket Algorithm,
allows the output rate to vary, depending on the
size of the burst.
• In the TB algorithm, the bucket holds tokens.
To transmit a packet, the host must capture and
destroy one token.
• Tokens are generated by a clock at the rate of one
token every t sec.
• Idle hosts can capture and save up tokens (up to
the max. size of the bucket) in order to send
larger bursts later.
32
The Token Bucket Algorithm

5-34

(a) Before. (b) 33


Figure 24.21 Token bucket

24.34
Token Bucket Traffic Shaper
Tokens arrive
periodically

An incoming packet must


have sufficient tokens
before admission into the
network Size K
Token

Size N
Incoming traffic Shaped traffic
Server

Packet
• Token rate regulates transfer of packets
• If sufficient tokens available, packets enter network without delay
• K determines how much burstiness allowed into the network
Leaky Bucket vs Token Bucket
• LB discards packets; TB does not. TB
discards tokens.
• With TB, a packet can only be transmitted if
there are enough tokens to cover its length
in bytes.
• LB sends packets at an average rate. TB
allows for large bursts to be sent faster by
speeding up the output.
• TB allows saving up tokens (permissions) to
send large bursts. LB does not allow
saving.
Load Shedding
• When buffers become full, routers simply discard
packets.
• Which packet is chosen to be the victim depends on
the application and on the error strategy used in
the data link layer.
• For a file transfer, for, e.g. cannot discard older
packets since this will cause a gap in the received
data.
•For real-time voice or video it is probably better to
throw away old data and keep new packets.
• Get the application to mark packets with discard
priority.

You might also like