UDP port 51820 is the conventional port for WireGuard VPN tunnels. It is a convention from the documentation, not a fixed requirement. It is normally meant to be reachable from the internet.
- Port
- 51820
- Protocol
- UDP
- Service
- WireGuard
- Expose to internet?
- Yes, usually
- Also used by
- wg-quick, Tailscale (when direct), RouterOS 7, OPNsense/pfSense
Is port 51820 safe to open?
WireGuard silently drops any packet that is not from a configured peer key, so a scanner cannot even tell the port is open. That makes it one of the safest services to expose. The main risks are leaked private keys and overly broad AllowedIPs giving peers more access than intended.
How to secure WireGuard
- Keep private keys readable only by root (mode 600).
- Give each peer narrow
AllowedIPsand remove peers that no longer need access. - Use a preshared key per peer for extra protection (
PresharedKey).
Check if port 51820 is open
Linux: what is listening on this port
sudo ss -ulpn | grep ':51820 'Windows (PowerShell): what is listening
Get-NetUDPEndpoint -LocalPort 51820From another machine: is it reachable
sudo nmap -sU -p 51820 HOSTTest the WireGuard service itself
sudo wg showOpen port 51820 in the firewall
ufw (Ubuntu, Debian)
sudo ufw allow 51820/udpfirewalld (RHEL, Rocky, Alma, Fedora)
sudo firewall-cmd --permanent --add-port=51820/udp
sudo firewall-cmd --reloadWindows Firewall (PowerShell, as Administrator)
New-NetFirewallRule -DisplayName "Allow 51820/UDP" -Direction Inbound -Protocol UDP -LocalPort 51820 -Action AllowMonitor port 51820
Add a TCP port monitor for 51820 and Statance connects to it from up to six regions, alerting you by email, Slack, Discord or PagerDuty when WireGuard stops answering. TCP port monitoring.
Related ports
FAQ
Do I need to open port 51820 for WireGuard?
Only on the side that accepts incoming connections (the server). Allow UDP 51820, or whatever ListenPort you set, in the firewall and forward it on your router if the server is behind NAT.
What is port 51820 used for?
UDP port 51820 is the conventional port for WireGuard VPN tunnels. It is a convention from the documentation, not a fixed requirement. It is also used by wg-quick, Tailscale (when direct), RouterOS 7, OPNsense/pfSense.
Is port 51820 TCP or UDP?
WireGuard uses UDP on port 51820.
How do I check if port 51820 is open?
On the server, run sudo ss -tulpn | grep ':51820 ' (Linux) or Get-NetTCPConnection -LocalPort 51820 (Windows) to see what is listening. From another machine, run nc -zv HOST 51820 or Test-NetConnection HOST -Port 51820.
Know the moment a port stops answering.
TCP, HTTP, DNS and SSL checks from six regions, plus server metrics from a one-line agent.