I’ve a VM in Google Cloud and I’m trying to connect to it over TCP port 8890.
I’ve already set the Firewall rules in GCP so the problem in on VM firewall.
I’m using Debian 10 as OS and I’ve installed ufw. The output of ufw status
command is:
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
2222 ALLOW Anywhere
21 ALLOW Anywhere
Nginx Full ALLOW Anywhere
21/tcp ALLOW Anywhere
49152:65535/tcp ALLOW Anywhere
5432 ALLOW Anywhere
8890 ALLOW Anywhere
8890/tcp ALLOW Anywhere
8890/udp ALLOW Anywhere
Anywhere ALLOW 127.0.0.1
22/tcp (v6) ALLOW Anywhere (v6)
2222 (v6) ALLOW Anywhere (v6)
21 (v6) ALLOW Anywhere (v6)
Nginx Full (v6) ALLOW Anywhere (v6)
21/tcp (v6) ALLOW Anywhere (v6)
49152:65535/tcp (v6) ALLOW Anywhere (v6)
5432 (v6) ALLOW Anywhere (v6)
8890 (v6) ALLOW Anywhere (v6)
8890/tcp (v6) ALLOW Anywhere (v6)
8890/udp (v6) ALLOW Anywhere (v6)
but if try to telnet localhost 8890
:
Trying ::1…
Trying 127.0.0.1…
telnet: Unable to connect to remote host: Connection refused
the output of netstat -tulpn | grep LISTEN
command is:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 614/nginx: master p
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 607/sshd
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 561/postgres
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 614/nginx: master p
tcp6 0 0 :::80 :::* LISTEN 614/nginx: master p
tcp6 0 0 :::21 :::* LISTEN 433/vsftpd
tcp6 0 0 :::22 :::* LISTEN 607/sshd
tcp6 0 0 :::5432 :::* LISTEN 561/postgres
tcp6 0 0 :::443 :::* LISTEN 614/nginx: master p
2
Answers
That's the log JSON from Google Cloud:
And that confirm the problem is on the istance and not in Google Cloud firewall
This is expected behavior. In order to see
tcp 0 0 0.0.0.0:8890 0.0.0.0:*
Do the following
Reason:
netstat will only show the port if a service or other program is actually listening for incoming connections on that port.