top of page

Linux Firewall with iptables and firewalld

Master Linux firewalls using 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 Linux firewalld command will let you check Linux firewall status. It will show you the current status Active in case firewall is running

systemctl status firewalld


Linux Disable Firewall


For practicing Oracle on Linux, you might need to stop 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


Linux Enable Firewall


Just in case you would like to enable Linux firewall after disabling it, use below commands

service firewalld start
systemctl enable firewalld


Enable Ports 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.


Enable 1521 Port in Linux


If you are working on Oracle Linux 5 or 6 version, use Linux iptables command 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.


Enable Port Range in Linux


To open multiple port ranges in Linux, use below command

iptables -A INPUT -p tcp -m multiport --dports 7101:7200,4889:4898,1159,4899:4908,7788:7809,3872,1830:1849 -j ACCEPT

Enable Port in Oracle Linux 7


In some Linux versions, below command works fine

firewall-cmd  --permanent --add-port=1521/tcp
Become a top notch dba with DBA Genesis
Start your DBA career today
bottom of page