Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 69

IPV4 Header

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

32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

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

Network Layer 16-bit Identification Flags 13-bit Fragment Offset

8 bit Time To Live 8-bit Protocol 16-bit Header Checksum


TTL

32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

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

192.168.100.99 Source IP = 192.168.100.99 172.16.3.10


Destination IP = 172.16.3.10

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

 What would be the Source IP Address TTL

32-bit Source IP Address


and Destination IP Address of a Packet
from the server to the client? 32-bit Destination IP Address

Options (if any)

Data

5
Encapsulation and Decapsulation
Data Link IP Header TCP HTTP Data Link
Data Trailer
Header Header Header

Data Link Data Link


IP Packet
Header Trailer

Data Link Data Link


IP Packet
Header Trailer

Data Link Data Link


IP Packet
Header Trailer

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

Routing 8 bit Time To Live 8-bit Protocol 16-bit Header Checksum


TTL

32-bit Source IP Address

32-bit Destination IP Address

Options (if any)

Data

Source IP = 192.168.100.99
Destination IP = 172.16.3.10
192.168.100.99 172.16.3.10

• Routers examine Layer 3 Destination IP addresses to forward packets.


– Search their routing tables.
– Send the packet to the next-hop router or host if on that network

7
Network Layer Protocols

• The Internet Protocol (IPv4 and IPv6) is the


most widely-used Layer 3 data carrying
8 protocol.
Best Effort Service (unreliable)

• 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

• Responsibility of the OSI Data Link layer to take an IP


packet and prepare it for transmission over the
communications medium.
• Transport of IP packets is not limited to any particular
medium.
• May need to fragment the packet if it is too many bits
10 (later).
Position of IP in TCP/IP protocol suite
IP datagram
DATAGRAM
• A packet in the IP layer is called a datagram, a
variable-length packet consisting of two parts:
header and data.
• The header is 20 to 60 bytes in length and contains
information essential to routing and delivery.
IPv4 datagram header fields
• Version Number: 4-bit version number defines
the version of IPv4 protocol which has the
value 4
• HLEN: 4-bit header length defines the total
length of the datagram header in 4-byte
words
Example 1

An IP packet has arrived with the first 8 bits as shown:

01000010

The receiver discards the packet. Why?

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

In an IP packet, the value of HLEN is 1000 in binary. How many


bytes of options are being carried by this packet?

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

In an IP packet, the value of HLEN is 516


and the value of the total length field is 002816 . How
many bytes of data are being carried by this packet?

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

• Type-of-Service is used to determine the priority of each packet.


• Enables Quality-of-Service (QoS) mechanism for high priority traffic.
• What types of traffic might a network administrator need to give priority to? Traffic
that cannot accept any delays.
– VoIP
– Streaming video

18
Note:

The total length field defines the total


length of the datagram including the
header.
IP’s TTL – Time To Live field

• Sending hosts generates the value for TTL.


• Common operating system TTL values are:
– UNIX: 255
– Linux: 64 or 255 depending upon vendor and version
– Microsoft Windows 95: 32
– Microsoft Vista: 128

20
IP’s TTL – Time To Live field

Decrement by 1, if 0
drop the packet.

• Decremented by each router.


• If the router decrements the TTL field to 0, it will then drop the packet.
• What is the advantage to decrementing the TTL by each router and dropping the
packet if it is 0?
– So IP packets can not travel around the Internet forever, from router to router.

21
Protocol field

Multiplexing and demultiplexing using the value of protocol field

Payload

PROTOCOL field specifies the final destination protocol to


which the IP datagram should be delivered
Example 4

An IP packet has arrived with the first few hexadecimal digits as


shown below:

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

Ethernet MTU defines the


maximum size of the data in the TCP MSS = 1460
Ethernet frame.
Data = 1460 bytes

The host using Ethernet, MTU of 1500 octets so


I will set my MSS to 1460.
1500 bytes

Determining TCP MTU


• The default Ethernet MTU How much is
value for a PC is 1500 bytes. enough?
(curriculum says MSS)
• Typical Maximum Segment
Size (MSS) of a TCP segment
is 1460 bytes.
– The number of bytes of
25
data.
IP Fragmentation
Original IP
Packet IP Data = 1480 bytes
IP Header = 20 bytes

IP Data = 500
IP Packet
Fragments
IP Data = 500

IP Data = 480

This packet is too big to go


L2 Data = 520 L2 over my serial link all at once.
I need to break it into smaller
L2 Data = 520 L2 fragments

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

Network link with Network link with Network link with


larger MTU smaller MTU larger MTU

IP Packet IP Packet

IP Packet IP Packet

IP Packet IP Packet

• When fragmentation occurs, it does not get


reconstructed until it reaches the host.
– This takes processing time.
27 – Fragment Offset field identifies the order
MTU
MTUs for some networks
Fields related to fragmentation
• Identification: Identifies the datagram
originating from source host
– All packets have same identification number
• Flags: Three bit field used for fragmentation
• Fragmentation offset: Shows the relative
position of the fragment with respect to
whole datagram
Flags field
Fragmentation example
The value of offset is measured in units of 8 bytes
Length of the offset is 13 bits and cannot represent a sequence of bytes > 8191
Detailed fragmentation example
Example 5

A packet has arrived with an M bit value of 0. Is this the first


fragment, the last fragment, or a middle fragment? Do we know
if the packet was fragmented?

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

A packet has arrived with an M bit value of 1. Is this the first


fragment, the last fragment, or a middle fragment? Do we know
if the packet was fragmented?

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

A packet has arrived with an M bit value of 1 and a


fragmentation offset value of zero. Is this the first fragment, the
last fragment, or a middle fragment?

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 ?

Just Set of numbers; IP address without


network mask is just set of numbers.
10.10.10.10 /24
IP add is a 4Octate, 4byte, 32bit decimal address

10 . 10 . 10 . 10
IIIIIIII IIIIIIII IIIIIIII IIIIIIII
24115262
Area Code Subscriber No.

10 . 10 . 10 . 10 / 24
IIIIIIII IIIIIIII IIIIIIII IIIIIIII

Network Bits Host Bits


10 . 10 . 10 . 10 / 24
IIIIIIII IIIIIIII IIIIIII IIIIIIII

N/W Bits

Network add – 10 . 10 . 10 . 0 / 24

Host add – 10 . 10 . 10 . 10 / 24
210 . 10 . 10 . 10 / 8

What is N/W add?


What is Host add?
210 . 10 . 10 . 10 / 16

What is N/W add?


What is Host add?
110 . 10 . 10 . 10 / 8

What is N/W add?


What is Host add?
Decimal to binary conversion

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

IIIIIIII IIIIIIII IIIIIIII 00000000


255 . 255 . 255 . 0 Net Mask
Class of address
0 . 0 . 0 . 0
255 . 255 . 255 . 255 Subnet Prefix Hosts Per
Mask Mask Subnet
24
CLASS A 1 – 126 255.0.0.0 /8 2
Public
IP ADD 16
Distribution CLASS B 128 – 191 255.255.0.0 /16 2
purpose
8
CLASS C 192 – 223 255.255.255.0 /24 2
Multicast 224 – 239 /1 - /32
purpose CLASS D
Research 240 – 255 /1 - /32
purpose
CLASS E
10.0.0.0 - 10.255.255.255
127 – Universal Loopback 172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
Subnetting
Design Rules
16.0.0.0 /8 16.10.0.1/16 US 16.30.0.1/16

16.20.0.1/16
16.10.0.2/16 16.30.0.2/16

16.20.0.2/16
BLR

• Sub-netting is nothing else but mask manipulation ( It is game of mask)


• Two directly connected communicating devices should be in same subnet
• Two ports of router should be in different subnets
Bits to mask

128 192 224 240 248 252 254 255


I + I + I + I + I + I+ I+ I
128 64 32 16 8 4 2 1
24bits on network side
8bits on host side
28 = 256 hosts
16 . 20 . 20 . 0 / 24
BKC IIIIIIII
16 . 20 . 20 . 0
16 . 20 . 20 . 255
12 30
Host IP Host IP
Andheri
Vashi

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)

• Classless address : is address with any other


mask but not default mask
– 10.10.10.0/24 (10.10.10.0 255.255.255.0)
Requirement of (2+2=4 hosts) over
serial links
16 . 20 . 20 . 0 / 24
BKC
16.20.20.1/27 16.20.20.97/27

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

Requirement : - I need 4 networks

Q1) what is the first Valid host address

Q2) What is the 2nd last broadcast address


GIVEN: 16 . 20 . 20 . 0 /24

Requirement : - I need 6 host add per subnet

Q1) what is the first Valid host address

Q2) What is the 2nd last broadcast address


GIVEN: 16 . 20 . 0 . 0 /16

Requirement : - I need 1000 host add per subnet

Q1) what is the first Valid host address

Q2) What is the 2nd last broadcast address


Supernetting
For E2E IP communication every router should have route
to reach all networks 10.0.0.0 /24
If every router have routes to reach all Networks then issues are: 10.0.1.0 /24 R1
a) Huge routing table.
10.0.2.0 /24
b) Frequent updates
Huge routing table has 3 issues 10.0.3.0 /24
1) High Memory / processor Utilisation 10.0.4.0 /24
2) Ease of management is lost 10.0.5.0 /24 R2
3) Packet Forwarding Delay BKC 10.0.6.0 /24
Frequent Updates
1) High bandwidth Utilisation 10.0.7.0 /24
2) High Processor/memory Utilisation
R1
3) Performance deterioration R2
Andheri Panvel
Supernetting
Rules of summarisation
1) Only 2 or its powers can be summarised 10.0.0.0 /24
i.e. 21,22,23,2n 10.0.1.0 /24
2) Only addresses in sequence can be summarised R1
3) To summarise 2 address 1st address should be in 2s table 10.0.2.0 /24
To summarise 4 address 1st address should be in 4s table 10.0.3.0 /24
10.0.4.0 /24
Summarisation 10.0.5.0 /24 R2
Superneting
Aggregation 10.0.6.0 /24
Range 10.0.7.0 /24
CIDR BKC

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.

You might also like