0% found this document useful (0 votes)
6 views62 pages

Session 2 Network Layer

The document outlines the objectives and topics covered in a session on the Network Layer, including its functions, IP addressing, and subnetting. It details the responsibilities of the Network Layer in data delivery, routing, and packet management, as well as practical examples of IP address conversion and subnet calculations. Additionally, it discusses classful addressing and the implications of address allocation in network design.

Uploaded by

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

Session 2 Network Layer

The document outlines the objectives and topics covered in a session on the Network Layer, including its functions, IP addressing, and subnetting. It details the responsibilities of the Network Layer in data delivery, routing, and packet management, as well as practical examples of IP address conversion and subnet calculations. Additionally, it discusses classful addressing and the implications of address allocation in network design.

Uploaded by

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

Session-2

Network Layer Tasks


Session delivered by:
Dr. Rinki Sharma
Dr. Jyothi A P
Mrs. Madhushree
Mrs. Shaista Tarannum
1
Session Objectives

• To understand the function and operation of network layer with the


help of network layer protocols

• To understand the concept of IP Addressing

• To learn LINUX commands for IP address configuration

• To perform IP subnet calculations

2
22
Session Topics
• Position of Network Layer
• Duties of Network Layer
• Internetwork
• Network Layer in an Internetwork
• Datagram Approach
• IP Addressing
• Dotted-Decimal Notation
• Classful Addressing
• Finding the Address Class
• Netid and Hostid
• Subnetting
• Default Masks
• Subnet Mask
3
33
Position of Network Layer

4
44
Network Layer

The network layer is responsible for the source to destination


delivery of a packet across multiple network links.

5
55
Network Layer

• The network layer in the Internet model is responsible


carrying a packet from one computer to another.

• It is responsible for host to host delivery.

• It receives services from the data link layer and


provides services to the transport layer.

• Main service is, it receives from the data link layer is


the delivery of data, node to node.
6
66
Duties of Network Layer

7
7
Duties of Network Layer

• In Internetworking, logical gluing of heterogeneous


physical networks together to look like a single
network to the upper transport and application layers.

• In Addressing , Addresses used in the network layer


must uniquely and universally define the connection
of a host (computer) or a router to the Internet.

• In Routing , Requires a host or a router to have a


routing table.When a host has a packet to send or
when a router has received a packet to be forwarded.
8
88
Duties of Network Layer

• In Packetizing , network layer encapsulates packets received from


upper layer protocols and makes new packets out of them.

• In Fragmenting ,Each router decapsulates the IP data gram from the


received frame, processes it , and then encapsulates it in another
frame.

9
99
Internetwork

10
10
Links in an Internetwork

11
11
Network Layer in an
Internetwork

12
12
Network Layer at the Source

13
13
Network Layer at a Router

14
14
Network Layer at the
Destination

15
15
Switching

In a virtual circuit network, a


predetermined path is
established before data
transmission occurs, ensuring
ordered delivery. Data packets
follow this path and are delivered
in sequence. In contrast, a
datagram network, such as the
internet's internet protocol (IP),
uses a connectionless approach.

16
16
Datagram Approach

17
17
Datagram Approach

• Switching at the network layer in the Internet is done using the


datagram approach to packet switching.
• Communication at the network layer in the Internet is connectionless.

18
18
18
IP Addressing

An IP address is a 32-bit
address.
The IP addresses are unique
and universal
An identifier for a computer or device on a TCP/IP
network. Networks using the TCP/IP protocol route
messages based on the IP address of the destination. The
format of an IP address is a 32-bit numeric address written
as four numbers separated by periods. Each number can be
zero to 255. 19
19
Dotted-Decimal Notation

The binary, decimal, and


hexadecimal number systems
are reviewed in.

20
20
Example
Change the following IP addresses from binary notation to
dotted-decimal notation.
a. 10000001 00001011 00001011 11101111
b. 11111001 10011011 11111011 00001111

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

21
21
Example
Change the following IP addresses from dotted-decimal notation to
binary notation.
a. 111.56.45.78
b. 75.45.34.78

We replace each decimal number with its binary equivalent :


a. 01101111 00111000 00101101 01001110
b. 01001011 00101101 00100010 01001110

22
22
Classful Addressing
In classful addressing, the
address space is divided into
five classes: A, B, C, D, and E.

23
23
Finding the Address Class

24
24
Example
Find the class of each address:
a. 00000001 00001011 00001011 11101111
b. 11110011 10011011 11111011 00001111

See the procedure in previous Figure

a. The first bit is 0; this is a class A address.


b. The first 4 bits are 1s; this is a class E address.

25
25
Finding Class in Decimal
Notation

26
26
27
28
Example
Find the class of each address:
a. 227.12.14.87
b. 252.5.15.111
c. 134.11.78.56

a. The first byte is 227 (between 224 and 239); the class is D.
b. The first byte is 252 (between 240 and 255); the class is E.
c. The first byte is 134 (between 128 and 191); the class is B.

29
29
Netid and Hostid

30
30
Blocks in Class A

31
31
Blocks in Class B

32
32
Blocks in Class C

33
33
Classful Addressing
• Millions of class A addresses are wasted.
• Many class B addresses are wasted.
• The number of addresses in class C is smaller than
the needs of most organizations.

34
34
34
Network Address

In classful addressing, the network


address is the one that is assigned
to the organization
35
35
Example
Given the address 23.56.7.91, find the network address.

The class is A. Only the first byte defines the


netid. We can find the network address by
replacing the hostid bytes (56.7.91) with 0s.
Therefore, the network address is 23.0.0.0.

36
36
Example

Given the address 132.6.17.85, find the network address.

The class is B. The first 2 bytes defines the


netid. We can find the network address by
replacing the hostid bytes (17.85) with 0s.
Therefore, the network address is 132.6.0.0.

37
37
Example
Given the network address 17.0.0.0, find the class.

The class is A because the netid is only 1 byte.

38
38
Sample Internet

39
39
Network With Two Levels of Hierarchy

40
40
Network With Three Levels of Hierarchy
(subnetted)

41
41
Network Addresses With and Without Subnetting

42
42
Default Masks
In Dotted-
Class In Binary Using Slash
Decimal

11111111 00000000 00000000


A 255.0.0.0 /8
00000000
11111111 11111111 00000000
B 255.255.0.0 /16
00000000
11111111 111111111 11111111
C 255.255.255.0 /24
00000000
The network address can be found
by applying the default mask to
any
address in the block (including
itself).
It retains the netid of the block
43 and 43
Example
A router outside the organization receives a packet with destination
address 190.240.7.91. Show how it finds the network address to
route the packet.

The router follows three steps:


1. The router looks at the first byte of the address to find the
class. It is class B.
2. The default mask for class B is 255.255.0.0. The router ANDs
this mask with the address to get 190.240.0.0.
3. The router looks in its routing table to find out how to route the
packet to this destination. Later, we will see what happens if
this destination does not exist.
44
44
Subnet Mask

45
45
Example
A router inside the organization receives the same packet with
destination address 190.240.33.91. Show how it finds the
subnetwork address to route the packet.

The router follows three steps:


1. The router must know the mask. We assume it is /19, as shown
in Figure(previous slide).
2. The router applies the mask to the address, 190.240.33.91. The
subnet address is 190.240.32.0.
3. The router looks in its routing table to find how to route the
packet to this destination. Later, we will see what happens if
this destination does not exist.
46
46
Sample Problem 1

• IP address: 154.16.52.16 subnet mask: 255.255.240.0

• Find:

• Number of subnets possible on this network:


• Number of hosts possible on each subnet:
• Which subnet this address is on:
• Range of addresses on that subnet:

47
47
47
• Given Data:
• IP Address: 154.16.52.16
• Subnet Mask: 255.255.240.0

48
48
Step 1: Number of Subnets Possible
The subnet mask in binary is:
255.255.240.0 = 11111111.11111111.11110000.00000000
The number of bits used for subnetting is the count of 1s in the subnet mask
minus the default subnet mask for Class B networks (154.x.x.x is Class B,
default mask is 255.255.0.0):
• Default mask bits = 16
• New mask bits = 20
Thus, 4 bits are used for subnetting.
The formula for the number of subnets is:
2^number of subnet bits= 2^4 = 16
Number of Subnets Possible: 16
49
49
Step 2: Number of Hosts per Subnet
• The number of host bits is the remaining bits in the subnet mask:
• Total bits = 32
• Subnet bits = 20
• Host bits = 32 - 20 = 12
• The formula for the number of hosts per subnet is:

Number of Hosts Possible per Subnet: 4094


50
50
Step 3: Which Subnet This Address is On
• To determine the subnet, calculate the subnet ID by performing a bitwise
AND between the IP address and the subnet mask.
• Convert the IP and subnet mask to binary:
• IP: 154.16.52.16 → 10011010.00010000.00110100.00010000
• Subnet Mask: 255.255.240.0 → 11111111.11111111.11110000.00000000
• Perform the bitwise AND operation
10011010.00010000.00110100.00010000
AND
11111111.11111111.11110000.00000000
= 10011010.00010000.00110000.00000000
Subnet ID: 154.16.48.0
51
51
Step 4: Range of Addresses on the Subnet
For the range of addresses:
First Address (Subnet ID): 154.16.48.0
Last Address: Add the maximum number of hosts to the subnet ID:
154.16.48.0+4094=154.16.63.255
The broadcast address is 154.16.63.255, so the usable range of
addresses is:
• 154.16.48.1 to 154.16.63.254

52
52
Final Answers:
• Number of Subnets Possible: 16
• Number of Hosts Possible on Each Subnet: 4094
• Subnet This Address is On: 154.16.48.0
• Range of Addresses on That Subnet: 154.16.48.1 to 154.16.63.254

53
53
Sample problem 2
• IP address: 168.25.52.13 subnet mask: 255.255.230.0

• Find:

• Number of subnets possible on this network:


• Number of hosts possible on each subnet:
• Which subnet this address is on:
• Range of addresses on that subnet:

54
54
Given Data:
• IP Address: 168.25.52.13
• Subnet Mask: 255.255.230.0

55
55
Step 1: Number of Subnets Possible
• Convert the subnet mask to binary:
255.255.230.0 = 11111111.11111111.11100110.00000000
The number of 1s in the subnet mask represents the subnet bits.
• Subnet bits = 16 (Class B default mask) + 6 (extra bits) = 22.
The number of subnets possible is:
2^extra subnet bits= 2^6 = 64
Number of Subnets Possible: 64

56
56
Step 2: Number of Hosts per Subnet
• The number of host bits is the remaining bits after the subnet mask:
• Total bits = 32
• Subnet bits = 22
• Host bits = 32 - 22 = 10
• The formula for the number of hosts per subnet is:
2^number of host bits−2= 2^{10} - 2 = 1024 - 2 = 1022
• Number of Hosts Possible per Subnet: 1022

57
57
Step 3: Which Subnet This Address is On
• To determine the subnet ID, perform a bitwise AND operation between the IP address and
the subnet mask.
• Convert the IP and subnet mask to binary:
• IP: 168.25.52.13 → 10101000.00011001.00110100.00001101
• Subnet Mask: 255.255.230.0 → 11111111.11111111.11100110.00000000
• Perform the bitwise AND operation:
10101000.00011001.00110100.00001101
AND
11111111.11111111.11100110.00000000
= 10101000.00011001.00100100.00000000
• Convert back to decimal:
10101000.00011001.00100100.00000000 → 168.25.36.0
Subnet ID: 168.25.36.0
58
58
Step 4: Range of Addresses on the Subnet
• The range of addresses in the subnet includes:
First Usable Address: Subnet ID + 1 → 168.25.36.1
Last Usable Address: Subnet ID + Maximum Hosts →
168.25.36.0+1022=168.25.39.255
The broadcast address is 168.25.39.255, so the usable address range is:
• 168.25.36.1 to 168.25.39.254

59
59
Final Answers:
• Number of Subnets Possible: 64
• Number of Hosts Possible on Each Subnet: 1022
• Subnet This Address is On: 168.25.36.0
• Range of Addresses on That Subnet: 168.25.36.1 to 168.25.39.254

60
60
Summary
• The network layer is responsible for the source to destination delivery
of a packet across multiple network links

• Switching at the network layer in the Internet is done using the


datagram approach to packet switching

• Networks using the TCP/IP protocol route messages based on the IP


address of the destination.

• The format of an IP address is a 32-bit numeric address written as four


numbers separated by periods.

• Each number can be zero to 255.


61
61
61
References
• Behrouz A. Forouzan, Data Communication and Networking, 2nd
edition, Tata McGraw-Hill, 2000

• Behrouz A. Forouzan, TCP/IP Protocol Suite, 3rd edition, Tata McGraw-


Hill, 2007

• http://www.joshgentry.com/networking/subnet.htm

• http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworking.html

62
62
62

You might also like