11 IPSec Part1
11 IPSec Part1
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 1 / 24
Internet Security Protocol (IPSec)
(Part 1)
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 2 / 24
IPSec
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 3 / 24
IPSec
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 4 / 24
The Internet Protocol Version 4 (IPv4)
IPv4 is the delivery mechanism used by the TCP/IP protocols.
IPv4 is an unreliable datagram protocol - a “best-effort delivery”
service, that is, it provides no error control or flow control (except
for error detection on the header).
IPv4 is a connection-less protocol for packet-switching network
that uses the datagram approach.
Connectionless protocol: A connectionless protocol is a
communication method that sends data packets without
establishing a connection between devices. It’s similar to sending
an unregistered letter in the post-office, where the recipient might
not be notified if the letter doesn’t arrive.
Connection-oriented protocol: A connection-oriented protocol is
a communication protocol that establishes a connection between
two devices before data is exchanged. This connection is
maintained for the duration of the communication.
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 5 / 24
Datagram in IPv4
Packets in the IPv4 layer called datagrams.
20−65,536 bytes
20−60 bytes
Header Data
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 6 / 24
Datagram in IPv4
Datagram is a variable-length packet consisting of two parts: 1)
header and 2) data.
The header is 20 to 60 bytes in length and contains information
essential to routing and delivery.
Brief description of IP header fields:
I Version (VER): Defines the version of IP protocol. Currently the
version is 4. However, version 6 (or IPng) may totally replace
version 4 in the future.
I Header length (HLEN): Defines the length of the datagram header
in 4-bytes words. When there are NO options, the header length is
20 bytes, and the value of this field is 5 (5 × 4 = 20). When the
option field is at its maximum size, the value of this field is 15
(15 × 4 = 60). Thus, 5 ≤ HLEN ≤ 15.
I Total length: This 16-bit field defines the total length of the IPv4
header. To find the length of the data coming from the upper layer,
we need the following calculation:
length of data = total length - header length, where header length =
HLEN ×5. Max. datagram size = 216 = 65, 536 bytes.
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 7 / 24
Datagram in IPv4
Brief description of IP header fields (continued...):
I Time to live (TTL): A datagram has a limited lifetime in its travel
through the Internet. This 8-bit field prevents a packet from traveling
a loop. The sender sets a value, that is decremented at each hop. If
it reaches zero, the packet is discarded.
I Protocol: This 8-bit field defines the higher-level protocol that uses
the services of the IPv4 layer.
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 8 / 24
Datagram in IPv4
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 9 / 24
Datagram in IPv4
Brief description of IP header fields (continued...):
I Options: The header of the IPv4 datagram is made of two parts: a
fixed part and a variable part. The fixed part is 20 bytes long. The
variable part comprises the options that can be a maximum of 40
bytes. The options are not required for a datagram. They can be
used for network testing and debugging purposes.
I Identification: This 16-bit field identifies a datagram originating
from the source host. The combination of the identification and
source IPv4 address must uniquely define a datagram as it leaves
the source host.
I Flag: This is a 3-bit field, in which the first bit is reversed, the
second bit is called the “do not fragment (D)” bit, and the third bit
the “more fragment (M)” bit.
F If D bit is 1, the machine must not fragment the datagram.
F If D bit is 0, the datagram can be fragmented if necessary.
F If M bit is 1, its meaning is that the datagram is NOT the last
fragment; there are more fragments after this one.
F If M bit is 0, it means that this is the last or only segment.
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 10 / 24
Different Modes
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 11 / 24
Transport mode
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 12 / 24
IPSec in transport mode
IPSec layer
IPSec−H IPSec−T
H: header T: tailer
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 13 / 24
Transport mode
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 14 / 24
Tunnel mode
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 15 / 24
IPSec in tunnel mode
IPSec layer
IPSec−H IPSec−T
new header
H: header T: tailer
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 16 / 24
Tunnel mode
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 17 / 24
Transport mode versus Tunnel mode
In transport mode, the IPSec layer comes between the transport
layer and the network layer.
In tunnel mode, the flow is from the network layer to the IPSec
layer and then back to the network layer again.
Network layer
IPSec layer
IPSec layer
Network layer
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 18 / 24
Two IPSec Security Protocols
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 19 / 24
Authentication Header (AH) Protocol
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 20 / 24
Authentication Header (AH) Protocol
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 21 / 24
Authentication Header (AH) Protocol
Sequence number
Figure: AH protocol
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 22 / 24
Fields for Authentication Header (AH) Protocol
Next header: The 8-bit next header field defines the type of
payload carried by the IP datagram (such as TCP, UDP or ICMP).
Payload length: This 8-bit field does not define the length of the
payload; it defines the length of the authentication header in
4-byte multiples, but it does not include the first 8-bytes.
Sequence number: A 32-bit sequence number provides ordering
information for a sequence of datagrams. The sequence numbers
prevent a playback/replay attack.
I The sequence number is not repeated even if a packet is
retransmitted.
I A sequence number does not wrap around after it reaches 232 ; a
new connection must be established.
Authentication data: The authentication data field is the result of
applying a hash function to the entire IP datagram except for the
fields that are changed during transmit (e.g., time-to-live (TTL)).
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 23 / 24
Steps in Authentication Header (AH) Protocol
Dr. Ashok Kumar Das (IIIT Hyderabad) System and Network Security 24 / 24