How to enable a specific port on Ubuntu version 22 so that it is accessible to outside world?
I am already logged into the server through ssh using port 22 and able to successfully execute all the commands.
I have enabled the ufw firewall and also enabled ports 22, 80 and 22786.
Both 22 and 80 are fine and accessible but not able to access 22786 from outside world.
Do I need to change some other firewall settings to enable port 22786 ?
admin@prod:~$ sudo ufw status numbered
Status: active
To Action From
-- ------ ----
[ 1] 22786 ALLOW IN Anywhere
[ 2] 22 ALLOW IN Anywhere
[ 3] 80 ALLOW IN Anywhere
[ 4] 22786 (v6) ALLOW IN Anywhere (v6)
[ 5] 22 (v6) ALLOW IN Anywhere (v6)
[ 6] 80 (v6) ALLOW IN Anywhere (v6)
admin@prod:~$ sudo netstat -plunt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1619/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 834/sshd: /usr/sbin
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 927/sshd: admin@pts
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 784/systemd-resolve
tcp6 0 0 :::80 :::* LISTEN 1619/nginx: master
tcp6 0 0 :::22 :::* LISTEN 834/sshd: /usr/sbin
tcp6 0 0 ::1:6010 :::* LISTEN 927/sshd: admin@pts
udp 0 0 127.0.0.53:53 0.0.0.0:* 784/systemd-resolve
I installed Nginx
manually and was able to access it using http://ipaddress
But when I check through this online tool (https://www.yougetsignal.com/tools/open-ports/), it shows both 22
and '80' ports are enabled but 22786 is closed.
22
port was already open when I got this host and 80
got enabled after I installed Nginx
and added it to ufw
using sudo ufw allow 80
command. I used sudo ufw allow 22786 command to enable this port too but no luck.