I tried to open all ports for incoming trafic in my Google Cloud VM.
I've added a firewall rule to default
network in GCP.
Then I've created a VM using the default
network.
Unfortunately, after I ssh into my VM and scan for open ports, nmap says that only one is open.
piotr@worker:~$ nmap localhost
Starting Nmap 7.60 ( https://nmap.org ) at 2021-12-06 17:17 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00011s latency).
Not shown: 999 closed ports
PORT STATE SERVICE
22/tcp open ssh
Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds
Also when I try to telnet from my local machine, I fail on all ports, succed only on port 22.
Should I open ports manually with tool like ufw
(VM is a Ubuntu 18.0.4).
Or am I doing something else wrong?
I think you are confusing the action of opening a firewall port to allow traffic and opening a port by listening for connections. Your VM needs a service (software) listening on a port to act upon something connecting to that port. For example a web server for port 80 or 443.