Situatie
A virtual wall in the security system world is designed to protect our system from unwanted traffic and unauthorized access to our system. The security system in Linux OS is known as Linux Firewall, which monitors and governs the network traffic (outbound/inbound connections). It can be used to block access to different IP addresses, Specific subnets, ports (virtual points where network connections begin and end), and services.
We have a daemon’s name called Firewalld which is used to maintain the firewall policies. A dynamically managed firewall tool in a Linux system is known as Firewalld, it can be updated in real-time if there are any changes in the network environment.
Solutie
Pasi de urmat
This Firewalld works in concepts of zones (segments). We can check whether our firewall services are running or not by using the commands sudo (user access) and systemctl (use to control and manage the status of services).
sudo systemctl status firewalld
Some rules of Firewall
To protect our system from unauthorized access and to control network traffic (incoming and outgoing). We can do customization in ports, addresses, protocols, etc. some common examples are listed below:
Rule 1: Allowing SSH (Secure Shell or Secure Socket Shell) traffic
By using this we can allow all incoming traffic on the SHH port so that we can connect to the system remotely.
sudo firewall-cmd --zone=public --add-services=ssh --permanent sudo firewall-cmd --reload
Rule 2: Allowing incoming traffic on a specific port
We are allowing traffic on a specific TCP port 8080 you can replace it with requirements.
sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent sudo firewall-cmd --reload
Rule 3: Blocking incoming traffic on a specific IP address
We are blocking incoming traffic on IP 192.168.52.1 you can replace it with your requirements.
sudo firewall-cmd --zone=public --add-rich='rule family="ipv4" source address="192.168.52.1" reject' sudo firewall-cmd --reload
Leave A Comment?