Firewall is security software used to prevent hacking attempts by hackers/attackers. Firewalls primarily operate at the network layer. which filter the packets.
The firewall software rules will decide to which packet will be allow or blocked based on the rules for those packets in the firewall.
For the Linux operating system, the firewall provides a number of core technologies as a service, the most popular of which are: firewalls and iptables.
FirewallD is a dynamic firewall manager for Linux systems. This service is used to configure network connections, thus determining which external networks or internal packets are allowed to cross the network and which are prohibited.
Start or Stop and Enable or Disable FirewallD Service
If you’re using CentOS/RHEL 7
Disable FirewallD
To disable firewalld, run the following command as root:
systemctl disable firewalld
Stop Firewalld
To stop firewalld, run the following command as root:
systemctl stop firewalld
Open a Port in Firewalld
- Log in to SSH
- Check if the application port is defined as a service (e.g. IMAPS, Kerberos, MySQL):
Copyfirewall-cmd -get-services
Copysudo firewall-cmd –permanent –add-port=1234/tcp - Reload Firewalld to apply changes:
Copyfirewall-cmd –reload
Check the Status of Firewalld
check the status of firewallto run the following command as root:
systemctl status firewalld
For Ubuntu follow these commands to stop/start firewall:
Enable Ufw Iptables Firewall
$ sudo ufw enable
Disable Ufw Iptables Firewall
$ sudo ufw disable
Check Status of Ufw Iptables Firewall
# sudo ufw status
Conclusion
In this article you learned how to manage firewall on linux Os and how to start and stop frewall.