Port 4500 (IPsec NAT-T)

Port 4500 is the port of IPsec NAT Traversal (NAT-T), which lets an IPsec connection pass through routers that perform NAT, over UDP.

Key facts

Port
4500
Protocols
UDP
Range
Registered port, 1024-49151
IANA service name
ipsec-nat-t

IANA assigns ports in this range to services on request, under RFC 6335.

About port 4500

Port 4500 is the port of IPsec NAT Traversal (NAT-T), which lets an IPsec connection pass through routers that perform NAT, over UDP. The connection starts on port 500, and when both sides detect NAT along the way, they move to port 4500.

RFC 3948 defines wrapping the encrypted data (ESP) in UDP, and RFC 7296 defines the IKEv2 move to port 4500. In the IANA port registry, port 4500 is registered for the ipsec-nat-t service, over both UDP and TCP. The TCP registration is for carrying the connection over TCP under RFC 9329, on networks that block UDP.

What port 4500 is used for

  • Employees working from home: a computer connected through a home router gets a private address, so the VPN connection runs on port 4500.
  • Servers behind NAT: servers and routers with a private address connect a tunnel to another site through port 4500.
  • Cellular networks: phones usually get a private address, and their built-in IKEv2 client moves to port 4500.

Port 4500 carries both IKE messages and the encrypted data. To tell them apart, IKE messages start with four zero bytes.

Port 4500 in the firewall

On an IPsec server, open port 4500 together with port 500, over UDP. In firewalld, the ipsec service covers both ports and the ESP protocol:

  • firewalld: firewall-cmd --permanent --add-service=ipsec
  • UFW: ufw allow 4500/udp and also ufw allow 500/udp. ESP is allowed with the full syntax, for example ufw allow from 198.51.100.20 to any proto esp

Even when the server itself isn't behind NAT, keep port 4500 open, because many clients connect from behind a router.

Risks and security

Port 4500 carries the same IPsec connection, so its protection is the same as for port 500:

  • Use IKEv2, with certificates or a long, random pre-shared key.
  • Configure only current encryption algorithms.
  • In a site-to-site connection, allow ports 500 and 4500 only from the other side's address.
  • Revoke access for users who no longer need a VPN connection.

Commands to check and configure

  • ss -ulnp | grep ':4500 '

    Checks whether an IPsec service is listening on port 4500.

  • swanctl --list-sas

    Shows the active connections in strongSwan. For a connection that passed through NAT, the details show the address with port 4500.

  • tcpdump -ni any udp port 4500

    Shows the traffic on port 4500, to check that the connection and the data reach the server (requires root).

  • firewall-cmd --permanent --add-service=ipsec

    Opens ports 500 and 4500 and allows the ESP protocol in firewalld. Then run firewall-cmd --reload.

  • ufw allow 4500/udp

    Opens UDP port 4500 to incoming traffic (UFW).

  • ufw allow from 198.51.100.20 to any port 4500 proto udp

    Allows port 4500 only from the address of the other side in a site-to-site connection (UFW).

Port 4500 in the IANA registry

Port Protocol Service IANA registry description
4500 TCP ipsec-nat-t IPsec NAT-Traversal
4500 UDP ipsec-nat-t IPsec NAT-Traversal

Data source: IANA Service Name and Transport Protocol Port Number Registry (opens in a new tab)

Port 4500 FAQ

Why does IPsec move to port 4500?

A router that performs NAT changes addresses and ports, but the ESP protocol has no ports, so many routers don't pass it through properly. That's why, when both sides detect NAT along the way, they wrap the data in UDP and send it on port 4500, which the router knows how to pass through.

Do I need to open port 4500 even when there's no NAT?

Yes, we recommend keeping it open. Even when the server has a public address, many clients connect from behind a home router or over a cellular network, and their connection runs on port 4500.

Why does the IPsec connection come up but no traffic passes through it?

One of the common reasons is that port 4500 or the ESP protocol is blocked in the firewall, while port 500 is open. Check the firewall on both sides to make sure UDP port 4500 is open and the ESP protocol is allowed, and then check the settings of the networks that pass through the tunnel.

What is NAT?

NAT is a mechanism in which a router translates the private addresses of computers on the network to a single public address. That way, all the devices at home or in the office go out to the internet through the same address. The reserved IP ranges page lists the private address ranges.

Shopping cart

Your cart is emptyYou can start with one of our popular plans.

Site search

Accessibility

Text size
100%
Accessibility statement