Professional Documents
Culture Documents
Computer Network
Network Layer
2.1
2.2
2.3
2.2
2.3
➢ The packet is stored in the router until it has fully arrived and its checksum is verified for error
detection.
➢ Since, each router needs to store the entire packet before it can forward it to the next hop, the
mechanism is called store − and − forward switching.
Home PC
Plugged into
a DSL
modem Office Ethernet
❖ The services need to be carefully designed with the following goals in mind:
➢ The services should be independent of the router technology.
➢ The transport layer should be shielded from the number, type, andtopology of the routers present.
➢ The network addresses made available to the transport layer should use a uniform numbering plan,
even across LANs and WANs.
➢ Given these goals, the designers of the network layer have a lot of freedom in writing detailed
specifications of the services to be offered to the transport layer.
➢ The network service should be connectionless, with primitives SEND PACKET and RECEIVE
PACKET.
➢ In particular, no packet ordering and flow control should be done, because the hosts are going to do
that.
➢ Furthermore, each packet must carry the full destination address, because each packet sent is carried
independently of its predecessors, if any.
➢ In the network that provide a reliable, connection-oriented service, quality of service is the dominant
factor, and without connections in the network, quality of service is very difficult to achieve, especially
for real- time traffic such as voice and video.
➢ No advance setup is needed. In this context, the packets are frequently called datagrams (in
analogy with telegrams) and the network is called a datagram network.
➢ Suppose that the process P1 has a long message for P2. It hands the message to the transport layer,
with instructions to deliver it to process P2 on host H2.
➢ The transport layer code runs on H1, typically within the operating system. It prepends a
transport header to the front of the message and hands the result to the network layer.
➢ This connection is called a VC (virtual circuit), in analogy with the physical circuits set up by the
telephone system, and the network is called a virtual- circuit network. Some times it is called label
switching.
➢ Working of VCN: The virtual circuits avoid to choose a new route for every packet sent. Instead,
when a connection is established, a route from the source to the destination machine is chosen as
part of the connection setup and stored in tables inside the routers.
➢ That route is used for all traffic flowing over the connection, exactly the same way that the telephone
system works.
➢ When the connection is released, the virtual circuit is also terminated.
➢ With connection-oriented service, each packet carries an identifier telling which virtual circuit it
belongs to.
❖ Broadcast: In this case one sender, can transfer the information to all connected receivers.
❖ Multicast: There may be one or more senders, and the information is distributed to a set of receivers.
➢ IPv4 addresses are unique. i.e., each address defines one, and only one, connection to the Internet.
➢ Two devices on the Internet can never have the same address at the same time.
➢ Logical Address: Using some strategies, an address may be assigned to a device for a time period
and then taken away and assigned to another device.
➢ If a protocol uses N bits to define an address, the address space is 2 N because each bit can have two
different values (0 or 1) and N bits can have 2 N values.
➢ IPv4 uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296 (more than 4
billion).
➢ This means that, theoretically, if there were no restrictions, more than 4 billion devices could be
connected to the Internet.
➢ We replace each group of 8 bits with its equivalent decimal number and add dots for
separation:
a. 129.11.11.239
b. 249.155.251.15
⦁ 128 64 32 16 16
c. 14.23.120.8
d. 252.5.15.111
❖ Solution
b. The first 2 bits are 1; the third bit is 0.This is a class C address.
Netid’s Hostid’s
• 2^(8-1) = 128 • 2^24 = 16,777,216
• 2^(16-2) = 16,384 • 2^16 = 65,536
• 2^(24-3) = 2,097,152 • 2^8 = 256
2 24 =
27 =
2 14 = 2 16 =
28 =
2 21 =
2 32 =
2 32 =
➢ It increases routing efficiency, which helps to enhance the security of the network and
reduces the size of the broadcast domain.
➢ It also helps to reduce the size of the routing tables, which is stored in routers.This
method also helps to extend the existing IP address base & restructures the IP address.
➢ If an organization was granted a large block in class A or B, it could divide the addresses into
several contiguous groups and assign each group to smaller networks (called subnets).
➢ IP Subnetting designates high-order bits from the host as part of the network prefix.This
method divides a network into smaller subnets.
➢ In network, the very first and last IP address is used for Network Number and network
Broadcast IP address respectively.
➢ In subnetting also, the very first and last IP address of every subnet is used for Subnet Number
and Subnet Broadcast IP address respectively.
➢ Yet the number of devices on the Internet is much less than the 232 address space.
➢ We have run out of class A and B addresses, and a class C block is too small for most midsize
organizations.
➢ One solution that has alleviated the problem is the idea of classless addressing.
➢ There are no classes here, but the addresses are still granted in blocks.
❖ Address Blocks
➢ When an entity (network), small or large, needs to be connected to the Internet, it is granted a
block (range) of addresses.
➢ The size of the block (the number of addresses) varies based on the nature and size of the entity.
For example,
➢ Households may be given only two addresses;
➢ Large organizations may be given thousands of addresses.
➢ The ISP, may be given hundreds or thousands of addresses based on the number of customers it
may serve.
9/25/2022 MRS. RAKHI KALANTRI 32
Classless Addressing: Restrictions
➢ To simplify the handling of addresses, the Internet authorities impose three restrictions
on classless address blocks:
1. The addresses in a block must be contiguous, one after another.
2. The number of addresses in a block must be a power of 2 (1, 2, 4, 8, ... ).
3. The first address must be evenly divisible by the number of addresses.
= 3,440,387,360
➢ Example: 205.16.37.39/28
If we set (32 - 28) = 4 rightmost bits to 1, we get the last address of the block
11001101 00010000 00100101 00011111 or 205.16.37.47
❖ Number of Addresses: The number of addresses in the block is the difference between the
last and first address. It can easily be found using the formula 232 - n. For the above example it is
232-28 = 24 = 16
205.16.37.32
➢ The last address can be found by ORing the given addresses with the complement
of the mask.
205.16.37.47
9/25/2022 MRS. RAKHI KALANTRI 38
Network Addresses
➢ When an organization is given a block of addresses, the organization is free to allocate the
addresses to the devices that need to be connected to the Internet.
➢ The first address in a block is normally not assigned to any device; it is used as the network
address that represents the organization to the rest of the world.
➢ Mostly it is used by routers to direct the message sent to the organization from the outside
world.The organization network is connected to the Internet via a router.
➢ 022-27771000 (area code, operator code, exchange office code and phone number)
➢ An IP address can define only two levels of hierarchy when not subnetted.
➢ The prefix is common to all addresses in the network; the suffix changes from one device to
another.
➢ The rest of the world still sees the organization as one entity; however, internally there are
several subnets.
➢ All messages are sent to the router address that connects the organization to the rest of the
Internet; the router routes the message to the appropriate subnets.
➢ The organization has its own mask; each subnet must also have its own.
1. Suppose the mask for the first subnet is n1,then 232- n1 must be 32,which means that n1 =27.
2. Suppose the mask for the second subnet is n2,then 232- n2 must be 16,which means that n2 = 28.
3. Suppose the mask for the third subnet is n3,then 232- n3 must be 16,which means that n3 =28.
➢ This means that we have the masks 27,28,28 with the organization mask being 26.
➢ In subnet 1, the address 17.12.14.29/27 can give us the subnet address if we use the mask /27 because
➢ Host: 00010001 00001100 00001110 00011101
➢ Mask: 11111111 11111111 11111111 11100000 (/27)
➢ Subnet: 00010001 00001100 00001110 00000000 ....(17.12.14.0)
➢ In subnet 2, the address 17.12.14.45/28 can give us the subnet address if we use the mask /28 because
➢ Host:00010001 00001100 00001110 00101101
➢ Mask: 11111111 11111111 11111111 11110000 /28
➢ Subnet:00010001 00001100 00001110 00100000 ....(17.12.14.32)
➢ In subnet 3, the address 17.12.14.50/28 can give us the subnet address if we use the mask /28 because
➢ Host: 00010001 00001100 00001110 00110010
➢ Mask: 11111111 11111111 11111111 11110000 /28
➢ Subnet:00010001 00001100 00001110 00110000 ....(17.12.14.48)
➢ We can say that through subnetting ,we have three levels of hierarchy.
➢ Note that in our example,the subnet prefix length can differ for the subnets as shown in Figure.
• For 1st Subnet, 1st valid IP is 192.168.10.1/25, last valid IP is 192.168.10.126/25, and broadcast
address is 192.168.10.127/25
• For 2nd Subnet, 1st valid IP is 192.168.10.129/25, last valid IP is 192.168.10.254/25, and
broadcast address is 192.168.10.255/25
4) IP address of the first host, the last host and the broadcast address of each subnet are as follows:
4) IP address of the first host, the last host and the broadcast address of each subnet are as follows:
c. Subnet 1: The first address is the beginning address of the block or 211.17.180.0. To find the last address,we
need to write 7 (one less than the number of addresses in each subnet) in base 256 (0.0.0.7) and add it to the first
address (in base 256).
a. First address in subnet 1:211 .17 .180 .0
b. Number of addresses:0 .0 .0 .7
c. Last address in subnet 1:211 .17 .180 .7
d. Subnet 32:To find the first address in subnet 32,we need to add 248 (31 × 8) in base 256 (0.0.0.248) to the
first address in subnet 1.We have 211.17.180.0 +0.0.0.248 or 211.17.180.248. Now we can calculate the last
address in subnet 32 as we did for the first address.
a. First address in subnet 32:211 .17 .180 .248
b. Number of addresses:0 .0 .0 .7
c. Last address in subnet 32:211 .17 .180 .255
9/25/2022 MRS. RAKHI KALANTRI 53
More Levels of Hierarchy
➢ The structure of classless addressing does not restrict the number of hierarchical levels.
➢ An organization can divide the granted block of addresses into subblocks. Each subblock can in turn
be divided into smaller subblocks and so on.
➢ A national ISP can divide a granted large block into smaller blocks and assign each of them to a
regional ISP.
➢ A regional ISP can divide the block received from the national ISP into smaller blocks and
assign each one to a local ISP.
➢ A local ISP can divide the block received from the regional ISP into smaller blocks and assign each
one to a different organization.
➢ Finally, an organization can divide the received block and make several subnets out of it.
➢ The ultimate responsibility of address allocation is given to a global authority called the Internet
Corporation for Assigned Names and Addresses (ICANN).
➢ Each ISP, in turn, divides its assigned block into smaller subblocks and grants the subblocks to its
customers.
➢ In other words, an ISP receives one large block to be distributed to its Internet users.This is called address
aggregation: many blocks of addresses are aggregated in one block and granted to one ISP.
➢ Design the subblocks and find out how many addresses are still available after these allocations.
❖ Group 3
⦁ For this group, each customer needs 64 addresses.This means that 6 (log2 64) bits are needed to each
host.The prefix length is then 32 − 6 = 26.The addresses are
➢ The idea of NAT is to allow multiple devices to access the Internet through a single public address.
➢ Network Address Translation (NAT) is a process in which one or more local IP address is translated
into one or more Global IP address and vice versa in order to provide Internet access to the local hosts.
➢ Also, it does the translation of port numbers i.e. masks the port number of the host with another port
number, in the packet that will be routed to the destination.
➢ It then makes the corresponding entries of IP address and port number in the NAT table. NAT generally
operates on a router or firewall.
➢ Every class of IP,(A, B & C) has some addresses reserved as Private IP addresses.
➢ These IPs can be used within a network,campus,company and are private to it.
➢ These addresses cannot be routed on the Internet,so packets containing these private addresses are dropped
by the Routers.
= 224
= 220
= 216
➢ In order to communicate with the outside world, these IP addresses must have to be translated to some
public IP addresses using NAT (Network address translation) process, or Web Proxy server can be used.
➢ 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.
➢ But how does the NAT router know the destination address for a packet coming from the Internet?
➢ There may be tens or hundreds of private IP addresses,each belonging to one specific host.
➢ IP packet encapsulates data unit received from above layer and add to its own header information.
➢ IP header contains all the necessary information to deliver the packet at the other end.
➢ Header length: It is a 4 bit field that contains the length of the IP header. It helps in knowing from where
the actual data begins. [20 bytes, 60 bytes].The value lies in the range [5, 15]
➢ Type of service: is a 8 bit field that is used for Quality of Service (QoS). It provides 3 bits to signal
priority and 3 bits to signal whether a host cared more about delay, throughput, or reliability. 2 bits are
used to carry explicit congestion notification information.
➢ Total length: It is a 16 bit field that contains the total length of the datagram (in bytes).Total length = Header
length + Payload length. Maximum total length of datagram = Maximum value of 16 bit word = 65535
bytes.
➢ Identification field: It is needed to allow the destination host to determine which packet a newly arrived
fragment belongs to.All the fragments of a packet contain the same Identification value.
➢ Fragment Offset : This offset tells the exact position of the fragment in the original IP Packet.
➢ Time to Live : To avoid looping in the network, every packet is sent with some TTL value set, which tells
the network how many routers (hops) this packet can cross. At each hop, its value is decremented by one
and when the value reaches zero, the packet is discarded.
➢ Protocol : Tells the Network layer at the destination host, to which Protocol this packet belongs to, i.e.
the next level Protocol. For example protocol number of ICMP is 1,TCP is 6 and UDP is 17.
➢ Header Checksum : This field is used to keep checksum value of entire header which is then used
to check if the packet is received error-free.
➢ Options : This is optional field, which is used if the value of IHL is greater than 5.These options may
contain values for options such as Security, Record Route,Time Stamp, etc.
0:15:0:0:0:1:12:1213
➢ Extension headers: The IPv6 packet header has a minimum size of 40 octets (320 bits).
➢ Auto-configuration
➢ After a data packet leaves its source, it can choose among the many different paths to each its
destination.
➢ Routing algorithm mathematically computes the best path, i.e. “least – cost path” that the packet can
be routed through.
➢ An algorithm that is used for finding the shortest distance, or path, from starting node
to target node in a weighted graph is known as Dijkstra’s Algorithm.
➢ Dijkstra's algorithm makes use of weights of the edges for finding the path that
minimizes the total distance (weight) among the source node and all other nodes.
3. For the current node, analyse all of its unvisited neighbors and measure their distances by adding the current
distance of its own to the weight of the edge that connects to its neighbor node.
4. Compare the recently measured distance with the current distance assigned to the neighbouring node
and make it as the new current distance of the neighboring node.
5. After that,consider all of the unvisited neighbours of the current node, mark the current node as visited.
6. If the destination node has been marked visited then stop,an algorithm has ended.
7. Else, choose the unvisited node that is marked with the least distance, fix it as the new current node, and
repeat the process again from step 3.
(∞, - ) (∞, - )
(0) (∞, - )
(∞, - ) (∞, - )
➢ It was the original ARPANET routing algorithm and was also used in the Internet under the
name RIP.
➢ Each node shares its routing table with its immediate neighbors periodically when there is a change .
➢ For this each node can send a message to the immediate neighbors and find the distance between itself and
these neighbors.
➢ Figure shows the initial tables for each node.The distance for any entry that is not a neighbor is marked
as infinite (unreachable).
➢ Although node A does not know about node E, node C does. So if node C shares its routing table
withA, nodeA can also know how to reach node E.
➢ Node C does not know how to reach node D,but nodeA does.
➢ If nodeA shares its routing table with node C, node C also knows how to reach node D.
➢ In other words, nodes A and C, as immediate neighbors, can improve their routing tables if they help
each other.
➢ There is only one problem.How much of the table must be shared with each neighbor?
1. The receiving node needs to add the cost between itself and the sending node to each value in the
second column. Example, if node C claims that its distance to E is x, and the distance between A
and C is y,then the distance betweenAand E,via C ,is (x + y).
2. The receiving node needs to add the name of the sending node to each row as the third column if
the receiving node uses information from any row.The sending node is the next node in the route.
3. The receiving node needs to compare each row of its old table with the corresponding row of the
modified version of the received table.
a. If the next-node entry is different,the receiving node chooses the row with the smaller cost.
b. If the next-node entry is the same, the receiving node chooses the new row.
Note that the old routing table is not used in the calculation.
❖ Disadvantages of
➢ It is slower to converge.
➢ It creates more traffic since updates take place on a periodic basis and if there are changes in the
network topology,so bandwidth-wasting broadcasts occur.
➢ For larger networks, distance vector routing results in larger routing tables since each router must know
about allother routers.This can also lead to congestion onWAN links.
4. Send this packet to and receive packets from all other routers.
➢ In effect, the complete topology is distributed to every router. Then Dijkstra’s algorithm can be run at
each router to find the shortest path to every other router.
➢ When a router is booted,its first task is to learn who are its neighbors.
➢ It accomplishes this goal by sending a special HELLO packet on each point-to- point line.
➢ The router on the other end is expected to send back a reply giving its name.
➢ The link state routing algorithm requires each link to have a distance or cost metric for finding shortest
paths.
➢ The cost to reach neighbors can be set automatically,or configured by the network operator.
➢ If the network is geographically spread out, the delay of the links may be factored into the cost so that
paths over shorter links are better choices.
➢ The most direct way to determine this delay is to send over the line a special ECHO packet that the
other side is required to send back immediately.
➢ By measuring the round-trip time and dividing it by two, the sending router can get a reasonable estimate of
the delay.
➢ The packet starts with the identity of the sender, followed by a sequence number, age of the packet, a list of
neighbors and the cost to each neighbor.
➢ Example:
➢ Building the link state packets is easy.The hard part is determining when to build them.
➢ Another possibility is to build them when some significant event occurs, such as a line or
neighbor going down or coming back up again or changing its properties appreciably.
➢ First, if the sequence numbers wrap around, confusion will reign.The solution here is to use a
32-bit sequence number. With one link state packet per second, it would take 137 years to wrap
around, so this possibility can be ignored.
➢ Second, if a router ever crashes, it will lose track of its sequence number. If it starts again at 0, the next
packet it sends will be rejected as a duplicate.
➢ Third, if a sequence number is ever corrupted and 65,540 is received instead of 4 (a 1-bit error),
packets 5 through 65,540 will be rejected as obsolete, since the current sequence number will be
thought to be 65,540.
➢ The solution to all these problems is to include the age of each packet after the sequence number
and decrement it once per second.
➢ When the age hits zero,the information from that router is discarded.
➢ Normally, a new packet comes in, say, every 10 sec, so router information only times out when a
router is down (or six consecutive packets have been lost,an unlikely event).
➢ The Age field is also decremented by each router during the initial flooding process, to make sure
no packet can get lost and live for an indefinite period of time (a packet whose age is zero is
discarded).
➢ When a link state packet comes in to a router for flooding,it is not queued for transmission immediately.
➢ Instead,it is put in a holding area to wait a short while in case more links are coming up or going down.
➢ If another link state packet from the same source comes in before the first packet is transmitted, their
sequence numbers are compared.
➢ To guard against errors on the links,all link state packets are acknowledged.
➢ Once a router has accumulated a full set of link state packets, it can construct the entire network
graph because every link is represented.
➢ The shortest-path computations may then find different paths from router A to B than from router B
toA.
➢ Now Dijkstra’s algorithm can be run locally to construct the shortest paths to all possible
destinations.
➢ The results of this algorithm tell the router which link to use to reach each destination.This
information is installed in the routing tables,and normal operation is resumed.
➢ We need both because a packet at a network layer (such as IP) may pass through physical networks
(such as Ethernet and LocalTalk (Apple)).
➢ That means the delivery of a packet to a host or a router requires two levels of addressing:logical
and physical.
➢ It is required to map a logical address to its corresponding physical address and vice versa.
➢ IP packets use logical (host-to-host) addresses. These packets need to be encapsulated in a frame,
which needs physical addresses (node-to-node).
➢ For example, when booting a diskless network or leasing an IP address to a host.Three protocols are
designed for this purpose: RARP, BOOTp, and DHCP (Dynamic Host Configuration Protocol).
9/25/2022 MRS. RAKHI KALANTRI 121
Address Resolution Protocol
➢ Anytime a host or a router has an IP datagram to send to another host or router,it has the logical
(IP) address of the receiver.
➢ The logical (IP) address is obtained from the DNS ifthe sender is the host or it is found in a
routing table if the sender is a router.
➢ But the IP datagram must be encapsulated in a frame to be able to pass through the physical
network.
➢ This means that the sender needs the physical address of the receiver.
➢ The packet includes the physical and IP addresses of the sender and the IP address of the receiver.
➢ Because the sender does not know the physical address of the receiver,the query is broadcast over
the network.
➢ An ARP packet is encapsulated directly into a data link frame (Ethernet frame).Where the type field
indicates that the data carried by the frame are an ARP packet.
➢ Whenever a router running a proxy ARP receives an ARP request looking for the IP address of one of
these hosts,the router sends anARP reply announcing its own hardware (physical) address.
1. A diskless station is just booted.The station can find its physical address by checking its interface, but it
does not know its IP address.
2. An organization does not have enough IP addresses to assign to each station; it needs to assign IP
addresses on demand.The station can send its physical address and ask for a short time lease.
➢ The requesting machine must be running a RARP client program; the responding machine must be
running a RARP server program.
• Routing algorithms : Shortest Path (Dijkastra‘s), Link state routing, Distance Vector
Routing.
• Protocols - ARP,RARP.
• Congestion control algorithms: Open loop congestion control, Closed loop congestion
control, QoS parameters, Token & Leaky bucket algorithms.
• Application Layer: DNS: Name Space, Resource Record and Types of Name Server.
HTTP, SMTP, Telnet, FTP, DHCP
9/25/2022 MRS. RAKHI KALANTRI 132
Application Layer Questions
1. What is domain name space and how it is organized? “Hierarchy help in better
organization of domain names”. Justify the statement by giving example.
2. Show the sequence of characters exchanged between the TELNET client and the server to
switch from the default mode to the character mode and from the character mode to the
default mode.
4. User aaa@xxx.com sends a message to user bbb@yyy.com. The latter replies. Show all
SMTP commands and responses.
2.2
2.3
➢ When number of packets sent is within subnet carrying capacity, all are
delivered. As traffic increases, packet loss happens.At very high traffic,
performance collapses.
➢ Both transport and network layers share responsibility of handling congestion.
➢ Network layer is directly affected.
➢ Network congestion control should Protect the network from congestion
collapse but run the network as close to limits as possible.
➢ Higher utilization makes economic sense.
➢ Congestion control mechanisms are divided into two broad categories: open-loop congestion
control (prevention) and closed-loop congestion control (removal).
➢ Open-Loop Congestion Control: policies are applied to prevent congestion before it happens. In
these mechanisms, congestion control is handled by either the source or the destination (Examples:
retransmission policy, Acknowledgment policy ect.)
Basic It controls the traffic from a particular It controls the traffic entering the network.
sender to a receiver.
Purpose It prevents the receiver from being It prevents the network from getting congested.
overwhelmed by the data.
Responsibility Flow control is the responsibility handled Congestion Control is the responsibility handled
by data link layer and the transport layer. by network layer and transport layer.
Responsible The sender is responsible for transmitting The transport layer is responsible transmitting
extra traffic at receivers side. extra traffic into the network.
Preventive The sender transmits the data slowly to the Transport layer transmits the data into the
measures receiver. network slowly.
Methods Feedback-based flow control and Rate- Provisioning, traffic-aware routing and
based flow control admission control
➢ These solutions are usually applied on different time scales to either prevent congestion or react to
it once it has occurred.
❖ Hop‐by‐hop backpressure
⦁ Affect every hop it passes through
⦁ Provide quick relief at the point of congestion
➢ No single technique deals efficiently with all these issues. Instead, a variety of techniques have been
developed for use at the network (and transport) layer.
To accommodate a variety of applications, networks may support different categories of QoS. They
support:
Ans.:
Here , C is Capacity of bucket = 1mb
Data input rate = 25 mbps
output rate = 2mbps.
136
9/25/2022 MRS. RAKHI KALANTRI 153
Token Bucket
➢ The leaky bucket algorithm enforces output pattern at the average rate, no matter how bursty the traffic is.
➢ So in order to deal with the bursty traffic we need a flexible algorithm so that the data is not lost. One such
algorithm is token bucket algorithm.
➢ It is an algorithm used in packet-switched computer networks to ensure that data transmission in the
form of packets does not cross its bandwidth.
⦁ If there is a ready packet, a token is removed from the bucket, and the packet is sent.
Step – 2 : The bucket can hold at most b-tokens. If a token arrive when bucket is full it is discarded.
Step - 3 : When a packet of m bytes arrived m tokens are removed from the bucket and the packet is sent
to the network.
Step – 4 : If less than n tokens are available no tokens are removed from the buckets and the packet is
considered to be non conformant.The non conformant packet may be enqueued for subsequent
transmission when sufficient token have been accumulated in the bucket.
➢ If C is the maximum capacity of bucket and ρ is the arrival rate and M is the maximum output rate
then Burst Length S can be calculated as
C + ρS = MS
9/25/2022 MRS. RAKHI KALANTRI 156
Token Bucket
➢ To understand the algorithm, we can assume a bucket that is getting filled with tokens.The bucket is of
limited size, and the tokens represent packets of predetermined size.
➢ Whenever a packet wants to enter the bucket, the bucket checks its size and compares it with the defined
limit of the bucket, if it does not go above the limit, it is allowed or else it is dropped.
❖ For better understanding it can be divided into the following steps:
⦁ Every 1/r second a token is added to the bucket.
⦁ The capacity of the bucket is to hold b tokens.
⦁ When it has reached capacity and a token arrives, it is dropped or discarded.
⦁ Assuming a packet of n bytes comes, and there are already n tokens in the bucket, those tokens are
removed and the packet is sent to the network. Or if there is lesser than n tokens, then no tokens are
removed and the packet is said to be non-conformant.
2. For 22msec the output rate is 25mbps after that the output rate becomes 2mbps i.e. token arrival rate.Therefore, for
another 500 kb the time taken will be: 500/(2000) = 250 msec
Therefore, total output time = 22 +250 = 272 msec.
When the host has to send a packet, packet is In this leaky bucket holds tokens generated at
thrown in bucket. regular intervals of time.
In practice bucket is a finite queue outputs at If there is a no token in bucket, packet can not be
finite rate send.
⦁ If bucket is full in token Bucket , tokens are discard not packets.While in leaky bucket, packets are
discarded.
⦁ Token Bucket can send Large bursts at a faster rate while leaky bucket always sends packets at
constant rate.
➢ IPhas two deficiencies: lack of error control and lack of assistance mechanisms
➢ No error control :
• What if router must discard datagram because it cannot find route to final destination or because the
time-to-live field has a zero value?
• What if final destination must discard all fragments because some don’t arrive within a predetermined
time limit?
• These are examples of situations where an error has occurred and IP Protocol has no built-in
mechanism to notify the original host.
➢ The Internet Control Message Protocol (ICMP)has been designed to compensate for the above
two deficiencies.
➢ The error-reporting messages report problems that a router or a host (destination) may encounter
when it processes an IP packet.
➢ The query messages, which occur in pairs,help a host or a network manager get specific information
from a router or another host.
• For example,nodes can discover their neighbors.
• Hosts can discover and learn about routers on their network, and
• Routers can help a node redirect its messages.
➢ Instead, the messages are first encapsulated inside IP datagrams before going to the lower layer .
➢ The value of the protocol field in the IP datagram is 1 to indicate that the IP data is an ICMP message .
➢ ICMP error messages report errors conditions.Typically sent when a datagram is discarded.
➢ Error messages are always sent to the original source because the only information available in the
datagram 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 datagram .
Redirect Teach a router about geography A router to a host on the same local
network
➢ Routers reply with all routers they are aware of including themselves (Sometimes reply
without request) .
⦁ Processes may have to send the same message to a large numbers of receivers simultaneously.
This is called multicasting, which is aone-to-many communication.
❖ Examples:
• D istance learning and Video-on-demand
• Informing multiple stockbrokers about changes to a stock price
• Travel agents can be informed of a plane cancellation
➢ IGMP is one of the necessary but not sufficient protocol for multicasting
➢ Group membership: hosts and routers and the groups they are “interested” in (subscribe to).
➢ In any network, there are one or more multicast routers that distribute multicast packets to hosts or other
routers.
➢ The IGMP protocol gives the information about the membership status of hosts (routers) connected to the
network to multicast routers.
➢ Amulticast router may receive thousands of multicast packets every day for different groups.
➢ If a router has no knowledge about the membership status of the hosts, it must broadcast all these packets.
➢ Abetter solution is to keep a list of groups in the network for which there is at least one loyal member.
➢ IGMP helps the multicast router create and update this list.
Type Value
General or special query Ox11 or 00010001
Membership report Ox16 or 00010110
Leave report Ox17 or 00010111
➢ Maximum Response Time: This 8-bit field defines the amount of time in which a query must be answered.
The value is nonzero in the query message; it is set to zero in the other two message types.
➢ Checksum: The checksum is calculated over the 8-byte message.
➢ Group address: The value of this field is 0 for a general query message.
The value defines the groupid (multicast address of the group) in the special query, and other two messages.
9/25/2022 190
IGMP Operation
➢ IGMP operates locally, i.e., within a network
➢ For each group there is only one router connected to the network that has the duty of distributing the multicast
packets destined for that group
➢ A host or multicast router can have membership in a group.
➢ A host has “membership” if one of its processes receives multicast packets from some group
➢ A router has “membership” means that there is a network attached to some other interface that receives
multicast packets for the group
• R is distributing router
• R1 & R2 are multicast routers
• Possibly receive packets from R
• Forward to other networks but not on this network
➢ The protocol requires that the membership report be sent twice, one after the other within a few moments.
➢ In this way, if the first one is lost or damaged, the second one replaces it.
➢ Similarly, when a router sees that none of the networks connected to its interfaces is interested in a
specific group, it sends a leave report about that group.
➢ When a multicast router receives a leave report, it cannot immediately purge that group from its list
because the report comes from just one host / router; there may be other hosts or routers that are still
interested in that group.
➢ To make sure, the router sends a special query message and inserts the groupid, or multicast
address, related to the group.
➢ The router allows a specified time for any host or router to respond.
➢ If, during this time, no interest (membership report) is received, the router assumes that there are no
loyal members in the network and purges the group from its list.
104
9/25/2022 MRS. RAKHI KALANTRI 195
Monitoring Membership
➢ A host or router can join a group by sending a membership report message and leave a group by sending a
leave report message.
➢ Consider the situation in which there is only one host interested in a group, but the host is shut down
or removed from the system.
➢ The multicast router will never receive a leave report. How is this handled?
➢ The multicast router is responsible for monitoring all the hosts or routers in a LAN to see if they want to
continue their membership in a group.
➢ The router periodically (by default, every 125 s) sends a general query message.
➢ In this message, the group address field is set to 0.0.0.0.This means the query for membership
continuation is for all groups in which a host is involved, not just one.
106
9/25/2022 MRS. RAKHI KALANTRI 197
A general query message
➢ The router expects an answer for each group in its group list; even new groups may respond.
➢ The query message has a maximum response time of 10 s (the value of the field is actually 100, but this is
in tenths of a second).
➢ When a host or router receives the general query message, it responds with a membership report if it is
interested in a group.
➢ However, if there is a common interest (two hosts, for example, are interested in the same group), only
one response is sent for that group to prevent unnecessary traffic. This is called a delayed response.
➢ Note that the query message must be sent by only one router (normally called the query router), also to
prevent unnecessary traffic.
109
9/25/2022 MRS. RAKHI KALANTRI 200
Example of delayed response
➢ 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.
110
9/25/2022 MRS. RAKHI KALANTRI 201
Example of delayed response
➢ 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.
111
9/25/2022 MRS. RAKHI KALANTRI 202
Example of delayed response
⦁ 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 timer for
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.
➢ To prevent unnecessary traffic, IGMP designates one router as the query router for each network.
➢ Only this designated router sends the query message, and the other routers are passive (they receive
responses and update their lists).
113
9/25/2022 MRS. RAKHI KALANTRI 204
Encapsulation at Network Layer
➢ Ethernet is one of them. An Ethernet physical address (MAC address) is six bytes (48 bits) long.
➢ If the first 25 bits in an Ethernet address are 000000100000000010111100, this identifies a physical
multicast address for the TCP/IP protocol.
➢ To convert an IP multicast address into an Ethernet address, the multicast router extracts the least
significant 23 bits of a class D IP address and inserts them into a multicast Ethernet physical
address.
➢ 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.
➢ We add the result of part a to the starting Ethernet multicast address, which is 01:00:5E:00:00:00.The
result is