Search code examples
ubuntuportforwardingoracle-cloud-infrastructurefirewalld

Can not reach open ports on Oracle Cloud Instance


I have 2 micro instances running in Oracle Cloud, both under the same subnet with some port forwarding enabled, namely

enter image description here

On the first instance I enabled also these ports in firewalld and I'm able to reach them from outside.

ubuntu@instance:~$ sudo firewall-cmd --list-all
public
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: dhcpv6-client ssh
  ports: 80/tcp 443/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
user@iMac:~$ telnet instance_ip 443
Trying ...
Connected to instance_ip.

I did exactly the same thing on the second instance, which means that sudo firewall-cmd --list-all returns the same ouput. A quick check with sudo iptables -S also shows the same result. As both instances are connected to the same subnet I would expect the port forwarding to work in the same way. However, I can only connect to port 22 on the second instance. Any attempt to ping other ports results in a Connection refused.

What am I forgetting?

P.S. I'm aware of question Can't access Oracle Cloud Always Free Compute http port. Obviously I already followed every suggestion in that question, but that helped in setting up only the first instance.


Solution

  • If a firewall is in place, the connection is not refused but blocked ("Connection Time Out"). So if you get a "Connection refused.", this sounds more like no process is running on the host listening on the port. Can you check with "netstat -na | grep LISTEN" if a process is listening on port 80/443 ?