Port 500 (IPsec IKE)
Key facts
- Port
- 500
- Protocols
- UDP
- Range
- System port (Well-Known), 0-1023
- IANA service name
- isakmp
IANA assigns ports in this range to well-known services, under RFC 6335.
About port 500
Port 500 is the port of IKE (Internet Key Exchange), the protocol the two sides of an IPsec connection use to authenticate each other and agree on encryption keys, over UDP. The data itself travels separately, over the ESP protocol, and when there's NAT along the way, both IKE and the data move to port 4500.
IKEv2 is defined in RFC 7296, under which IKE sends and receives messages on UDP port 500. In the IANA port registry, port 500 is registered for the isakmp service.
What port 500 is used for
- Site-to-site connection: two offices, or an office and a server, are linked by a permanent encrypted tunnel between their routers or firewalls.
- Remote access: Windows, macOS, iOS, and Android have a built-in IKEv2 client that connects without installing any extra software.
- Network equipment: many routers and firewalls support IPsec, which is why it's common for connecting equipment from different vendors.
Port 500 in the firewall
For IPsec to work, open UDP port 500 and port 4500, and allow the ESP protocol. In firewalld, the ipsec service covers all of them:
- firewalld:
firewall-cmd --permanent --add-service=ipsec - UFW:
ufw allow 500/udpand alsoufw allow 4500/udp. ESP is allowed with the full syntax, for exampleufw allow from 198.51.100.20 to any proto esp
In a site-to-site connection, the other side's address is known, so we recommend allowing the ports only from it, for example ufw allow from 198.51.100.20 to any port 500 proto udp.
Risks and security
The strength of IPsec depends mainly on the authentication method and the algorithms you configure. A few settings make sure the connection is strong:
- Prefer IKEv2 over IKEv1, and in particular avoid IKEv1 Aggressive Mode, a shortened setup mode, when authentication uses a pre-shared key.
- Use certificates, or a long, random pre-shared key (PSK).
- Configure current encryption algorithms, and remove old algorithms from the list.
- In a site-to-site connection, allow the ports only from the other side's address.
Commands to check and configure
-
ss -ulnp | grep -E ':(500|4500) 'Checks whether an IPsec service is listening on ports 500 and 4500.
-
swanctl --list-sasShows the active connections and established tunnels in strongSwan.
-
ipsec trafficstatusShows the active tunnels in Libreswan and how much traffic has passed through them.
-
tcpdump -ni any udp port 500 or udp port 4500Shows the IKE messages reaching and leaving the server (requires root).
-
firewall-cmd --permanent --add-service=ipsecOpens ports 500 and 4500 and allows the ESP protocol in firewalld. Then run firewall-cmd --reload.
-
ufw allow from 198.51.100.20 to any port 500 proto udpAllows port 500 only from the address of the other side of the connection (UFW).
Port 500 in the IANA registry
| Port | Protocol | Service | IANA registry description |
|---|---|---|---|
| 500 | TCP | isakmp | isakmp |
| 500 | UDP | isakmp | isakmp |
Data source: IANA Service Name and Transport Protocol Port Number Registry (opens in a new tab)
Port 500 FAQ
What's the difference between port 500 and port 4500?
The connection starts on port 500. When both sides detect NAT between them, for example a home router, they move to port 4500, and from then on both the IKE messages and the encrypted data travel on it, wrapped in UDP.
Is opening port 500 enough for IPsec to work?
No. You also need to open UDP port 4500 and allow the ESP protocol, which carries the data when there's no NAT along the way. When only port 500 is open, the connection may come up, but no data will get through it.
What's the difference between IKEv1 and IKEv2?
IKEv2 is simpler and faster at setting up the connection and supports NAT as part of the standard, and with a common extension, the connection keeps working even when the device moves between networks. For new connections, we recommend IKEv2, and keeping IKEv1 only for old equipment that doesn't support the newer version.
Can I connect to IPsec without installing software?
Yes. Windows, macOS, iOS, and Android have a built-in IKEv2 client. In the device's VPN settings, enter the server address and the authentication details, a certificate or a username and password, according to how the server is set up.