NewIP VPN Notes
VPN

IPsec Port: Which Ports and Protocols Does IPsec Use?

By Priya Castellanos · · 6 min
IPsec Port: Which Ports and Protocols Does IPsec Use?

Learn which ports IPsec uses, how IKE and NAT traversal work, and what to allow through a firewall.

If you are looking for the IPsec port, the key details are UDP port 500 for IKE, UDP port 4500 for NAT traversal, and ESP (IP protocol 50) for encrypted data. IPsec does not have a single port number because it uses both UDP ports and separate IP protocols. Which traffic you must allow depends on the VPN setup, whether a NAT device is in the path, and whether the firewall supports IP protocols beyond TCP and UDP.

IPsec ports and protocols at a glance

Port or protocolTransportTypical roleNAT traversalFirewall handling
UDP 500UDPIKE negotiationUsed to establish negotiationAllow for IKE
UDP 4500UDPNAT traversal and encapsulated IPsecYesAllow for NAT-T
ESPIP protocol 50Carries protected dataEncapsulated in UDP 4500 when neededAllow ESP if not using NAT-T
AHIP protocol 51Authentication and integrityNot compatible with NAT traversalAllow AH if used
IKERuns over UDPNegotiates security associationsStarts on UDP 500Allow its UDP port
NAT-TRuns over UDP 4500Carries IPsec through NATYesAllow UDP 4500

Compiled November 2026; check the provider's site for current details.

IPsec ports and protocols at a glance

IPsec is a suite of protocols for protecting IP traffic. Internet Key Exchange (IKE) negotiates security settings and keys, while Encapsulating Security Payload (ESP) or Authentication Header (AH) handles protected traffic.

IPsec traffic Number What it does
IKE over UDP UDP 500 Starts and negotiates an IPsec connection
NAT traversal (NAT-T) UDP 4500 Carries IKE and, when needed, encapsulated ESP through NAT
ESP IP protocol 50 Protects and transports IPsec data
AH IP protocol 51 Provides authentication and integrity without encryption

The distinction matters: UDP 500 and UDP 4500 are port numbers, but ESP and AH are IP protocol numbers. They are not TCP or UDP ports. A firewall rule for “port 50” will not necessarily allow ESP. It must allow IP protocol 50.

IPsec Port: Which Ports and Protocols Does IPsec Use?: Checklist

What UDP 500 is used for

IKE usually begins over UDP port 500. The devices at each end use IKE to authenticate one another and agree on security parameters, such as encryption algorithms and keys. Once negotiation succeeds, IPsec can protect traffic between the VPN endpoints.

For many site-to-site and remote-access VPNs, allowing UDP 500 is necessary. However, allowing that port alone may not be enough: the endpoints also need a way to carry the protected data, typically ESP or ESP inside UDP 4500. VPN Country Changer Free: How to Change Your Virtual Location Safely

IKE versions and VPN products can vary in their exact behavior. Check the documentation for both endpoints before creating firewall rules, especially when connecting equipment from different vendors.

How UDP 500 and UDP 4500 differ

Comparison pointUDP 500UDP 4500
Main purposeIKE negotiationNAT traversal
Used at connection startYesWhen NAT traversal is needed
Carries IKE messagesYesYes, for NAT-T
Carries encapsulated ESPNoYes
Helps IPsec cross NATNoYes
Needed through firewallFor IKEFor NAT-T
Replaces ESP protocol 50NoEncapsulates ESP when needed

Compiled November 2026; check the provider's site for current details.

Why UDP 4500 is important

Network Address Translation (NAT) changes IP addresses and, in many cases, port information as traffic passes through a router or firewall. This can interfere with native ESP, which has no TCP or UDP port fields for a NAT device to translate. Free VPN for PC to Change Location: What to Know Before You Connect

NAT Traversal, commonly called NAT-T, addresses this by encapsulating IPsec traffic in UDP. When NAT is detected, IKE commonly moves to UDP 4500, and ESP data can be carried inside that UDP traffic. This makes IPsec connections more compatible with typical home, office, and cloud networks.

A VPN may use UDP 4500 even when the user does not manually configure a separate “NAT-T port.” Many clients and gateways negotiate this automatically. If the connection works on one network but fails behind another router, blocked UDP 4500 is one possible cause.

ESP, AH, and firewall rules

ESP is the most commonly used IPsec protocol for protecting data. It provides encryption and can also provide integrity and authentication. Native ESP uses IP protocol number 50, not port 50.

AH uses IP protocol number 51. It provides authentication and integrity but does not encrypt the traffic. Because AH includes information tied to the IP header, it can be difficult to use across NAT. As a result, many modern VPN deployments use ESP instead. Best Free VPN That Allows You to Change Location: What to Know

When setting firewall rules, consider the following:

  • Allow UDP 500 for IKE negotiation.
  • Allow UDP 4500 when NAT traversal is required or supported by the VPN.
  • Allow IP protocol 50 for native ESP if the VPN uses ESP without UDP encapsulation.
  • Allow IP protocol 51 only if the configuration specifically uses AH.
  • Apply rules to the correct source and destination addresses, interfaces, and directions.

Some firewalls only offer rules for TCP and UDP ports. If yours does not support IP protocol 50, native ESP may not pass through it. NAT-T may be the practical option, provided both VPN endpoints support it and UDP 4500 is allowed.

IPsec Port: Which Ports and Protocols Does IPsec Use?: Key points

Common IPsec port questions

Is IPsec TCP or UDP?

IPsec itself is not simply a TCP or UDP service. IKE commonly uses UDP, while ESP and AH are separate IP protocols. NAT-T wraps ESP in UDP so it can cross networks that handle UDP more easily.

Is port 500 TCP or UDP?

IKE uses UDP port 500 in common IPsec configurations. Do not assume that opening TCP port 500 will enable an IPsec VPN. VPN Change Country Free: How to Switch Your Virtual Location Safely

Is ESP port 50?

No. ESP is IP protocol 50, not a port. Port numbers are part of TCP or UDP; ESP is identified directly by its IP protocol number.

Which ports should I open for an IPsec VPN?

A common starting point is UDP 500 and UDP 4500, plus IP protocol 50 if the connection uses native ESP. The exact rules depend on the VPN implementation and whether NAT-T is active. Avoid opening AH or broad IPsec traffic unless the configuration requires it.

Firewall choices for IPsec traffic

Traffic to allowWhen to allow itWorks through NATCarries protected dataRecommendation
UDP 500IKE negotiation is usedNoNoAllow for IKE
UDP 4500NAT traversal is usedYesEncapsulated ESPAllow when NAT-T is needed
ESP (protocol 50)Native ESP is usedNoYesAllow if not using NAT-T
AH (protocol 51)AH is specifically usedNoYesAllow only when required
UDP 500 and UDP 4500NAT-T setup and traffic are neededYesESP over UDP 4500Common NAT-T rule set
ESP and AHThe relevant IPsec protocols are configuredNoYesPermit only protocols in use

Compiled November 2026; check the provider's site for current details. F5_vpn_edge client.exe: What It Is and How to Handle It

Recommendation

For most IPsec deployments, start by checking the VPN vendor’s requirements and allow UDP 500 and UDP 4500 between the intended VPN endpoints. Add IP protocol 50 when native ESP is needed, and IP protocol 51 only for a deliberate AH configuration. Test the connection from behind the actual firewalls and NAT devices in use, then keep the rules limited to the necessary hosts and traffic.

© 2026 Northlight Network Notes · Northlight Network Notes LLC