Professional Documents
Culture Documents
Unit 3 - IPV4 Header, IP Addressing, Subnetting
Unit 3 - IPV4 Header, IP Addressing, Subnetting
Network Layer
IPv4
2
0 15 16 31
4-bit 4-bit 8-bit Type Of
Version Header Service 16-bit Total Length (in bytes)
Length (TOS)
3-bit
16-bit Identification Flags 13-bit Fragment Offset
IP Header
8 bit Time To Live 8-bit Protocol 16-bit Header Checksum
TTL
Data
Application
Header + data
3
0 15 16 31
4-bit 4-bit 8-bit Type Of
Version Header Service 16-bit Total Length (in bytes)
Length (TOS)
3-bit
Data
The Network layer (Layer 3) provides services to exchange the data over
the network between identified end devices.
Layer 3 uses four basic processes:
Addressing
Encapsulation
Routing
Decapsulation
4
Addressing
Source IP = 172.16.3.10
Destination IP = 192.168.100.99
0 15 16 31
What would be the Source IP Address 4-bit
Version
4-bit
Header
8-bit Type Of
Service 16-bit Total Length (in bytes)
Length (TOS)
and Destination IP Address of a Packet 16-bit Identification
3-bit
Flags 13-bit Fragment Offset
from the client to the server?
8 bit Time To Live 8-bit Protocol 16-bit Header Checksum
Data
5
Encapsulation and Decapsulation
Data Link IP Header TCP HTTP Data Link
Data Trailer
Header Header Header
6
0 15 16 31
4-bit 4-bit 8-bit Type Of
Version Header Service 16-bit Total Length (in bytes)
Length (TOS)
3-bit
16-bit Identification Flags 13-bit Fragment Offset
Data
Source IP = 192.168.100.99
Destination IP = 172.16.3.10
192.168.100.99 172.16.3.10
7
Network Layer Protocols
• Layer 3 (IP)
– Speed over reliability
• Unreliable: Does not have the capability or
responsibility to manage, and recover from,
undelivered or corrupt packets.
• Who does?
– TCP at the end-to-end hosts
9
Media Independent
01000010
Solution
There is an error in this packet. The 4 left-most bits (0100) show
the version, which is correct. The next 4 bits (0010) show the
header length; which means (2 × 4 = 8), which is wrong. The
minimum number of bytes in the header must be 20. The packet
has been corrupted in transmission.
Example 2
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 3
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
40 bytes, which means the packet is carrying 20 bytes of data (40
− 20).
IP’s ToS Field
18
Note:
20
IP’s TTL – Time To Live field
Decrement by 1, if 0
drop the packet.
21
Protocol field
Payload
45000028000100000102 . . .
How many hops can this packet travel before being dropped?
The data belong to what upper layer protocol?
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. This
means the packet can travel only one hop. The protocol field is
the next byte (02), which means that the upper layer protocol is
IGMP
Source and Destination Address
Where I came
from.
Where I am going.
24
IP Fragmentation
TCP MSS defines the maximum
size of the data in the TCP
segment.
20 bytes 20 bytes 1460 bytes
IP Data = 500
IP Packet
Fragments
IP Data = 500
IP Data = 480
L2 Data = 500 L2
• A router may have to fragment a packet when forwarding it from one medium to
another medium that has a smaller MTU.
– If Don’t Fragment flag set, it will not fragment packet, but discard it.
26
IP Fragmentation It is my job to reconstruct
The outgoing link has a
The outgoing link has a the packets.
large enough MTU but I
smaller MTU so I have to
don’t reconstruct packets.
fragment the packets. IP Packet
IP Packet IP Packet
IP Packet
IP Packet
IP Packet IP Packet
IP Packet IP Packet
IP Packet IP Packet
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 nonfragmented packet is
considered the last fragment.
Example 6
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)
Example 7
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 8
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 9
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 is
the number 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.
IP addressing
10.10.10.10
What is this ?
10 . 10 . 10 . 10
IIIIIIII IIIIIIII IIIIIIII IIIIIIII
24115262
Area Code Subscriber No.
10 . 10 . 10 . 10 / 24
IIIIIIII IIIIIIII IIIIIIII IIIIIIII
N/W Bits
Network add – 10 . 10 . 10 . 0 / 24
Host add – 10 . 10 . 10 . 10 / 24
210 . 10 . 10 . 10 / 8
I I I I I I I I
7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2
10 . 10 . 10 . 10 / 24 Prefix Mask
IIIIIIII IIIIIIII IIIIIIII IIIIIIII
16.20.0.1/16
16.10.0.2/16 16.30.0.2/16
16.20.0.2/16
BLR
MS NP
24
Host IP 28
Host IP
Principle Of Sub-netting
8 Networks
3 2 Hosts ka subnet 16 . 20 . 20 . 0 / 24 16 . 20 . 20 . 0 / 27
8 256
24 BKC 24bits on network side 16 . 20 . 20 . 31 / 27
8bits on host side
16 16 . 20 . 20 . 32 / 27
16 8
2 = 256 hosts 16 . 20 . 20 . 63 / 27
00 16 . 20 . 20 . 64 / 27
16 . 20 . 20 . 0 256 hosts
16 . 20 . 20 . 255 16 . 20 . 20 . 95 / 27
Andheri 16 . 20 . 20 . 96 / 27
16 . 20 . 20 .127 / 27
16 . 20 . 20 .128 / 27
Vashi
16 . 20 . 20 .159 / 27
16 . 20 . 20 .160 / 27
MS 16 . 20 . 20 .191 / 27
NP
16 . 20 . 20 .192 / 27
16 . 20 . 20 .223 / 27
32hosts = 5 bits on host side T = 32 16 . 20 . 20 .224 / 27
H= - 5 16 . 20 . 20 .255 / 27
N = 27
Sub-netting with host - steps
24bits on network side
8bits on host side
16 . 20 . 20 . 0 / 24 16 . 20 . 20 . 0 / 27
28 = 256 hosts BKC IIIIIIII
16 . 20 . 20 . 31 / 27
16 . 20 . 20 . 0 16 . 20 . 20 . 32 / 27
16 . 20 . 20 . 255 32hosts
12 16 . 20 . 20 . 63 / 27
= 5 bits on host side
Host IP 16 . 20 . 20 . 64 / 27
1 = 32 hosts ka subnet
16 . 20 . 20 . 95 / 27
Andheri 30 + 2 = 32 hosts 16 . 20 . 20 . 96 / 27
Host IP 16 . 20 . 20 .127 / 27
16 . 20 . 20 .128 / 27
Vashi
16 . 20 . 20 .159 / 27
16 . 20 . 20 .160 / 27
MS 16 . 20 . 20 .191 / 27
NP 28
24 16 . 20 . 20 .192 / 27
Host IP
Host IP 16 . 20 . 20 .223 / 27
T = 32
16 . 20 . 20 .224 / 27
H= - 5
16 . 20 . 20 .255 / 27
2 N = 27
Sub-netting with Networks - step
16 . 20 . 20 . 0 / 24 + 3 = 27 1
BKC
16 . 20 . 20 . 0 / 27
8 Networks 16 . 20 . 20 . 31 / 27
12 = 3 bits on N/W side 16 . 20 . 20 . 32 / 27
Host IP 16 . 20 . 20 . 63 / 27
16 . 20 . 20 . 64 / 27
Andheri 30 16 . 20 . 20 . 95 / 27
Host IP 16 . 20 . 20 . 96 / 27
Vashi 16 . 20 . 20 .127 / 27
16 . 20 . 20 .128 / 27
16 . 20 . 20 .159 / 27
MS 16 . 20 . 20 .160 / 27
NP 28
24 16 . 20 . 20 .191 / 27
Host IP
Host IP T = 32 16 . 20 . 20 .192 / 27
N = - 27 16 . 20 . 20 .223 / 27
H= 5 16 . 20 . 20 .224 / 27
2 = 32 hosts ka Subnet 16 . 20 . 20 .255 / 27
Network address 16 . 20 . 20 . 0 / 27
Subnet-Zero
Broadcast address 16 . 20 . 20 . 31 / 27
Network address 16 . 20 . 20 . 32 / 27
Broadcast address 16 . 20 . 20 . 63 / 27
Network address 16 . 20 . 20 . 64 / 27 .65 /27 Host address
Broadcast address 16 . 20 . 20 . 95 / 27 .94 /27
Network address 16 . 20 . 20 . 96 / 27
Broadcast address 16 . 20 . 20 .127 / 27
Network address 16 . 20 . 20 .128 / 27 Only Host address can
be configured on
Broadcast address 16 . 20 . 20 .159 / 27 interfaces
Network address 16 . 20 . 20 .160 / 27
Broadcast address 16 . 20 . 20 .191 / 27
Network address 16 . 20 . 20 .192 / 27
Broadcast address 16 . 20 . 20 .223 / 27
Network address 16 . 20 . 20 .224 / 27
Broadcast address 16 . 20 . 20 .255 / 27
Last Subnet
16 . 20 . 20 . 0 / 27
BKC
16 . 20 . 20 . 31 / 27
16 . 20 . 20 . 32 / 27
16 . 20 . 20 . 63 / 27
16.20.20.129/27 16 . 20 . 20 . 64 / 27
16 . 20 . 20 . 95 / 27
Andheri
Vashi 16 . 20 . 20 . 96 / 27
16 . 20 . 20 .127 / 27
16 . 20 . 20 .128 / 27
16.20.20.130/27
16 . 20 . 20 .159 / 27
Dfg – 16.20.20.129
16 . 20 . 20 .160 / 27
16.20.20.65/27 NP 16 . 20 . 20 .191 / 27
16 . 20 . 20 .192 / 27
MS 28 16 . 20 . 20 .223 / 27
16.20.20.66/27 Host IP 16 . 20 . 20 .224 / 27
Dfg – 16.20.20.65 16 . 20 . 20 .255 / 27
Classfull / Classless address
• Classfull address : is address with default mask
– 10.10.10.0/8 (10.10.10.0 255.0.0.0)
12 16.20.20.2/27 30
Host IP 16.20.20.98/27 Host IP
Andheri
Vashi
16.20.20.129/27
16.20.20.130/27 16.20.20.34/27 16.20.20.226/27
16.20.20.66/27
16.20.20.225/27
MS NP
16.20.20.161/27 16.20.20.193/27
16.20.20.162/27 24
Host IP 28 16.20.20.194/27
Host IP
VLSM: Variable length Subnet Masking
2+2 = 4 hosts
2bits on host side 16 . 20 . 20 . 0 / 27
16 . 20 . 20 . 0 / 27 = 4hosts ka subnet
16 . 20 . 20 . 31 / 27 16 . 20 . 20 . 31 / 27
16 . 20 . 20 . 32 / 27 T = 32 16 . 20 . 20 . 0 / 30
16 . 20 . 20 . 63 / 27 H = - 2 16 . 20 . 20 .
______ 3 / 30
16 . 20 . 20 . 64 / 27 N = 30 16 . 20 . 20 . 4 / 30
16 . 20 . 20 . 95 / 27 16 . 20 . 20 . 7 / 30
16 . 20 . 20 . 96 / 27 16 . 20 . 20 . 8 / 30
16 . 20 . 20 .127 / 27 16 . 20 . 20 . 11 / 30
16 . 20 . 20 .128 / 27 16 . 20 . 20 . 12 / 30
16 . 20 . 20 .159 / 27 16 . 20 . 20 . 15 / 30
16 . 20 . 20 .160 / 27 16 . 20 . 20 . 16 / 30
16 . 20 . 20 .191 / 27 16 . 20 . 20 . 19 / 30
16 . 20 . 20 .192 / 27 16 . 20 . 20 . 20 / 30
16 . 20 . 20 .223 / 27 16 . 20 . 20 . 23 / 30
16 . 20 . 20 .224 / 27 16 . 20 . 20 . 24 / 30
16 . 20 . 20 .255 / 27 16 . 20 . 20 . 27 / 30
16 . 20 . 20 . 28 / 30
16 . 20 . 20 . 31 / 30
VLSM
16 . 20 . 20 . 0 / 24
BKC
16.20.20.1/30 16.20.20.14/30
12 30
Host IP 16.20.20.2/30 Host IP
16.20.20.13/30
Andheri
Vashi
16.20.20.129/27
16.20.20.130/27 16.20.20.5/30 16.20.20.226/27
16.20.20.9/30 16.20.20.225/27
MS NP
16.20.20.162/27 24 16.20.20.161/27 16.20.20.193/27
Host IP 28 16.20.20.194/27
Host IP
GIVEN: 16 . 20 . 20 . 0 /24
R1
R2
Andheri Panvel
10.0.0.0 /22 R1
R2
BKC 10.0.4.0 /22
R1
R2
Andheri Panvel
Problem
• An Organization is granted a block of
addresses with the beginning address
14.24.74.0/24.
• The organization needs to have 3 subblocks of
addresses to use in its three subnets: one
subblock of 10 addresses, one subblock of 120
addresses, one subblock of 60 addresses.
Design the subblocks.