The Wayback Machine - https://web.archive.org/web/20240910051023/https://www.geeksforgeeks.org/ip-security-ipsec/
Open In App

IP security (IPSec)

Last Updated : 29 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

IP Sec (Internet Protocol Security) is an Internet Engineering Task Force (IETF) standard suite of protocols between two communication points across the IP network that provide data authentication, integrity, and confidentiality. It also defines the encrypted, decrypted, and authenticated packets. The protocols needed for secure key exchange and key management are defined in it.

What is IP Security?

IPSec refers to a collection of communication rules or protocols used to establish secure network connections. Internet Protocol (IP) is the common standard that controls how data is transmitted across the internet. IPSec enhances the protocol’s security by introducing encryption and authentication. For example, it encrypts data at the source and then decrypts it at the destination. It also verifies the source of the data.

IPSec Connection Establishment Process

IPSec is a protocol suite used in securing communication using the Internet Protocol such that each packet communicated in the course of a particular session is authenticated and encrypted. The process of establishing an IPSec connection involves two main phases:

Phase 1: Establishing the IKE (Internet Key Exchange) Tunnel

In phase 1, the main aim is to establish the secure channel the IKE tunnel, which is used to further negotiations. Phase 1 can operate in one of two modes: The two are Main mode or Aggressive mode.

1. Main Mode

Overview: Main Mode is a six-message exchange procedure that is more secure than Basic Mode, although at the cost of a longer session, since identity information is transmitted during negotiations.

Message Exchange

  1. Message 1 & 2: Exchange of the proposed algorithms for encryption, hashing, authentication and other such parameters.
  2. Message 3 & 4: [The Diffie-Hellman key exchange. ] The parties produce master communication keys that are secret to the two of them.
  3. Message 5 & 6: Verification of the participants through pre shared keys or certificates or through some other means.
  4. Outcome: Is formed the IKE SA (Security Association), that contains the parameters that have been negotiated, as for example, encryption algorithms, generations of hashing, groups of Diffie-Hellman and the Lifetime.

2. Aggressive Mode

Overview: Aggressive Mode takes lesser time with the exchange of three messages and is less secure since more information like identity is disclosed during the course of negotiation.

Message Exchange:

  • Message 1: The initiator transmits, its offer, its Diffie-Hellman key information and identity payload.
  • Message 2: The responder replies with its own Diffie-Hellman information as well as an identity payload.
  • Message 3: Sends authentication information, which is done by the initiator.
  • Outcome: Like Main Mode, an IKE SA is created but it is done in a quicker way and it is less secure.

Key Parameters in Phase 1

  • Lifetime: Specifies how long the IKE SA shall remain valid before the IKE SA needs to be re negotiated.
  • Diffie-Hellman Groups: Employed to define the intense of the key exchange process. These include the Group 2 with 1024-bit, the Group 5 with 1536-bit and others that offer higher bit lengths of security.

Phase 2: Establishing the IPSec Tunnel

Phase 2 is called Quick Mode and its aim is to negotiate the IPSec Security Associations after the construction of a secure IKE tunnel has been made.

1. Modes in Phase 2

Tunnel Mode

Overview: This mode encapsulates the whole of the original IP packet including the header and data. It is mostly deployed in the site to site VPNs.

How It Works: A new IP header is inserted and the whole of the previous packet of the header along with the payload is encrypted.

Transport Mode

  • Overview: By this mode, only the actual data to be transmitted is encrypted and the header part of the IP packets remain unaltered. It is mainly employed in end to end communication between hosts.
  • How It Works: Only the payload is encrypted and IP header of the original packet remains intact even when security services are applied.

2. Interactions in This Phase

  • Message 1: The initiator sends offered IPSec parameters such as encryption, hash etc salient to IPSec with dependence on the IKE SA achieved.
  • Message 2: The responder is in a position to concur or suggest a few changes on that particular post.
  • Outcome: Security Association (SA) is created and then the secured communication starts.

Additional Parameters in Phase 2

  • Lifetime: Like in the Phase 1, the IPSec SA has a limited amount of time before re-negotiation would be necessary.
  • Perfect Forward Secrecy (PFS): Not mandatory but boosts on security since even if the attacker gets hold of a key he cannot be able to decrypt later sessions.

Uses of IP Security

IPsec can be used to do the following things:

  • To encrypt application layer data.
  • To provide security for routers sending routing data across the public internet.
  • To provide authentication without encryption, like to authenticate that the data originates from a known sender.
  • To protect network data by setting up circuits using IPsec tunneling in which all data being sent between the two endpoints is encrypted, as with a Virtual Private Network(VPN) connection.

What is IPSec Encyrption?

IPSec encryption is a software function that encrypts data to protect it from unauthorized access. An encryption key encrypts data, which must be decrypted. IPSec supports a variety of encryption algorithms, including AES, Blowfish, Triple DES, ChaCha, and DES-CBC. IPSec combines asymmetric and symmetric encryption to provide both speed and security during data transmission. In asymmetric encryption, the encryption key is made public, while the decryption key remains private. Symmetric encryption employs the same public key to encrypt and decrypts data. IPSec builds a secure connection using asymmetric encryption and then switches to symmetric encryption to speed up data transmission.

Components of IP Security

It has the following components:

  • Encapsulating Security Payload (ESP)
  • Authentication Header (AH)
  • Internet Key Exchange (IKE)

1. Encapsulating Security Payload (ESP): It provides data integrity, encryption, authentication, and anti-replay. It also provides authentication for payload.

2. Authentication Header (AH): It also provides data integrity, authentication, and anti-replay and it does not provide encryption. The anti-replay protection protects against the unauthorized transmission of packets. It does not protect data confidentiality.

IP Header

IP Header

3. Internet Key Exchange (IKE): It is a network security protocol designed to dynamically exchange encryption keys and find a way over Security Association (SA) between 2 devices. The Security Association (SA) establishes shared security attributes between 2 network entities to support secure communication. The Key Management Protocol (ISAKMP) and Internet Security Association provides a framework for authentication and key exchange. ISAKMP tells how the setup of the Security Associations (SAs) and how direct connections between two hosts are using IPsec. Internet Key Exchange (IKE) provides message content protection and also an open frame for implementing standard algorithms such as SHA and MD5. The algorithm’s IP sec users produce a unique identifier for each packet. This identifier then allows a device to determine whether a packet has been correct or not. Packets that are not authorized are discarded and not given to the receiver. 

Packet in Internet Protocol

Packets in Internet Protocol

IP Security Architecture

IPSec (IP Security) architecture uses two protocols to secure the traffic or data flow. These protocols are ESP (Encapsulation Security Payload) and AH (Authentication Header). IPSec Architecture includes protocols, algorithms, DOI, and Key Management. All these components are very important in order to provide the three main services:

  • Confidentiality
  • Authenticity
  • Integrity
IP Security Architecture

IP Security Architecture

Working on IP Security

  • The host checks if the packet should be transmitted using IPsec or not. This packet traffic triggers the security policy for itself. This is done when the system sending the packet applies appropriate encryption. The incoming packets are also checked by the host that they are encrypted properly or not.
  • Then IKE Phase 1 starts in which the 2 hosts( using IPsec ) authenticate themselves to each other to start a secure channel. It has 2 modes. The Main mode provides greater security and the Aggressive mode which enables the host to establish an IPsec circuit more quickly.
  • The channel created in the last step is then used to securely negotiate the way the IP circuit will encrypt data across the IP circuit.
  • Now, the IKE Phase 2 is conducted over the secure channel in which the two hosts negotiate the type of cryptographic algorithms to use on the session and agree on secret keying material to be used with those algorithms.
  • Then the data is exchanged across the newly created IPsec encrypted tunnel. These packets are encrypted and decrypted by the hosts using IPsec SAs.
  • When the communication between the hosts is completed or the session times out then the IPsec tunnel is terminated by discarding the keys by both hosts.

What are IPSec modes?

  • Tunnel: The IPSec tunnel mode is appropriate for sending data over public networks because it improves data security against unauthorised parties. The computer encrypts all data, including the payload and header, and adds a new header to it.
  • Transport: IPSec transport mode encrypts only the data packet’s payload while leaving the IP header unchanged. The unencrypted packet header enables routers to determine the destination address of each data packet. As a result, IPSec transport is utilized in a closed and trusted network, such as to secure a direct link between two computers.

Features of IPSec

  • Authentication: IPSec provides authentication of IP packets using digital signatures or shared secrets. This helps ensure that the packets are not tampered with or forged.
  • Confidentiality: IPSec provides confidentiality by encrypting IP packets, preventing eavesdropping on the network traffic.
  • Integrity: IPSec provides integrity by ensuring that IP packets have not been modified or corrupted during transmission.
  • Key management: IPSec provides key management services, including key exchange and key revocation, to ensure that cryptographic keys are securely managed.
  • Tunneling: IPSec supports tunneling, allowing IP packets to be encapsulated within another protocol, such as GRE (Generic Routing Encapsulation) or L2TP (Layer 2 Tunneling Protocol).
  • Flexibility: IPSec can be configured to provide security for a wide range of network topologies, including point-to-point, site-to-site, and remote access connections.
  • Interoperability: IPSec is an open standard protocol, which means that it is supported by a wide range of vendors and can be used in heterogeneous environments.

What is IPSec VPN?

VPN, or virtual private network, is a networking software that enables users to browse the internet anonymously and securely. An IPSec VPN is a type of VPN software that uses the IPSec protocol to establish encrypted tunnels over the internet. It offers end-to-end encryption, which means that data is broken down at the computer and then collected at the receiving server.

Advantages of IPSec

  • Strong security: IPSec provides strong cryptographic security services that help protect sensitive data and ensure network privacy and integrity.
  • Wide compatibility: IPSec is an open standard protocol that is widely supported by vendors and can be used in heterogeneous environments.
  • Flexibility: IPSec can be configured to provide security for a wide range of network topologies, including point-to-point, site-to-site, and remote access connections.
  • Scalability: IPSec can be used to secure large-scale networks and can be scaled up or down as needed.
  • Improved network performance: IPSec can help improve network performance by reducing network congestion and improving network efficiency.

Disadvantages of IPSec

  • Configuration Complexity: IPSec can be complex to configure and requires specialized knowledge and skills.
  • Compatibility Issues: IPSec can have compatibility issues with some network devices and applications, which can lead to interoperability problems.
  • Performance Impact: IPSec can impact network performance due to the overhead of encryption and decryption of IP packets.
  • Key Management: IPSec requires effective key management to ensure the security of the cryptographic keys used for encryption and authentication.
  • Limited Protection: IPSec only provides protection for IP traffic, and other protocols such as ICMP, DNS, and routing protocols may still be vulnerable to attacks.

Conclusion

IPSec (Internet Protocol Security) is an essential set of protocols that ensures secure IP communications via data authentication, integrity, and confidentiality. It works with both IPv4 and IPv6, encrypting data at the source and decrypting it at the destination. IPSec, which is widely used to secure application data, routing information, and VPN connections, provides robust security, interoperability, and scalability. Despite its benefits, IPSec can be difficult to configure and may have an impact on network performance. Understanding the IPSec components and encryption methods is critical for efficiently protecting network connections.

Frequently Asked Questions on IPSec – FAQs

What port does IPsec use?

IPsec usually uses port 500.

Is IPsec TCP or UDP?

IPSec is UDP.

Is IPSec IPv4 or IPv6?

IPSec is compatible with both IPv4 and IPv6.

What layer is IPSec?

IPsec is a layer 3 OSI model that provides end-to-end security at the internet layer.



Previous Article
Next Article

Similar Reads

IPsec (Internet Protocol Security) Tunnel and Transport Modes
IPsec (Internet Protocol Security) is an important generation for shielding statistics transmitted over IP networks. IPsec (Internet Protocol Security) is a set of protocols and methods used to steady communications over IP networks along with the Internet. It gives a sturdy framework for ensuring the confidentiality, integrity, and authenticity of
5 min read
IPSec Architecture
IPSec (IP Security) architecture uses two protocols to secure the traffic or data flow. These protocols are ESP (Encapsulation Security Payload) and AH (Authentication Header). IPSec Architecture includes protocols, algorithms, DOI, and Key Management. All these components are very important in order to provide the three main services: Confidential
2 min read
Difference between IPSec and SSL
IPSec Protocol is an Internet Engineering Task Force standard suite of protocols between two communication points. It can also be defined as encrypted, decrypted, and authenticated packets. It generally uses cryptographic security services to protect communications. It can be seen that network-level peer and data origin authentication, data integri
2 min read
What is an IPsec Tunnel?
IPsec might be a gaggle of protocols that square measure used along to line up encrypted connections between devices. It helps keep knowledge sent over public networks securely. IPsec is typically accustomed-based VPNs, and it works by encrypting scientific discipline packets, at the side of authenticating the supply wherever the packets return fro
5 min read
IPsec Protocols
IPsec (Internet Protocol Security) is a large set of protocols and algorithms. IPsec is majorly used for securing data transmitted all over the internet. The Internet Engineering Task Force, or IETF, which was solely developed the IPsec protocols for the purpose of providing security at the IP layer through authentication and encryption of IP netwo
5 min read
Name a Major Drawback of IPSec?
Answer: A major drawback of IPSec is its complexity in configuration and management.IPSec (Internet Protocol Security) is a protocol suite for securing Internet Protocol (IP) communications by authenticating and encrypting each IP packet in a data stream. However, it comes with its challenges Complex ConfigurationIPSec's secure nature requires deta
1 min read
Which Ports on Firewall Should be Allowed for IPSEC Site to Site VPN?
Answer: For IPSEC Site-to-Site VPN, allow ports UDP 500 IKE, UDP 4500 NAT-Traversal, and protocols ESP IP Protocol 50 and AH IP Protocol 51 on the firewall.For IPSEC Site-to-Site VPN to function correctly through a firewall, certain ports and protocols must be permitted to ensure secure and reliable communication between the VPN endpoints. Here’s a
1 min read
IPSec Full Form
IPSec stands for Internet Protocol Security. It is a suite of protocols between two communication points across the IP network that provides data authentication, integrity, and confidentiality. It was developed by the Internet Engineering Task Force(IETF) in 1995. It defines the architecture for security services for IP network traffic. It provides
3 min read
How Security System Should Evolve to Handle Cyber Security Threats and Vulnerabilities?
Stories of organizations paralyzed by cybersecurity threats and vulnerabilities are at their peak. According to a report published by Symantec Corp, India is one of the top five countries that have become the victim of cyber crime. Nowadays, modern technologies such as cloud computing, IoT, cognitive computing, etc. are categorized as the critical
8 min read
Difference Between Security Engineer and Security Architect
Security engineers are mainly engineers who occupy a special(technical) role in an organization. The major role of a security engineer is to protect any sensitive information which is a vital part of that company from any theft or hack, by implementing and monitoring the computer and network security protocols. Nowadays, technology is far the most
5 min read
Cybersecurity vs Network Security vs Information Security
The security of a computer network is a crucial task. It is a process of ensuring confidentiality and integrity. A system is said to be secure if its resources are used and accessed as intended under all the circumstances, but no system can guarantee absolute security from several of various malicious threats and unauthorized access. In this articl
3 min read
What is Mobile Security in Cyber Security?
Mobile device security is important to keep our smartphones, tablets, and other portable devices safe from cyber criminals and hackers. The main goal of mobile device security is to keep our devices and other electronic devices safe from being hacked or other illegal activities. In our daily lives, it is very crucial to protect our private informat
9 min read
Difference Between Cyber Security and Information Security
Cyber security and information security are two ways to protect important information. Cyber security is about keeping computer systems and networks safe from bad people who try to break in or cause harm online. It deals with things like stopping hackers, fixing computer problems, and making sure websites work properly. Information security, on the
7 min read
Difference between Network Security and Cyber Security
In today’s global village the terms ‘Network Security’ and ‘Cyber Security’ are actually two sides of the same coin but they are different in some ways. It is important to note that although necessary for the security of information, both concepts are unique and perform different functions in the sphere of digital protection. Knowing the distinctio
5 min read
Difference between Information Security and Network Security
Security of the data and safe networks in the world which connects digitally is the most important step in today’s world for everyone. Hence, it is crucial to pinpoint differences between the various aspects of security due to the constant developments of cyber threats. Two major concepts are often mentioned in this regard and they are Information
7 min read
Difference between Software Security and Cyber Security
Software security and cybersecurity are two important ways to keep computers and digital systems safe. While they might sound similar, they focus on different things. Software security is all about making sure the programs we use on computers are safe and can't be easily hacked. It looks at how the software is made and tries to fix any weak spots.
7 min read
Difference between Application Security and Network Security
The two important and overlapping areas of cybersecurity are application security and network security which aims at securing data and other systematic structures. Even though both are entities with a strong focus on security they are not the same thing and address different aspects of it. Application security is the procedure of protecting softwar
6 min read
Hash Functions in System Security
Hash Function is a function that has a huge role in making a System Secure as it converts normal data given to it as an irregular value of fixed length. We can imagine it to be a Shaker in our homes. When we put data into this function it outputs an irregular value. The Irregular value it outputs is known as "Hash Value".Hash Values are simply numb
4 min read
Port Security in Computer Network
Attackers' task is comparatively very easy when they can enter the network they want to attack. Ethernet LANs are very much vulnerable to attack as the switch ports are open to use by default. Various attacks such as Dos attack at layer 2, address spoofing can take place. If the administrator has control over the network then obviously the network
3 min read
Risk Management for Information Security | Set-1
Prerequisite - Threat Modelling A risk is nothing but intersection of assets, threats and vulnerability. A+T+V = R NIST SP 800-30 Risk Management Guide for Information Technology Practitioners defines risk as a function of the likelihood of a given threat-source exercising a particular potential vulnerability, and the resulting impact of that adver
2 min read
Risk Management for Information Security | Set-2
Prerequisite - Risk Management | Set-1 2. Risk Assessment - Risk Management is a recurrent activity, on the other hand Risk assessment is executed at discrete points and until the performance of the next assessment. Risk Assessment is the process of evaluating known and postulated threats and vulnerabilities to determine expected loss. It also incl
7 min read
Basic configuration of Adaptive Security Appliance (ASA)
Prerequisite - Adaptive security appliance (ASA) Adaptive Security Appliance (ASA) is a Cisco security appliance that combines classic firewall features with VPN, Intrusion Prevention, and antivirus capabilities. It has the capability to provide threat defense before the attacks spread into the networks. As an administrator, we have to ensure prote
5 min read
TELNET and SSH on Adaptive Security Appliance (ASA)
Prerequisite - Adaptive security appliance (ASA) A user can take management access of a device through a console or remote access by using telnet or SSH. In the same way, ASA (Adaptive Security Appliance) CLI access can take through a console or by using Telnet or SSH and GUI access can be taken through (ASDM-a tool). 1. Telnet on ASA: Telnet is an
7 min read
Privacy and Security in online social media
Social media is not a new term for us. Our daily life is incomplete, or we can say we human beings survive on food, water, air and social media. We are dependent to such an extent that we tend to share every bit of information about us on social platform. But stop for a minute and think, Are we really secure? Do we have any Privacy? No, we are livi
7 min read
Difference Between Zombie and Logic Bomb in Cyber Security
Any malicious software intended to damage or exploit any device, service, or network is mentioned as malware. malware is short for malicious software and mentions any software that is designed to cause harm to computers, networks, or users. Zombies and Logic Bomb are kinds of malware. Malware includes computer viruses, Zombies, Logic bombs, worms,
6 min read
Port Address Translation (PAT) on Adaptive Security Appliance (ASA)
Port Address Translation (PAT) is a type of Network address translation (NAT) used when there is a shortage of public IP addresses .One of the public IP address of the same subnet or the interface address is used for translation. Port Address Translation (PAT): This is also known as NAT overload. In this, many local (private) IP addresses get trans
5 min read
E-commerce and Security Threats to E-commerce
The E-Commerce website contains confidential information provided by customers, such as their password, contact details, and credit card details but. when concentrating on commercial deals among organizations and individuals demanding a selective information system under the guarantee of the firm, it accepts the form of e-business. E-commerce is br
3 min read
Digital Forensics in Information Security
Digital Forensics is a branch of forensic science which includes the identification, collection, analysis and reporting any valuable digital information in the digital devices related to the computer crimes, as a part of the investigation. In simple words, Digital Forensics is the process of identifying, preserving, analyzing and presenting digital
2 min read
Difference between Antivirus and Internet Security
Antivirus: Antivirus is an application or software which provides security from the malicious software coming from the internet. An antivirus chases the method in which it performs 3 actions which are: 1. Detection 2. Identification 3. Removal Antivirus deals with both external threats and internal threats. It is implemented only in software not in
3 min read
Need Of Information Security
Information system means to consider available countermeasures or controls stimulated through uncovered vulnerabilities and identify an area where more work is needed. The purpose of data security management is to make sure business continuity and scale back business injury by preventing and minimizing the impact of security incidents. The basic pr
9 min read
Article Tags :