HTTPfy

Port 4222 (NATS)

NATS client connections; 6222 is cluster routing and 8222 the HTTP monitoring port.

Registered (user) port, 1024-49151 TCP Message queues Do not expose to the internet

What port 4222 is used for

NATS client connections; 6222 is cluster routing and 8222 the HTTP monitoring port.

Security: should port 4222 be open?

Do not expose to the internet. Configure authentication (tokens, NKeys or JWT) and TLS before allowing any external client.

IANA assignment

Port 4222 is in the registered range and has no IANA assignment. The usage above is unofficial but widespread.

Check what is listening on port 4222

Linux: is anything listening on TCP 4222?
sudo ss -tlnp 'sport = :4222'
Linux / macOS: which process owns the port
sudo lsof -nP -i :4222
Older Linux / BSD (net-tools)
sudo netstat -tlnp | grep ':4222 '
Windows (Command Prompt)
netstat -ano | findstr :4222
Windows (PowerShell)
Get-NetTCPConnection -LocalPort 4222 -State Listen | Select LocalAddress,OwningProcess

Test it from outside

From another machine
nc -vz -w 5 HOST 4222
From Windows
Test-NetConnection HOST -Port 4222

Block port 4222 in the firewall

ufw
sudo ufw deny 4222/tcp
iptables
sudo iptables -A INPUT -p tcp --dport 4222 -j DROP
nftables
sudo nft add rule inet filter input tcp dport 4222 drop
Windows Firewall
New-NetFirewallRule -DisplayName 'Block TCP 4222' -Direction Inbound -Protocol TCP -LocalPort 4222 -Action Block

Related ports

All port numbers · Open port checker
Assignment data: IANA port number registry (public domain), retrieved 2026-11-10.