I have decided to post this question even though there are a lot of similar questions, but none of them answered mine.
- I periodically check the ports my server listens to.
- My ubuntu OS by the output of
lsb_relase -a
:
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
- I run the command
netstat -tulpn4
and the output shows an unknown port:
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 580/systemd-resolve
tcp 0 0 0.0.0.0:62176 0.0.0.0:* LISTEN 900/sshd: /usr/sbin
tcp 0 0 0.0.0.0:1122 0.0.0.0:* LISTEN 1158/sshd: username
tcp 0 0 0.0.0.0:3333 0.0.0.0:* LISTEN 1158/sshd: username
udp 0 0 0.0.0.0:51820 0.0.0.0:* -
udp 0 0 127.0.0.53:53 0.0.0.0:* 580/systemd-resolve
udp 0 0 X.X.X.X:1194 0.0.0.0:* 870/openvpn
- I have used many tools and guides to find out why my server is listening on port
51820
without finding an answer. - I have tried:
sudo lsof -i :51820
– and got an empty output.sudo netstat -ltnp | grep -w ':51820'
– and got an empty output.sudo fuser 51820/udp
– and got an empty output.sudo netstat -peanut | grep ":51820"
– the output is:
udp 0 0 0.0.0.0:51820 0.0.0.0:* 0 26262 -
udp6 0 0 :::51820 :::* 0 26263 -
sudo ss -nlp | grep 51820
the output is:
udp UNCONN 0 0 0.0.0.0:51820 0.0.0.0:*
udp UNCONN 0 0 [::]:51820 [::]:*
- I have looked at the following answers and did not find a solution:
After searching the web about port 51820
I found out it is the "wireguard" I have installed that`s listening on that port, but the question remains the same as in any command I have tried I could not find that out.
Best Answer
You're running operating system that implements Wireguard as a kernel module. Your kernel is listening on this port, and since there's no process owning that socket no PID is reported by
netstat
.