4. Network-layer services and protocols
transport packet from sending to
receiving host
sender: encapsulates segments into
packet header, passes to datalink layer
receiver: delivers packet to transport
layer protocol
network layer protocols in every
Internet device: hosts, routers
mobile network
enterprise
network
national or global ISP
datacenter
network
applicatio
n
transport
network
link
physical
applicatio
n
transport
network
link
physical
networ
k
link
physica
l
networ
k
link
physica
l
networ
k
link
physica
l
networ
k
link
physica
l
networ
k
link
physica
l
Routers:
examines header fields in all IP packets passing through it and moves
packet from input ports to output ports to transfer it along end-end
path
5. Network layer help to communication from Host to Host through IP
(internet protocol) addressing
Network Layer
6. Connection Oriented and Connectionless
Connection-oriented protocols, such as TCP, require that control data be
exchanged to establish the connection and additional fields in the PDU
(protocol data unit) header.
Because IP is connectionless, it requires no initial exchange of control
information to establish an end-to-end connection before packets are
forwarded,
This process greatly reduces the overhead of IP.
7. Addressing
IP address (Logical address) :
Internet Protocol (IP) is a numerical label assigned to each
computer (host)
in the network for communication.
There are two version from IP:
IP4 : 32 bits (written by binary in 4 parts separated by . 2 32 = 4 294967 296
devices)
IP6 : 128 bits (written by hex decimal in 8 parts separated by : (2128 )
Decimal notation
1 0
Binary notation
9. • To convert IP Address from Decimal to Binary
notation
First
Byte
Third
Byte
Fourth
Byte
2 145
2 72
2 36
2 18
2 9
2 4
2 2
1
1
0
0
0
1
0
0
1
10010001
2 10
2 5
2 2
2 1
0
1
0
1
0
0
0
0
Second
Byte
00001010
2 34
2 17
2 8
2 4
2 2
1
0
1
0
0
0
1
0
0
2 3
1
1
1
0
0
0
0
0
0
00100010 00000011
Addressing
How to convert
decimal to binary
10. 1.1
1.2
1.3
2.1
2.2
3.1
3.2
Anatomy of an IPv4 Address
• To identify a path or "route" through a network, the address must be
composed of two parts: 1) Network portion 2) Host portion
IP Address 192. 168. 1. 2
Network portion Host portion
11. Anatomy of an IPv4 Address
• Network Portion:
At Layer 3, we define a network as a group of hosts that have identical
bit patterns in the network address portion of their addresses.
192.168.1.2 192 168 1 2
192.168.1.67 192 168 1 67
192.168.1.204 192 168 1 204
Network portion Host portion
• Host Portion:
There are a variable number of bits that are called the host portion of
the address.
The number of bits used in this host portion determines the number of
hosts that we can have within the network.
12. Addressing
Address is divided into 5 classes A, B, C, D, E.
The Class of the address determines which part belongs to the network
address and which part belongs to the host address.
Which class of the following IP?
• 227.12.14.56 ?
• 134.11.78.9 ?
0 to 127
128 to 191 Net ID
192 to 223 Net ID Net ID
224 to 239
Class A
Class B
Class C
Class D
Class E 240 to 255
First Byte Second Byte Third Byte Fourth Byte
Class D
Class B
Used for Multicasting to multiple hosts.
Reserved for research and development.
13. Addressing
Class
First
Octet
Range
Number
of Network
Bits
Number
of Host
Bits
Number
of
Networks
Number
of Hosts
per Network
A 0-127 8 24 128 16,777,216
B 128-191 16 16 16,384 65,536
C 192-223 24 8 2,097,152 256
For example class A reserve first part which is 8 bits (0-7) 2 7 =128 Networks
and, number of hosts is 16777216 ( reserve 3 parts which is 24 bits 2 24
=16777216.
Generally : The address 127.0.0.1 is reserved for testing NIC (ping 127.0.0.1)
Note that
Network id + zeros in binary → network address. (Not allocated to a host).
For example in class A :112.0.0.0 is called network address and you can not
use it.
Network id + ones in binary → broadcast address. (Not allocated to a host).
For example in class A : 112.255.255.255 is called broadcast address and you
can not use it.
Network id + host-id → host address. For example 112.10.12.13
14. An IP4 host address: 123.234.210.109
• 123 = network id - in class A
• What is the network address?
• What is the broadcast address?
• Which of the following is valid IP address in the network?
• 123.15.8.9
• 123.234.210.112
• 125.12.15.23
• 123.234.210.109
valid
valid
Invalid : another network
Invalid : duplicate IP
Examples
123.0.0.0
123.255.255.255
15. Examples
• Given the host address 132.6.17.85, find the network address?
• Answer: The network address is 132.6.0.0.
• How to think: This address lies in class is B. Then the first 2 bytes
defines the net-id. So, we can find the network address by replacing
the host-id bytes (17.85) with 0s. Therefore, The network address is
132.6.0.0.
• Note:
• A network-address is different from a net-id. A network-address has
both net-id and host-id, with 0s for the host-id.
Find Network address for this IP’s
23.56.7.91
132.6.17.85
Class A (0-127) then the network address is 23.0.0.0
Class B (128-191) then the network address is 132.6.0.0
16. Network Address : Example
123.0.0.0
Class A
123.0.0.1 123.65.7.43
123.255.255.254 141.14.0.0
Class B
141.14.22.8 141.14.76.67
141.14.45.9
221.45.71.20
221.45.71.0
Class C
221.45.71.126
221.45.71.65