Noida Institute of Engineering and
Technology, Greater Noida
Network Layer
Unit: 3
Computer Networks (ACSE502)
Purnima Pal
(Assistant Professor)
B Tech 5th Sem ECE
Department
12/17/2024 NISHA ACSE502 CN UNIT 3 1
Curriculum
NISHA ACSE502 CN UNIT 3
12/17/2024 2
Syllabus
NISHA ACSE502 CN UNIT 3
12/17/2024 3
Books
Text books:
1. Behrouz Forouzan, “Data Communication and Networking” Fourth Edition-2006,
Tata McGraw Hill
2. Andrew Tanenbaum “Computer Networks”, Fifth Edition-2011, Prentice Hall.
3. William Stallings, “Data and Computer Communication”, Eighth Edition-2008,
Pearson.
Reference Books:
4. Kurose and Ross, “Computer Networking- A Top-Down Approach”, Eighth
Edition-2021, Pearson.
5. Peterson and Davie, “Computer Networks: A Systems Approach”, Fourth Edition-
1996, Morgan Kaufmann
NISHA ACSE502 CN UNIT 3
12/17/2024 4
Course Objective
The objective of this course is to understand introduction of
computer networks with suitable transmission media and
different networking devices. Network protocols which are
essential for the computer network are need to explain such as
data link layer protocols and routing protocols.
A detail explanation of IP addressing , TCP/IP protocols and
application layer protocols are covered in this course.
NISHA ACSE502 CN UNIT 3
12/17/2024 5
Course Outcome
At the end of the course the student should be able to:
CO1:Explain basic concepts, OSI reference model, services and role of each
layer of OSI model and TCP/IP, networks devices and transmission
media, Analog and digital data transmission.
CO2: Apply channel allocation, framing, error and flow control techniques.
CO3: Describe the functions of Network Layer i.e. Logical addressing,
subnetting & Routing Mechanism.
CO4: Explain the different Transport Layer function i.e. Port addressing,
Connection Management, Error control and Flow control mechanism.
CO5: Explain the functions offered by session and presentation layer and their
Implementation.
CO6: Explain the different protocols used at application layer i.e. HTTP,
SNMP, SMTP, FTP,TELNET and VPN.
NISHA ACSE502 CN UNIT 3
12/17/2024 6
PO’s
1.Engineering knowledge
2. Problem analysis
3. Design/development of solutions
4. Conduct investigations of complex problems
5. Modern tool usage
6. The engineer and society
7. Environment and sustainability
8. Ethics
9. Individual and team work
10. Communication
11. Project management and finance
12. Life-long learning
NISHA ACSE502 CN UNIT 3
12/17/2024 7
CO-PO Mapping
Computer Networks(KCS- 603) Year of Study: 2021-21
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
KCS603.1 3 2 2 2 2 2 3
KCS603.2 3 3 2 3
KCS603.3 3 3 3 3 2 2 2 3
KCS603.4 3 2 2 2 3
KCS603.5 3 3 2 2 3 2 3
KCS603.6 3 2 2 2 2 2 2 2 2 3
12/17/2024 8
NISHA ACSE502 CN UNIT 3
PSO’s
On successful completion of graduation degree, The computer Science & Engineering
graduates will be able to:
PSO1: identify, analyze real world problems and design their ethical solutions using
artificial intelligence, robotics, virtual/augmented reality, data analytics, block chain
technology, and cloud computing.
PSO2: design and develop the hardware sensor devices and related interfacing software
systems for solving complex engineering problems.
PSO 3: understand inter-disciplinary computing techniques and to apply them in the
design of advanced computing.
PSO 4: conduct investigation of complex problem with the help of technical, managerial,
leadership qualities, and modern engineering tools provided by industry sponsored
laboratories.
NISHA ACSE502 CN UNIT 3
12/17/2024 9
PSO’s
CO PSO1 PSO2 PSO3 PSO4
KCS603.1 2 2 2 2
KCS603.2 2 2 2 2
KCS603.3 2 2 2 3
KCS603.4 2 2 2 2
KCS603.5 2 2 2 2
KCS606 2 2 2 2
NISHA ACSE502 CN UNIT 3
12/17/2024 10
Program Educational Objectives
PEO 1: To have an excellent scientific and engineering breadth so as to comprehend,
analyze, design and provide sustainable solutions for real-life problems using state-of-the-
art technologies.
PEO 2: To have a successful career in industries, to pursue higher studies or to support
entrepreneurial endeavors and to face the global challenges.
PEO 3:To have an effective communication skills, professional attitude, ethical values and
a desire to learn specific knowledge in emerging trends, technologies for research,
innovation and product development and contribution to society.
PEO 4: To have life-long learning for up-skilling and re-skilling for successful
professional career as engineer, scientist, entrepreneur and bureaucrat for betterment of
society.
NISHA ACSE502 CN UNIT 3
12/17/2024 11
Result Analysis
COMPUTER ORGANIZATION & ARCHITECTURE (KCS603)
Department wise Result of VI sem. 100
Subject wise result 100
Faculty wise result 100
NISHA ACSE502 CN UNIT 3
12/17/2024 12
End semester Question paper templates
NISHA ACSE502 CN UNIT 3
12/17/2024 13
Prerequisite and Recap
• Networking components
• Concept of physical addressing
• Concept of OSI and TCP/IP model
In previous unit
Data link layer duties
Multi access protocol
Error control
NISHA ACSE502 CN UNIT 3
12/17/2024 14
Content
Unit 3
• Point-to-point networks
• Logical addressing (IPv4)
• Basic internetworking (IP, CIDR
ARP, RARP, DHCP, ICMP)
• Routing, forwarding and delivery
• Static and dynamic routing
• Routing algorithms and protocols
• Congestion control algorithms
• IPv6.
NISHA ACSE502 CN UNIT 3
12/17/2024 15
Network Layer Functions
Objective: Study about basic concept of Network layer and its function
• Getting packets from the source all the way to the destination
• May require many hops through intermediate routers.
• It must know about the topology of the communication subnet ( the
set of all routers) and choose appropriate paths through it.
• It must take care to choose routers to avoid overloading some of the
lines and routers while leaving others idle.
• When source and destination are in different networks, it has to deal
with the differences.
12/17/2024 NISHA ACSE502 CN 16
UNIT 3
Network Layer Functions
• Encapsulation - The network layer receives a protocol data unit
(PDU) from the transport layer. In a process called encapsulation,
the network layer adds IP header information, such as the IP
address of the source (sending) and destination (receiving) hosts.
After header information is added to the PDU, the PDU is called a
packet.
• Routing - The network layer provides services to direct packets to a
destination host on another network. To travel to other networks,
the packet must be processed by a router.
• De-encapsulation - When the packet arrives at the network layer of
the destination host, the host checks the IP header of the packet. If
the destination IP address within the header matches its own IP
address, the IP header is removed from the packet. This process of
removing headers from lower layers is known as de-encapsulation.
12/17/2024 NISHA ACSE502 CN 17
UNIT 3
Network Layer
12/17/2024 NISHA ACSE502 CN 18
UNIT 3
Network Layer Protocols
12/17/2024 NISHA ACSE502 CN 19
UNIT 3
Network Layer Protocols
There are several network layer protocols in existence; however,
only the following two are commonly implemented:
• Internet Protocol version 4 (IPv4)
• Internet Protocol version 6 (IPv6)
12/17/2024 NISHA ACSE502 CN 20
UNIT 3
12/17/2024 NISHA ACSE502 CN 21
UNIT 3
IPv4 Protocol
12/17/2024 NISHA ACSE502 CN 22
UNIT 3
IPv4 Protocol
Objective: Study about basic concept of IP addressing and its type
An IPv4 address is a 32-bit address that uniquely and universally
defines the connection of a device (for example, a computer or a
router) to the Internet.
The address space of IPv4 is
232 or 4,294,967,296.
Dotted-decimal notation and binary notation for an IPv4 address
12/17/2024 NISHA ACSE502 CN 23
UNIT 3
IPv4 Example
Change the following IPv4 addresses from binary notation to dotted-
decimal notation.
Solution
We replace each group of 8 bits with its equivalent decimal number (see
Appendix B) and add dots for separation.
12/17/2024 NISHA ACSE502 CN 24
UNIT 3
IPv4 example
Change the following IPv4 addresses from dotted-decimal notation to
binary notation.
Solution
We replace each decimal number with its binary equivalent
12/17/2024 NISHA ACSE502 CN 25
UNIT 3
IPv4 example
Find the error, if any, in the following IPv4 addresses.
Solution
a. There must be no leading zero (045).
b. There can be no more than four numbers.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal
notation is not allowed.
12/17/2024 NISHA ACSE502 CN 26
UNIT 3
IPv4 address classification
Finding the classes in binary and dotted-decimal notation
In classful addressing, the address space is divided into five classes:
A, B, C, D, and E.
12/17/2024 NISHA ACSE502 CN 27
UNIT 3
IPv4 address classification
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
12/17/2024 NISHA ACSE502 CN 28
UNIT 3
IPv4 address classification
Number of blocks and block size in classful IPv4 addressing
In classful addressing, a large part of the available addresses were
wasted.
Default masks for classful addressing
12/17/2024 NISHA ACSE502 CN 29
UNIT 3
IPv4 address classification
A block of 16 addresses granted to a small organization
Classful addressing, which is almost obsolete, is replaced with
classless addressing.
12/17/2024 NISHA ACSE502 CN 30
UNIT 3
IPv4 address : classless addressing
In IPv4 addressing, a block of addresses can be defined as
x.y.z.t /n
in which x.y.z.t defines one of the addresses and the /n defines the mask.
The first address in the block can be found by setting the rightmost
32 − n bits to 0s.
The last address in the block can be found by setting the rightmost
32 − n bits to 1s.
The number of addresses in the block can be found by using the formula
232−n.
12/17/2024 NISHA ACSE502 CN 31
UNIT 3
Example 19.6
IPv4 address : classless addressing
Classless
addressing
12/17/2024 NISHA ACSE502 CN 32
UNIT 3
Example 19.6
IPv4 address : classless addressing
A block of addresses is granted to a small organization. We know that one
of the addresses is 205.16.37.39/28. What is the first address in the block?
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000
or
205.16.37.32.
12/17/2024 NISHA ACSE502 CN 33
UNIT 3
IPv4 address : classless addressing
Three-level hierarchy in an IPv4 address
12/17/2024 NISHA ACSE502 CN 34
UNIT 3
IPv4 address : classless addressing
An ISP is granted a block of addresses starting with 190.100.0.0/16 (65,536
addresses). The ISP needs to distribute these addresses to three groups of
customers as follows:
a. The first group has 64 customers; each needs 256 addresses.
b. The second group has 128 customers; each needs 128 addresses.
c. The third group has 128 customers; each needs 64 addresses.
Design the sub blocks and find out how many addresses are still available
after these allocations.
12/17/2024 NISHA ACSE502 CN 35
UNIT 3
IPv4 address : classless addressing
Group 1
For this group, each customer needs 256 addresses. This means that 8
(log2 256) bits are needed to define each host. The prefix length is then 32
− 8 = 24. The addresses are
12/17/2024 NISHA ACSE502 CN 36
UNIT 3
Example 19.10 (continued)
IPv4 address : classless addressing
Group 2
For this group, each customer needs 128 addresses. This means that 7
(log2 128) bits are needed to define each host. The prefix length is then 32
− 7 = 25. The addresses are
12/17/2024 NISHA ACSE502 CN 37
UNIT 3
Example 19.10 (continued)
IPv4 address : classless addressing
Group 3
For this group, each customer needs 64 addresses. This means that 6
(log264) bits are needed to each host. The prefix length is then 32 − 6 = 26.
The addresses are
Number of granted addresses to the ISP: 65,536
Number of allocated addresses by the ISP: 40,960
Number of available addresses: 24,576
12/17/2024 NISHA ACSE502 CN 38
UNIT 3
IPv4 address : classless addressing
An example of address allocation and distribution by an ISP
12/17/2024 NISHA ACSE502 CN 39
UNIT 3
IPv4 address : classless addressing
Addresses for private networks
12/17/2024 NISHA ACSE502 CN 40
UNIT 3
IPv4 address
Addresses in a NAT
12/17/2024 NISHA ACSE502 CN 41
UNIT 3
IPv6 address
Objective: Study about basic concept of IPv6 and its function
Despite all short-term solutions, address depletion is still a long-term
problem for the Internet. This and other problems in the IP protocol
itself have been the motivation for IPv6
An IPv6 address is 128 bits long.
12/17/2024 NISHA ACSE502 CN 42
UNIT 3
IPv6 address
IPv6 address in binary and hexadecimal colon notation
12/17/2024 NISHA ACSE502 CN 43
UNIT 3
IPv6 address
Expand the address 0:15::1:12:1213 to its original.
Solution
We first need to align the left side of the double colon to the left of the
original pattern and the right side of the double colon to the right of the
original pattern to find how many 0s we need to replace the double
colon.
This means that the original address is.
12/17/2024 NISHA ACSE502 CN 44
UNIT 3
IPv6 address
IPv6 address in binary and hexadecimal colon notation
12/17/2024 NISHA ACSE502 CN 45
UNIT 3
Routing
Objective: Study about basic concept of Routing and its type
An internet is a combination of networks connected by routers. When a
datagram goes from a source to a destination, it will probably pass
through many routers until it reaches the router attached to the
destination network.
12/17/2024 NISHA ACSE502 CN 46
UNIT 3
Routing
12/17/2024 NISHA ACSE502 CN 47
UNIT 3
Routing
DISTANCE VECTOR ROUTING: Updating of Routing table
• If the next-node entry is different
– The receiving node chooses the row with the smaller cost
– If there is a tie, the old one is kept
• If the next-node entry is the same
– i.e. the sender of the new row is the provider of the old
entry
– The receiving node chooses the new row, even though the
new value is infinity.
12/17/2024 NISHA ACSE502 CN 48
UNIT 3
Routing
• Periodic Update
– A node sends its routing table, normally 30
seconds, in a periodic update
• Triggered Update
– A node sends its routing table to its neighbors any
time when there is a change in its routing table
1. After updating its routing table, or
2. Detects some failure in the neighboring links
12/17/2024 NISHA ACSE502 CN 49
UNIT 3
Routing
Figure shows the initial routing table for an AS. Note that the
figure does not mean that all routing tables have been created
at the same time; each router creates its own routing table
when it is booted.
12/17/2024 NISHA ACSE502 CN 50
UNIT 3
Routing
Now assume router A sends four records to its neighbors, routers B,
D, and C. shows the changes in B’s routing table when it receives
these records.
12/17/2024 NISHA ACSE502 CN 51
UNIT 3
Routing
12/17/2024 NISHA ACSE502 CN 52
UNIT 3
Routing
The Routing Information Protocol (RIP) is an intra-domain
(interior) routing protocol used inside an autonomous
system. It is a very simple protocol based on distance vector
routing. RIP implements distance vector routing directly with
some considerations.
12/17/2024 NISHA ACSE502 CN 53
UNIT 3
Routing: Link state Routing
Link state routing has a different philosophy from that of distance vector
routing. In link state routing, if each node in the domain has the entire
topology of the domain—the list of nodes and links, how they are
connected including the type, cost (metric), and the condition of the links
(up or down)—the node can use the Dijkstra algorithm to build a routing
table.
12/17/2024 NISHA ACSE502 CN 54
UNIT 3
Routing
12/17/2024 NISHA ACSE502 CN 55
UNIT 3
Routing
12/17/2024 NISHA ACSE502 CN 56
UNIT 3
Routing
Building Routing Tables
• Creation of the states of the links by each node, called the link
state packets (LSP)
• Dissemination of LSPs to every other routers, called flooding
(efficiently)
• Formation of a shortest path tree for each node
• Calculation of a routing table based on the shortest path tree
12/17/2024 NISHA ACSE502 CN 57
UNIT 3
Routing
Creation of LSP
• LSP data: the node ID, the list of links, a sequence number, and
age.
• LSP Generation
– When there is a change in the topology of the domain
– On a periodic basis
• There is no actual need for this type of LSP, normally 60
minutes or 2 hours
12/17/2024 NISHA ACSE502 CN 58
UNIT 3
Routing
Forming shortest path three for router A in a graph
12/17/2024 NISHA ACSE502 CN 59
UNIT 3
Routing
12/17/2024 NISHA ACSE502 CN 60
UNIT 3
Routing
12/17/2024 NISHA ACSE502 CN 61
UNIT 3
Routing
To show that the shortest path tree for each node is different, we found
the shortest path tree as seen by node C.
12/17/2024 NISHA ACSE502 CN 62
UNIT 3
Routing
12/17/2024 NISHA ACSE502 CN 63
UNIT 3
Congestion Control
Objective: Study about basic concept of congestion control and its type
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.
Traffic descriptors
12/17/2024 NISHA ACSE502 CN 64
UNIT 3
Congestion Control
Three traffic profiles
12/17/2024 NISHA ACSE502 CN 65
UNIT 3
Congestion Control
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. Queues in a router
12/17/2024 NISHA ACSE502 CN 66
UNIT 3
Congestion Control
Packet delay and throughput as functions of load
12/17/2024 NISHA ACSE502 CN 67
UNIT 3
Congestion Control
Congestion control categories
12/17/2024 NISHA ACSE502 CN 68
UNIT 3
Congestion Control
Backpressure method for alleviating congestion
Choke packet
12/17/2024 NISHA ACSE502 CN 69
UNIT 3
Congestion Control
FIFO queue
Priority queuing
12/17/2024 NISHA ACSE502 CN 70
UNIT 3
Congestion Control
Weighted fair queuing
12/17/2024 NISHA ACSE502 CN 71
UNIT 3
Congestion Control
Leaky bucket
A leaky bucket
algorithm
shapes busty
traffic into
fixed-rate
traffic by
averaging the
data rate. It
Leaky bucket implementation
may drop the
packets if the
bucket is full.
12/17/2024 NISHA ACSE502 CN 72
UNIT 3
Congestion Control
Token bucket
12/17/2024 NISHA ACSE502 CN 73
UNIT 3
Faculty Video Links, Youtube & NPTEL Video
Links and Online Courses Details
• You tube/other Video Links
• https://www.youtube.com/watch?v=aqtd8iZlSAA
• https://www.youtube.com/watch?v=JhBnOamc_8s
12/17/2024 NISHA ACSE502 CN 74
UNIT 3
Daily Quiz
1. Routing tables of a router keeps track of
A. MAC Address Assignments
B. Port Assignments to network devices
C. Distribute IP address to network devices
D. Routes to use for forwarding data to its destination
2. What is the use of Ping command?
A. To test a device on the network is reachable
B. To test a hard disk fault
C. To test a bug in an Application
D. To test a Pinter Quality
3. Router and 3 layer switch work on which layer of OSI model.
A. Physical layer B. Data Link layer C. Network layer D. None
12/17/2024 NISHA ACSE502 CN 75
UNIT 3
Daily Quiz
4. Which is correct for IPv4 and IPv6
A. 32 & 128 B. 32 & 48 C. 48 & 128 D. 64 & 132
5. Find out wrong IP address
A. 192.168.2.50 B.168.02.34.1 C. 127.0.0.0 D. 111.2.56.39
6. Class C IP address default mask address
A. 255.0.0.0 B. 255.255.255.0 C. 255.255.0.0 D. None
7. Hub work on which layer of OSI model
A. Physical layer B. Data Link layer C. Network layer D. None
8. Main function of network layer of OSI model
A. Routing B. Logical addressing C. Both A&B D. None
9. Which IP address version have five classes
A. IPv4 B. IPv6 C. Both A & B D. None
10. Supernetting found in which type of IP addresses
A. Classfull B. Classless C. Both A &B D. None
12/17/2024 NISHA ACSE502 CN 76
UNIT 3
Weekly Assignment
1. A computer on 6 mbps network is regulated by a token bucket
The token bucket is filled at a rate of 1 mbps. It is initially Filled to
capacity with 8 mega bits. How long can the Computer transmit at
the full 6 mbps.
Solution: S=C/(M-P)=8/(6-1)=1.6 sec (CO2)
Ans
Capacity C=8 Mb
S Burst length in sec
M=6Mbps
P=1 Mbps
12/17/2024 NISHA ACSE502 CN 77
UNIT 3
MCQ s
1. Which of the following is true of the IP address 192.0.0.10? (CO4)
A) The netid is 192.
B) The hostid is 0.10.
C) The network address is 192.0.0.0.
D) none of the above
2. A subnet mask in class A has 14 1s. How many subnets does it define? (CO4)
A) 32
B) 8
C) 64
D) none of the above
12/17/2024 NISHA ACSE502 CN 78
UNIT 3
MCQ s
3. Given the IP address 201.14.78.65 and the subnet mask 255.255.255.224, what is the
subnet address? (CO4)
A) 201.14.78.32
B) 201.14.78.65
C) 201.14.78.64
D) none of the above
4. Routers function in the _______ layers. (CO4)
A) physical and data link
B) physical, data link, and network
C) data link and network
D) none of the above
12/17/2024 NISHA ACSE502 CN 79
UNIT 3
Old Question Papers
• http://www.ululu.in/computer-networks-solve
d-sample-papers-btech-6th-semester/
12/17/2024 NISHA ACSE502 CN 80
UNIT 3
Expected Questions for University Exam
1. Compare routers and gateways. (CO4)
2. Write the IP address range of each class. (CO4)
3. Explain the need of subnet. (CO4)
4. Write acronym for ARP, RARP, ICMP(CO4)
5. For the given IP address 192.168.2.9 find the class, network
address and host address. (CO4)
6. Write down default mask for each class IP address. (CO4)
7. Write down subnet mask for given 192.12.3.9/26 IP address.
(CO4)
8. List the functions of network layer. (CO4)
12/17/2024 NISHA ACSE502 CN 81
UNIT 3
Summary
In this unit 3 we have studied about Network layer of OSI
model, its functions and how it handles the packet
received from transport layer. Routing methods are also
explained and comparison IPv4 and IPv6 completed.
To manage the traffic congestion control is covered.
12/17/2024 NISHA ACSE502 CN 82
UNIT 3
Recap of Unit
• Point-to-point networks
• Logical addressing (IPv4)
• Basic internetworking (IP, CIDR
ARP, RARP, DHCP, ICMP)
• Routing, forwarding and delivery
• Static and dynamic routing
• Routing algorithms and protocols
• Congestion control algorithms
• IPv6.
NISHA ACSE502 CN UNIT 3
12/17/2024 83
References
Books:
1. Forouzen, "Data Communication and Networking",TMH
2. A.S. Tanenbaum, Computer Networks, Pearson Education
3. W. Stallings, Data and Computer Communication,
MacmillanPress
Thank You
12/17/2024 NISHA ACSE502 CN 84
UNIT 3