How to disable Ubuntu firewall in Oracle Cloud

When I first started using Ubuntu on Oracle Cloud, I ran into the problem in which ports weren’t open even though the traditional firewall wasn’t blocking them. After some research, I discovered that Oracle has a specific file that blocks all connections except for ssh (port 22).

The following guide will teach you how to open all ports for your applications, once they are open you can use the traditional firewall to block unwanted connections.

Tutorial:

Once you have your machine set up on oracle cloud, you will want to edit the file that contains which ports are available to be accessed.

 sudo nano /etc/iptables/rules.v4

Now add the following lines under ” : InstanceServices – [0:0] “

-A INPUT -j ACCEPT -m comment --comment "Accept all incoming"
-A OUTPUT -j ACCEPT -m comment --comment "Accept all outgoing"

Save the file with “ctrl + s” and exit with “ctrl + x”.

Once saved, reboot the server.

That should solve the problem. This guide is intended for Ubuntu 20.04, other versions might or might not work.