Open ports in Oracle's web backend
Open all ports in iptables#
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -F
Oracle's built-in image has default Iptable rules, disable it#
sudo apt-get purge netfilter-persistent && sudo reboot
Test if the ports have been opened
Note:#
Force delete rules#
sudo rm -rf /etc/iptables && sudo reboot
Remove oracle-cloud-agent to prevent Oracle monitoring#
snap remove oracle-cloud-agent
Check firewall service status#
sudo systemctl status iptables.service
sudo systemctl status netfilter-persistent.service
Remote check port open status#
nmap ip or domain
Note 2 (Open specific ports):#
Open specific ports in iptables#
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
The middle part, 80, is the port that needs to be opened, and tcp is the transmission protocol
Save rules#
iptables-save
With the above command, we have opened the specified port, but if the server restarts at this time, the above rules will be lost, so we need to perform a persistence operation on the rules
Install iptables-persistent#
sudo apt-get install iptables-persistent
Persist rules#
sudo netfilter-persistent save
sudo netfilter-persistent reload