Networks - CN UNIT 3
Networks - CN UNIT 3
Networks - CN UNIT 3
(1) PACKETIZING
The first duty of the network layer is packetizing.
Packetizing means encapsulating the payload (data) in a network-layer packet
at the source and decapsulating the payload from the network-layer packet at
the destination.
The network layer is responsible for delivery of packets from a sender to a
receiver without changing or using the contents.
The source host receives the payload from an upper-layer protocol, adds a
header that contains the source and destination addresses and some other
information that is required by the network-layer protocol.
The destination host receives the network-layer packet from its data-link layer,
decapsulates the packet, and delivers the payload.
The routers in the path are not allowed to decapsulate the packets they have
received.
The routers are not allowed to change source and destination addresses either.
They just inspect the addresses for the purpose of forwarding the packet to the
next network on the path.
1
CS8591 – Computer Networks Unit 3
Forwarding
Forwarding can be defined as the action applied by each router when a packet
arrives at one of its interfaces.
The decision-making table that a router normally uses for applying this action
is called the forwarding table or routing table.
When a router receives a packet from one of its attached networks, it needs to
forward the packet to another attached network.
2. PACKET SWITCHING
( REFER THE TOPIC PACKET SWITCHING FROM UNIT – I )
2
CS8591 – Computer Networks Unit 3
3. NETWORK-LAYER PERFORMANCE
The performance of a network can be measured in terms of
Delay, Throughput and Packet loss.
DELAY
A packet from its source to its destination, encounters delays.
The delays in a network can be divided into four types:
Transmission delay, Propagation delay, Processing delay & Queuing delay.
Transmission Delay
A source host or a router cannot send a packet instantaneously.
A sender needs to put the bits in a packet on the line one by one.
If the first bit of the packet is put on the line at time t1 and the last bit is put on
the line at time t2, transmission delay of the packet is (t2 - t1).
The transmission delay is longer for a longer packet and shorter if the sender
can transmit faster.
The Transmission delay is calculated using the formula
Delaytr = (Packet length) / (Transmission rate)
Example :
In a Fast Ethernet LAN with the transmission rate of 100 million bits per
second and a packet of 10,000 bits, it takes (10,000)/(100,000,000) or
100 microseconds for all bits of the packet to be put on the line.
Propagation Delay
Propagation delay is the time it takes for a bit to travel from point A to point B
in the transmission media.
The propagation delay for a packet-switched network depends on the
propagation delay of each network (LAN or WAN).
The propagation delay depends on the propagation speed of the media, which is
3X108 meters/second in a vacuum and normally much less in a wired medium.
It also depends on the distance of the link.
The Propagation delay is calculated using the formula
Delaypg = (Distance) / (Propagation speed)
Example
If the distance of a cable link in a point-to-point WAN is 2000 meters and
the propagation speed of the bits in the cable is 2 X108 meters/second, then
the propagation delay is 10 microseconds.
Processing Delay
The processing delay is the time required for a router or a destination host to
receive a packet from its input port, remove the header, perform an error
detection procedure, and deliver the packet to the output port (in the case of a
3
CS8591 – Computer Networks Unit 3
router) or deliver the packet to the upper-layer protocol (in the case of the
destination host).
The processing delay may be different for each packet, but normally is
calculated as an average.
Delaypr = Time required to process a packet in a router or a destination host
Example
For example, if the distance of a cable link in a point-to-point WAN is
2000 meters and the propagation speed of the bits in the cable is 2 × 108
meters/second, then the propagation delay is 10 microseconds.
Queuing Delay
Queuing delay can normally happen in a router.
A router has an input queue connected to each of its input ports to store packets
waiting to be processed.
The router also has an output queue connected to each of its output ports to
store packets waiting to be transmitted.
The queuing delay for a packet in a router is measured as the time a packet
waits in the input queue and output queue of a router.
Delayqu = Time a packet waits in input and output queues in a router
Total Delay
Assuming equal delays for the sender, routers and receiver, the total delay
(source-to-destination delay) of a packet can be calculated if we know the
number of routers, n, in the whole path.
Total delay = (n + 1) (Delaytr + Delaypg + Delaypr) + (n) (Delayqu)
If we have n routers, we have (n +1) links.
Therefore, we have (n +1) transmission delays related to n routers and the
source, (n +1) propagation delays related to (n +1) links, (n +1) processing
delays related to n routers and the destination, and only ‘n’ queuing delays
related to n routers.
THROUGHPUT
Throughput at any point in a network is defined as the number of bits passing
through the point in a second, which is actually the transmission rate of data at
that point.
In a path from source to destination, a packet may pass through several links
(networks), each with a different transmission rate.
Throughput is calculated using the formula
Throughput = minimum{TR1 , TR2, . . . TRn}
Example:
Let us assume that we have three links, each with a different transmission
rate. The data can flow at the rate of 200 kbps in Link1, 100 kbps in Link2
and 150kbps in Link3.
4
CS8591 – Computer Networks Unit 3
PACKET LOSS
Another issue that severely affects the performance of communication is the
number of packets lost during transmission.
When a router receives a packet while processing another packet, the received
packet needs to be stored in the input buffer waiting for its turn.
A router has an input buffer with a limited size.
A time may come when the buffer is full and the next packet needs to be
dropped.
The effect of packet loss on the Internet network layer is that the packet needs
to be resent, which in turn may create overflow and cause more packet loss.
4. CONGESTION CONTROL
Congestion Control is a mechanism for improving the network performance.
It refers to techniques and mechanisms that can either prevent congestion
before it happens or remove congestion after it has happened.
5
CS8591 – Computer Networks Unit 3
Retransmission Policy
Retransmission is sometimes unavoidable.
If the sender feels that a sent packet is lost or corrupted, the packet
needs to be retransmitted.
Retransmission in general may increase congestion in the network.
However, a good retransmission policy can prevent congestion.
The retransmission policy and the retransmission timers must be
designed to optimize efficiency and at the same time prevent congestion.
Window Policy
The type of window at the sender may also affect congestion.
The Selective Repeat window is better than the Go-Back-N window for
congestion control.
In the Go-Back-N window, when the timer for a packet times out,
several packets may be resent, although some may have arrived safe and
sound at the receiver.
This duplication may make the congestion worse.
The Selective Repeat window, on the other hand, tries to send the
specific packets that have been lost or corrupted.
Acknowledgment Policy
The acknowledgment policy imposed by the receiver may also affect
congestion.
If the receiver does not acknowledge every packet it receives, it may
slow down the sender and help prevent congestion.
Several approaches are used in this case.
A receiver may send an acknowledgment only if it has a packet to be
sent or a special timer expires.
A receiver may decide to acknowledge only N packets at a time.
Sending fewer acknowledgments means imposing less load on the
network.
Discarding Policy
A good discarding policy by the routers may prevent congestion and at
the same time may not harm the integrity of the transmission.
For example, in audio transmission, if the policy is to discard less
sensitive packets when congestion is likely to happen, the quality of
sound is still preserved and congestion is prevented or alleviated.
6
CS8591 – Computer Networks Unit 3
Admission Policy
An admission policy, which is a quality-of-service mechanism can also
prevent congestion in virtual-circuit networks.
Switches in a flow first check the resource requirement of a flow before
admitting it to the network.
A router can deny establishing a virtual-circuit connection if there is
congestion in the network or if there is a possibility of future congestion.
Backpressure
The technique of backpressure refers to a congestion control mechanism
in which a congested node stops receiving data from the immediate
upstream node or nodes.
This may cause the upstream node or nodes to become congested, and
they, in turn, reject data from their upstream node or nodes, and so on.
Backpressure is a node-to- node congestion control that starts with a
node and propagates, in the opposite direction of data flow, to the
source.
The backpressure technique can be applied only to virtual circuit
networks, in which each node knows the upstream node from which a
flow of data is coming.
Choke Packet
A choke packet is a packet sent by a node to the source to inform it of
congestion.
In backpressure, the warning is from one node to its upstream node,
although the warning may eventually reach the source station.
In the choke-packet method, the warning is from the router, which has
encountered congestion, directly to the source station.
The intermediate nodes through which the packet has traveled are not
warned.
The warning message goes directly to the source station; the
intermediate routers do not take any action.
7
CS8591 – Computer Networks Unit 3
Implicit Signaling
In implicit signaling, there is no communication between the congested
node or nodes and the source.
The source guesses that there is congestion somewhere in the network
from other symptoms.
For example, when a source sends several packets and there is no
acknowledgment for a while, one assumption is that the network is
congested.
The delay in receiving an acknowledgment is interpreted as congestion
in the network; the source should slow down.
Explicit Signaling
The node that experiences congestion can explicitly send a signal to the
source or destination.
The explicit-signaling method is different from the choke-packet
method.
In the choke-packet method, a separate packet is used for this purpose;
in the explicit-signaling method, the signal is included in the packets
that carry data.
Explicit signaling can occur in either the forward or the backward
direction.
Based on Delay
When the load is much less than the capacity of the network, the delay is at a
minimum.
This minimum delay is composed of propagation delay and processing delay,
both of which are negligible.
However, when the load reaches the network capacity, the delay increases
sharply because we now need to add the queuing delay to the total delay.
The delay becomes infinite when the load is greater than the capacity.
Based on Throughout
When the load is below the capacity of the network, the throughput increases
proportionally with the load.
We expect the throughput to remain constant after the load reaches the
capacity, but instead the throughput declines sharply.
The reason is the discarding of packets by the routers.
8
CS8591 – Computer Networks Unit 3
When the load exceeds the capacity, the queues become full and the routers
have to discard some packets.
Discarding packets does not reduce the number of packets in the network
because the sources retransmit the packets, using time-out mechanisms, when
the packets do not reach the destinations.
5. IPV4 ADDRESSES
The identifier used in the IP layer of the TCP/IP protocol suite to identify the
connection of each device to the Internet is called the Internet address or IP
address.
Internet Protocol version 4 (IPv4) is the fourth version in the development of
the Internet Protocol (IP) and the first version of the protocol to be widely
deployed.
IPv4 is described in IETF publication in September 1981.
The IP address is the address of the connection, not the host or the router.
If the device is moved to another network, the IP address may be changed.
An IPv4 address is a 32-bit address that uniquely and universally defines the
connection .
IPv4 addresses are unique in the sense that each address defines one, and only
one, connection to the Internet.If a device has two connections to the Internet,
via two networks, it has two IPv4 addresses.
Pv4 addresses are universal in the sense that the addressing system must be
accepted by any host that wants to be connected to the Internet.
9
CS8591 – Computer Networks Unit 3
In binary notation, an IPv4 address is displayed as 32 bits. To make the address more
readable, one or more spaces are usually inserted between bytes (8 bits).
In hexadecimal notation, each hexadecimal digit is equivalent to four bits. This means
that a 32-bit address has 8 hexadecimal digits. This notation is often used in network
programming.
10
CS8591 – Computer Networks Unit 3
11
CS8591 – Computer Networks Unit 3
Class A
In Class A, an IP address is assigned to those networks that contain a large
number of hosts.
The network ID is 8 bits long.
The host ID is 24 bits long.
In Class A, the first bit in higher order bits of the first octet is always set to 0
and the remaining 7 bits determine the network ID.
The 24 bits determine the host ID in any network.
The total number of networks in Class A = 27 = 128 network address
The total number of hosts in Class A = 224 - 2 = 16,777,214 host address
Class B
In Class B, an IP address is assigned to those networks that range from small-
sized to large-sized networks.
The Network ID is 16 bits long.
The Host ID is 16 bits long.
In Class B, the higher order bits of the first octet is always set to 10, and the
remaining14 bits determine the network ID.
The other 16 bits determine the Host ID.
The total number of networks in Class B = 214 = 16384 network address
The total number of hosts in Class B = 216 - 2 = 65534 host address
Class C
In Class C, an IP address is assigned to only small-sized networks.
The Network ID is 24 bits long.
The host ID is 8 bits long.
In Class C, the higher order bits of the first octet is always set to 110, and the
remaining 21 bits determine the network ID.
The 8 bits of the host ID determine the host in a network.
The total number of networks = 221 = 2097152 network address
The total number of hosts = 28 - 2 = 254 host address
Class D
In Class D, an IP address is reserved for multicast addresses.
It does not possess subnetting.
The higher order bits of the first octet is always set to 1110, and the remaining
bits determines the host ID in any network.
12
CS8591 – Computer Networks Unit 3
Class E
In Class E, an IP address is used for the future use or for the research and
development purposes.
It does not possess any subnetting.
The higher order bits of the first octet is always set to 1111, and the remaining
bits determines the host ID in any network.
SUBNETTING
Subnets were initially designed for solving the shortage of IP addresses over
the Internet.
Subnetting is the practice of dividing a single physical network into two or
more smaller logical networks.
It increases routing efficiency, enhances the security of the network and
reduces the size of the broadcast domain.
13
CS8591 – Computer Networks Unit 3
Subnets are designed by accepting bits from the IP address's host part and using
these bits to assign a number of smaller sub-networks inside the original
network.
Subnetting allows an organization to add sub-networks without the need to
acquire a new network number via the Internet service provider (ISP).
In subnetting, a class A or class B block is divided into several subnets.
If all of the addresses in a network are not used, subnetting allows the
addresses to be divided among several organizations.
Each IP address consists of a subnet mask. All the class types, such as Class A,
Class B and Class C include the subnet mask known as the default subnet
mask.
The subnet mask is intended for determining the type and number of IP
addresses required for a given local network.
The router is called the default gateway. The default subnet mask is as follows:
Class A : 255.0.0.0
Class B : 255.255.0.0
Class C : 255.255.255.0
SUPERNETTING
In Supernetting, multiple networks are combined into a bigger network termed
as a Supernetwork or Supernet.
Supernetting is mainly done for optimizing the routing tables.
Without Supernetting, router will share all routes from routing tables as they
are.
With Supernetting, it will summarize them before sharing.
Route summarization reduces the size of routing updates dramatically.
14
CS8591 – Computer Networks Unit 3
Address Aggregation
One of the advantages of the CIDR strategy is address aggregation
(sometimes called address summarization or route summarization).
When blocks of addresses are combined to create a larger block, routing can be
done based on the prefix of the larger block.
ICANN assigns a large block of addresses to an ISP.
Each ISP in turn divides its assigned block into smaller subblocks and grants
the subblocks to its customers.
15
CS8591 – Computer Networks Unit 3
There are five special addresses that are used for special purposes:
this-host address, limited-broadcast address, loopback address,
private address, and multicast address.
This-host Address
The only address in the block 0.0.0.0/32 is called this-host address.
It is used whenever a host needs to send an IP datagram but it does not know its
own address to use as the source address.
Limited-broadcast Address
The only address in the block 255.255.255.255/32 is called limited-broadcast
address.
It is used whenever a router or a host needs to send a datagram to all devices in
a network.
The routers in the network, however, block the packet having this address as
the destination;the packet cannot travel outside the network.
Loopback Address
The block 127.0.0.0/8 is called loopback address.
A packet with one of the addresses in this block as the destination address
never leaves the host; it will remain in the host.
Private Address
Four blocks are assigned as private addresses: 10.0.0.0/8, 172.16.0.0/12,
192.168.0.0/16, and 169.254.0.0/16.
Multicast Address
The block 224.0.0.0/4 is reserved for multicast addresses.
16
CS8591 – Computer Networks Unit 3
SOLVED PROBLEMS
17
CS8591 – Computer Networks Unit 3
Example 8 :
An IPv4 packet has arrived with the first 8 bits as (01000010). The receiver discards
the packet. Why?
Solution
There is an error in this packet. The 4 leftmost bits (0100) show the version, which is
correct. The next 4 bits (0010)2 show an invalid header length (2 × 4 = 8). The
minimum number of bytes in the header must be 20. The packet has been corrupted in
transmission.
18
CS8591 – Computer Networks Unit 3
Example 9:
In an IPv4 packet, the value of HLEN is (1000). How many bytes of options are being
carried by this packet?
Solution
The HLEN value is 8, which means the total number of bytes in the header is 8 × 4, or
32 bytes.The first 20 bytes are the base header, the next 12 bytes are the options.
Example 10 :
In an IPv4 packet, the value of HLEN is 5, and the value of the total length field is
(0028)16. How many bytes of data are being carried by this packet?
Solution
The HLEN value is 5, which means the total number of bytes in the header is 5 × 4, or
20 bytes (no options). The total length is 0028 (= 40) bytes, which means the packet is
carrying 20 bytes of data (40 − 20).
Example 11 :
An IPv4 packet has arrived with the first few hexadecimal digits as shown.
(45000028000100000102…)16 How many hops can this packet travel before being
dropped?
Solution
To find the time-to-live field, we skip 8 bytes (16 hexadecimal digits). The time-to-
live field is the ninth byte, which is (01)
Example 12:
A packet has arrived with an M bit value of 0. Is this the first fragment, the last
fragment, or a middle fragment? Do we know if the packet was fragmented?
Solution
If the M bit is 0, it means that there are no more fragments; the fragment is the last
one. However, we cannot say if the original packet was fragmented or not. A non
fragmented packet is considered the last fragment.
Example 13 :
A packet has arrived with an M bit value of 1. Is this the first fragment, the last
fragment, or a middle fragment? Do we know if the packet was fragmented?
Solution
If the M bit is 1, it means that there is at least one more fragment. This fragment can
be the first one or a middle one, but not the last one. We don’t know if it is the first
one or a middle one; we need more information (the value of the fragmentation
offset).
19
CS8591 – Computer Networks Unit 3
Example 14 :
A packet has arrived with an M bit value of 1 and a fragmentation offset value of 0. Is
this the first fragment, the last fragment, or a middle fragment?
Solution
Because the M bit is 1, it is either the first fragment or a middle one. Because the
offset value is 0,it is the first fragment.
Example 15:
A packet has arrived in which the offset value is 100. What is the number of the first
byte? Do we know the number of the last byte?
Solution
To find the number of the first byte, we multiply the offset value by 8. This means that
the first byte number is 800. We cannot determine the number of the last byte unless
we know the length of the data.
Example 16 :
A packet has arrived in which the offset value is 100, the value of HLEN is 5, and the
value of the total length field is 100. What are the numbers of the first byte and the
last byte?
Solution
The first byte number is 100 × 8 = 800. The total length is 100 bytes, and the header
length is 20 bytes (5 × 4), which means that there are 80 bytes in this datagram. If the
first byte number is 800, the last byte number must be 879.
___________________________________________________________________
The dynamic host configuration protocol is used to simplify the installation and
maintenance of networked computers.
DHCP is derived from an earlier protocol called BOOTP.
Ethernet addresses are configured into network by manufacturer and they are
unique.
IP addresses must be unique on a given internetwork but also must reflect the
structure of the internetwork
Most host Operating Systems provide a way to manually configure the IP
information for the host
Drawbacks of manual configuration :
1. A lot of work to configure all the hosts in a large network
2. Configuration process is error-prune
It is necessary to ensure that every host gets the correct network number and that
no two hosts receive the same IP address.
For these reasons, automated configuration methods are required.
The primary method uses a protocol known as the Dynamic Host Configuration
Protocol (DHCP).
20
CS8591 – Computer Networks Unit 3
21
CS8591 – Computer Networks Unit 3
A DHCP packet is actually sent using a protocol called the User Datagram
Protocol (UDP).
22
CS8591 – Computer Networks Unit 3
The site must have only one connection to the global Internet through a NAT-
capable router that runs NAT software.
Types of NAT
Two types of NAT exists .
(a) One-to-one translation of IP addresses
(b) One-to-many translation of IP addresses
Address Translation
All of the outgoing packets go through the NAT router, which replaces the
source address in the packet with the global NAT address.
All incoming packets also pass through the NAT router, which replaces the
destination address in the packet (the NAT router global address) with the
appropriate private address.
Translation Table
There may be tens or hundreds of private IP addresses, each belonging to one
specific host.
The problem arises when we want to translate the source address to an external
address.
This is solved if the NAT router has a translation table.
23
CS8591 – Computer Networks Unit 3
24
CS8591 – Computer Networks Unit 3
8. FORWARDING OF IP PACKETS
Forwarding means to deliver the packet to the next hop (which can be the final
destination or the intermediate connecting device).
Although IP protocol was originally designed as a connectionless protocol,
today the tendency is to use IP as a connection-oriented protocol based on the
label attached to an IP datagram .
When IP is used as a connectionless protocol, forwarding is based on the
destination address of the IP datagram.
When the IP is used as a connection-oriented protocol, forwarding is based on
the label attached to an IP datagram.
In general, each node will have a choice of several routers, and so it needs to
pick the best one, or at least one that has a reasonable chance of getting the
datagram closer to its destination.
The router that it chooses is known as the next hop router.
25
CS8591 – Computer Networks Unit 3
The router finds the correct next hop by consulting its forwarding table.
The forwarding table is conceptually just a list of (NetworkNum, NextHop)
pairs.
There is also a default router that is used if none of the entries in the table
matches the destination’s network number.
All Packets destined for hosts not on the physical network to which the sending
host is attached will be sent out through the default router.
Forwarding Algorithm
If the resulting address (network address), matches with the address in the first
column, the information in the next two columns is extracted
Otherwise the search continues.
Normally, the last row has a default value in the first column, which indicates
all destination addresses that did not match the previous rows.
Routing in classless addressing uses another principle called longest mask
matching.
This principle states that the forwarding table is sorted from the longest mask
to the shortest mask.
In other words, if there are three masks, /27, /26, and /24, the mask /27 must be
the first entry and /24 must be the last.
26
CS8591 – Computer Networks Unit 3
Example
Let us make a forwarding table for router R1 using the configuration as given
in the figure above
When a packet arrives whose leftmost 26 bits in the destination address match
the bits in the first row, the packet is sent out from interface m2.
When a packet arrives whose leftmost 25 bits in the address match the bits in
the second row, the packet is sent out from interface m0, and so on.
The table clearly shows that the first row has the longest prefix and the fourth
row has the shortest prefix.
The longer prefix means a smaller range of addresses; the shorter prefix means
a larger range of addresses.
Example
The Figure below shows a simple example of using a label to access a
switching table.
27
CS8591 – Computer Networks Unit 3
Since the labels are used as the index to the table, finding the information in the
table is immediate.
28
CS8591 – Computer Networks Unit 3
IP SERVICE MODEL
The main concern in defining a service model for an internetwork is that we can
provide a host-to-host service only if this service can somehow be provided over
each of the underlying physical networks.
IP Service Model defines the host-to-host services that we want to provide.
The IP service model can be thought of as having two parts:
A GLOBAL ADDRESSING SCHEME - which provides a way to
identify all hosts in the internetwork
A DATAGRAM DELIVERY MODEL – A connectionless model of data
delivery.
FIELD DESCRIPTION
Version Specifies the version of IP. Two versions exists – IPv4 and IPv6.
HLen Specifies the length of the header
TOS An indication of the parameters of the quality of service
(Type of Service) desired such as Precedence, Delay, Throughput and Reliability.
Length Length of the entire datagram, including the header. The maximum
size of an IP datagram is 65,535(210 )bytes
Ident Uniquely identifies the packet sequence number.
(Identification) Used for fragmentation and re-assembly.
Flags Used to control whether routers are allowed to fragment a packet.
If a packet is fragmented , this flag value is 1.
If not, this flag value is 0.
Offset Indicates where in the datagram, this fragment belongs.
(Fragmentation The fragment offset is measured in units of 8 octets
offset) (64 bits). The first fragment has offset zero.
29
CS8591 – Computer Networks Unit 3
30
CS8591 – Computer Networks Unit 3
Example:
The original packet starts at the client; the fragments are reassembled at the
server.
The value of the identification field is the same in all fragments, as is the value
of the flags field with the more bit set for all fragments except the last.
Also, the value of the offset field for each fragment is shown.
Although the fragments arrived out of order at the destination, they can be
correctly reassembled.
The value of the offset field is always relative to the original datagram.
Even if each fragment follows a different path and arrives out of order, the
final destination host can reassemble the original datagram from the
fragments received (if none of them is lost) using the following strategy:
1) The first fragment has an offset field value of zero.
2) Divide the length of the first fragment by 8. The second fragment has an
offset value equal to that result.
3) Divide the total length of the first and second fragment by 8. The third
fragment has an offset value equal to that result.
31
CS8591 – Computer Networks Unit 3
4) Continue the process. The last fragment has its M bit set to 0.
5) Continue the process. The last fragment has a more bit value of 0.
REASSEMBLY:
Reassembly is done at the receiving host and not at each router.
To enable these fragments to be reassembled at the receiving host, they all
carry the same identifier in the Ident field.
This identifier is chosen by the sending host and is intended to be unique
among all the datagrams that might arrive at the destination from this source
over some reasonable time period.
Since all fragments of the original datagram contain this identifier, the
reassembling host will be able to recognize those fragments that go together.
For example, if a single fragment is lost, the receiver will still attempt to
reassemble the datagram, and it will eventually give up and have to garbage-
collect the resources that were used to perform the failed reassembly.
Hosts are now strongly encouraged to perform “path MTU discovery,” a
process by which fragmentation is avoided by sending packets that are small
enough to traverse the link with the smallest MTU in the path from sender to
receiver.
Packet Sniffing
An intruder may intercept an IP packet and make a copy of it.
Packet sniffing is a passive attack, in which the attacker does not change the
contents of the packet.
This type of attack is very difficult to detect because the sender and the receiver
may never know that the packet has been copied.
Although packet sniffing cannot be stopped, encryption of the packet can make
the attacker’s effort useless.
The attacker may still sniff the packet, but the content is not detectable.
Packet Modification
The second type of attack is to modify the packet.
The attacker intercepts the packet,changes its contents, and sends the new
packet to the receiver.
The receiver believes that the packet is coming from the original sender.
This type of attack can be detected using a data integrity mechanism.
The receiver, before opening and using the contents of the message, can use
this mechanism to make sure that the packet has not been changed during the
transmission.
IP Spoofing
An attacker can masquerade as somebody else and create an IP packet that
carries the source address of another computer.
32
CS8591 – Computer Networks Unit 3
IP SEC
The IP packets today can be protected from the previously mentioned attacks
using a protocol called IPSEC (IP Security).
This protocol is used in conjunction with the IP protocol.
IPSec protocol creates a connection-oriented service between two entities in
which they can exchange IP packets without worrying about the three attacks
such as Packet Sniffing, Packet Modification and IP Spoofing.
IP SEC provides the following four services:
1) Defining Algorithms and Keys : The two entities that want to create a
secure channel between themselves can agree on some available
algorithms and keys to be used for security purposes.
33
CS8591 – Computer Networks Unit 3
34
CS8591 – Computer Networks Unit 3
Ping
The ping program is used to find if a host is alive and responding.
The source host sends ICMP echo-request messages; the destination, if alive,
responds with ICMP echo-reply messages.
35
CS8591 – Computer Networks Unit 3
The ping program sets the identifier field in the echo-request and echo-reply
message and starts the sequence number from 0; this number is incremented by
1 each time a new message is sent.
The ping program can calculate the round-trip time.
It inserts the sending time in the data section of the message.
When the packet arrives, it subtracts the arrival time from the departure time to
get the round-trip time (RTT).
$ ping google.com
Traceroute or Tracert
The traceroute program in UNIX or tracert in Windows can be used to trace
the path of a packet from a source to the destination.
It can find the IP addresses of all the routers that are visited along the path.
The program is usually set to check for the maximum of 30 hops (routers) to be
visited.
The number of hops in the Internet is normally less than this.
$ traceroute google.com
36
CS8591 – Computer Networks Unit 3
2) Interdomain routing
Routing between autonomous systems.
Border Gateway Protocol (BGP) - based on the Path-Vector algorithm
37
CS8591 – Computer Networks Unit 3
Example :
The initial table for all the nodes are given below
Each node sends its initial table (distance vector) to neighbors and receives
their estimate.
Node A sends its table to nodes B, C, E & F and receives tables from nodes B,
C, E & F.
Each node updates its routing table by comparing with each of its neighbor's
table
38
CS8591 – Computer Networks Unit 3
System stabilizes when all nodes have complete routing information, i.e.,
Convergence.
Routing tables are exchanged periodically or in case of triggered update.
The final distances stored at each node is given below:
39
CS8591 – Computer Networks Unit 3
Problem 1 Problem 2
Periodic Update
In this case, each node automatically sends an update message every so often,
even if nothing has changed.
The frequency of these periodic updates varies from protocol to protocol, but
it is typically on the order of several seconds to several minutes.
Triggered Update
In this case, whenever a node notices a link failure or receives an update from
one of its neighbors that causes it to change one of the routes in its routing
table.
Whenever a node’s routing table changes, it sends an update to its neighbors,
which may lead to a change in their tables, causing them to send an update to
their neighbors.
40
CS8591 – Computer Networks Unit 3
Routers advertise the cost of reaching networks. Cost of reaching each link is 1
hop. For example, router C advertises to A that it can reach network 2, 3 at cost
0 (directly connected), networks 5, 6 at cost 1 and network 4 at cost 2.
Each router updates cost and next hop for each network number.
Infinity is defined as 16, i.e., any route cannot have more than 15 hops.
Therefore RIP can be implemented on small-sized networks only.
Advertisements are sent every 30 seconds or in case of triggered update.
41
CS8591 – Computer Networks Unit 3
Reliable Flooding
Each node sends its LSP out on each of its directly connected links.
When a node receives LSP of another node, checks if it has an LSP already for
that node.
If not, it stores and forwards the LSP on all other links except the incoming
one.
Else if the received LSP has a bigger sequence number, then it is stored and
forwarded. Older LSP for that node is discarded.
Otherwise discard the received LSP, since it is not latest for that node.
Thus recent LSP of a node eventually reaches all nodes, i.e., reliable flooding.
Route Calculation
Each node knows the entire topology, once it has LSP from every other node.
Forward search algorithm is used to compute routing table from the received
LSPs.
Each node maintains two lists, namely Tentative and Confirmed with entries of
the form (Destination, Cost, NextHop).
42
CS8591 – Computer Networks Unit 3
Example :
Problem 1 Problem 2
43
CS8591 – Computer Networks Unit 3
44
CS8591 – Computer Networks Unit 3
Spanning Trees
In path-vector routing, the path from a source to all destinations is determined
by the best spanning tree.
The best spanning tree is not the least-cost tree.
It is the tree determined by the source when it imposes its own policy.
If there is more than one route to a destination, the source can choose the route
that meets its policy best.
A source may apply several policies at the same time.
One of the common policies uses the minimum number of nodes to be visited.
Another common policy is to avoid some nodes as the middle node in a route.
The spanning trees are made, gradually and asynchronously, by each node.
When a node is booted, it creates a path vector based on the information it can
obtain about its immediate neighbor.
A node sends greeting messages to its immediate neighbors to collect these
pieces of information.
Each node, after the creation of the initial path vector, sends it to all its
immediate neighbors.
Each node, when it receives a path vector from a neighbor, updates its path
vector using the formula
Example:
The Figure below shows a small internet with only five nodes.
Each source has created its own spanning tree that meets its policy.
The policy imposed by all sources is to use the minimum number of nodes to
reach a destination.
The spanning tree selected by A and E is such that the communication does not
pass through D as a middle node.
Similarly, the spanning tree selected by B is such that the communication does
not pass through C as a middle node.
45
CS8591 – Computer Networks Unit 3
46
CS8591 – Computer Networks Unit 3
Each AS have a border router (gateway), by which packets enter and leave that
AS. In above figure, R3 and R4 are border routers.
One of the router in each autonomous system is designated as BGP speaker.
BGP Speaker exchange reachability information with other BGP speakers,
known as external BGP session.
Paths must be without any loop.
If there are multiple routes to a destination, BGP speaker chooses one based on
policy.
Speakers need not advertise any route to a destination, even if one exists.
Advertised paths can be cancelled, if a link/node on the path goes down. This
negative advertisement is known as withdrawn route.
Routes are not repeatedly sent. If there is no change, keep alive messages are
sent.
47
CS8591 – Computer Networks Unit 3
11. MULTICASTING
In multicasting, there is one source and a group of destinations.
Multicast supports efficient delivery to multiple destinations.
The relationship is one to many or many-to-many.
One-to-Many (Source Specific Multicast)
Radio station broadcast
Transmitting news, stock-price
Software updates to multiple hosts
Many-to-Many (Any Source Multicast)
Multimedia teleconferencing
Online multi-player games
Distributed simulations
In multicasting, the source address is a unicast address, but the destination
address is a group address.
The group address defines the members of the group.
In multicasting, a multicast router may have to send out copies of the same
datagram through more than one interface.
Hosts that are members of a group receive copies of any packets sent to that
group’s multicast address
A host can be in multiple groups
A host can join and leave groups
If a host wants to join or leave a multicast group , it sends a signal by
communicating with its local router using a special protocol.
In IPv4, the protocol is Internet Group Management Protocol (IGMP)
In IPv6, the protocol is Multicast Listener Discovery (MLD)
48
CS8591 – Computer Networks Unit 3
MULTICAST ADDRESSING
Multicast address is associated with a group, whose members are dynamic.
Each group has its own IP multicast address.
IP addresses reserved for multicasting are Class D in IPv4 (Class D 224.0.0.1
to 239.255.255.255), 1111 1111 prefix in IPv6.
Hosts that are members of a group receive copy of the packet sent when
destination contains group address.
Step 1 :
Change the rightmost 3 bytes in hexadecimal
Step 2 :
Subtract 8 from the leftmost digit (obtained in Step 1) , if it is greater than or
equal to 8. If it is less than 8, do not subtract.
Step 3 :
Add the result obtained from Step 2 to the Ethernet multicast starting address
Example 1:
Change the multicast IP address 238.212.24.9 to an Ethernet multicast address.
Solution
(1) The rightmost 3 bytes in hexadecimal are D4:18:09.
(2) We need to subtract 8 from the leftmost digit. The leftmost digit is D,
Subtracting 8 from D gives 5. (D - 8)
(3) The resulting value will be in 54:18:09.
(3) We add the result to the Ethernet multicast starting address.
The result is 01:00:5E:54:18:09
49
CS8591 – Computer Networks Unit 3
Example 2 :
Solution:
(1) The rightmost 3 bytes in hexadecimal are 2B:0E:07.
(2) We need to subtract 8 from the leftmost digit. The leftmost digit is 2 , which is
less than 8.So no need to subtract.
(3) We add the result to the Ethernet multicast starting address.
The result is 01:00:5E:2B:0E:07
Using IP multicast
Sending host does not send multiple copies of the packet
A host sends a single copy of the packet addressed to the group’s multicast
address
The sending host does not need to know the individual unicast IP address of
each member
50
CS8591 – Computer Networks Unit 3
TYPES OF MULTICASTING
Source-Specific Multicast - In source-specific multicast (one-to-many model),
receiver specifies multicast group and sender from which it is interested to
receive packets. Example: Internet radio broadcasts.
MULTICAST APPLICATIONS
Access to Distributed Databases
Information Dissemination
Teleconferencing.
Distance Learning
APPROACHES TO MULTICASTING
In multicast routing, as in unicast routing, we need to create routing trees to optimally
route the packets from their source to their destination
51
CS8591 – Computer Networks Unit 3
DRAWBACKS OF IPV4
Despite subnetting and CIDR, address depletion is still a long-term problem.
Internet must accommodate real-time audio and video transmission that
requires minimum delay strategies and reservation of resources.
Internet must provide encryption and authentication of data for some
applications
FEATURES OF IPV6
1. Better header format - IPv6 uses a new header format in which options are
separated from the base header and inserted, when needed, between the base
header and the data. This simplifies and speeds up the routing process because
most of the options do not need to be checked by routers.
2. New options - IPv6 has new options to allow for additional functionalities.
3. Allowance for extension - IPv6 is designed to allow the extension of the
protocol if required by new technologies or applications.
4. Support for resource allocation - In IPv6, the type-of-service field has been
removed, but two new fields, traffic class and flow label, have been added to
enable the source to request special handling of the packet. This mechanism
can be used to support traffic such as real-time audio and video.
Additional Features :
1. Need to accommodate scalable routing and addressing
2. Support for real-time services
3. Security support
4. Autoconfiguration -
The ability of hosts to automatically configure themselves with such
information as their own IP address and domain name.
5. Enhanced routing functionality, including support for mobile hosts
6. Transition from ipv4 to ipv6
52
CS8591 – Computer Networks Unit 3
IPv4 address is mapped to IPv6 address by prefixing the 32-bit IPv4 address
with 2 bytes of 1s and then zero-extending the result to 128 bits.
For example,
128.96.33.81 → : : FFFF : 128.96.33.81
53
CS8591 – Computer Networks Unit 3
Extension Headers
Extension header provides greater functionality to IPv6.
Base header may be followed by six extension headers.
Each extension header contains a NextHeader field to identify the header
following it.
54
CS8591 – Computer Networks Unit 3
ADVANTAGES OF IPV6
Address space ― IPv6 uses 128-bit address whereas IPv4 uses 32-bit address.
Hence IPv6 has huge address space whereas IPv4 faces address shortage
problem.
Header format ― Unlike IPv4, optional headers are separated from base
header in IPv6. Each router thus need not process unwanted addition
information.
Extensible ― Unassigned IPv6 addresses can accommodate needs of future
technologies.
Dual Stack
In dual-stack, nodes run both IPv6 and IPv4, uses Version field to decide which
stack should process an arriving packet.
In other words, a station must run IPv4 and IPv6 simultaneously until all the
Internet uses IPv6.
55
CS8591 – Computer Networks Unit 3
Tunneling
Tunneling is a strategy used when two computers using IPv6 want to
communicate with each other and the packet must pass through a region that
uses IPv4.
To pass through this region, the packet must have an IPv4 address.
The IPv6 packet is encapsulated in an IPv4 packet when it enters the region and
it when it exits the region.
It seems as if the IPv6 packet enters a tunnel at one end and emerges at the
other end.
To make it clear ,the IPv4 packet is carrying an IPv6 packet as data
Header Translation
Header translation is necessary when the majority of the Internet has moved to
IPv6 but some systems still use IPv4.
The sender wants to use IPv6, but the receiver does not understand IPv6.
In this case, the header format must be totally changed through header
translation.
The header of the IPv6 packet is converted to an IPv4 header.
56