title: "Oracle VPS iptables Open Port Settings"
slug: "oracle_vps_iptables"
date: 2023-09-18T10:20:17+08:00
type: posts
draft: false
categories: ["Using Software","Shell","Linux","Applications","Collection and Organization"]
tags: ["linux","vps","oracle","iptables"]
description: ""#
Open ports in the Oracle VPS iptables settings
Open all ports in iptables#
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -F
Disable the default Iptable rules in Oracle's built-in image#
sudo apt-get purge netfilter-persistent && sudo reboot
Test if the ports have been opened
Note:#
Forcefully 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 for open port status#
nmap ip or domain name
Note 2 (Open specific ports):#
Open specific ports in iptables#
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
Replace 80 with the desired port number, and tcp with the transmission protocol
Save the rules#
iptables-save
With the above command, we have successfully opened the specified port. However, if the server restarts at this time, the above rules will be lost. Therefore, we need to perform the following persistent operation on the rules.
Install iptables-persistent#
sudo apt-get install iptables-persistent
Persist the rules#
sudo netfilter-persistent save
sudo netfilter-persistent reload