Manage Linux Firewall with iptables and firewalld
In this article will be covering details regarding iptables and firewalld which helps in Linux firewall management. We will also be looking at how to enable specific ports (1521 for Oracle) inside iptables.
Linux Firewall status
The below command will show you the current status “Active” in case firewall is running
systemctl status firewalld
Disable Linux Firewall
For practicing Oracle on Linux, you might need to disable the Linux firewall so that you can connect applications to database listener. Below commands will permanently disable Linux firewall
service firewalld stop systemctl disable firewalld
Enable Linux Firewall
Just in case you would like to enable Linux firewall after disabling it, use below commands
service firewalld start systemctl enable firewalld
Enable 1521 Port in Linux
On some servers, port 1521 will not be enabled by default because of security reasons. You can enable this specific port inside linux using below commands.
For Oracle Linux 5 and 6
If you are working on Oracle Linux 5 or 6 version, use below commands to enable specific ports as root user
iptables -I INPUT -p tcp --dport 1521 -j ACCEPT
If you would like to open any specific port in Linux, just replace the port number (1521) with new port number.
For Oracle Linux 7
To open a port 1521 permanently, run below command as root user
firewall-cmd --permanent --add-port=1521/tcp