Firewall Rules

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 Firewall

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 To configure Firewalld to only allow connections to permitted hosts on a Linux system

To configure Firewalld to only allow connections to permitted hosts on a Linux system, you can follow these steps: 

  1. Identify the network interface that you want to apply the firewall rules to. For example, the interface name could be "eth0" or "enp0s3". 

  2. Define the permitted hosts that you want to allow connections from. You can use IP addresses or hostname entries. 

  3. Create a new Firewalld zone for the interface that you want to apply the rules to. For example, you could name the zone "trusted". 

 

 

sudo firewall-cmd --permanent --new-zone=trusted 

 

Add the network interface to the new zone. 

 

sudo firewall-cmd --permanent --zone=trusted --add-interface=<interface-name> 

 

Replace <interface-name> with the name of the interface that you want to apply the rules to. 

 

Add the permitted hosts to the new zone. 

 

sudo firewall-cmd --permanent --zone=trusted --add-source=<ip-address>/<netmask> 

sudo firewall-cmd --permanent --zone=trusted --add-source=<hostname> 

 

Replace <ip-address>/<netmask> with the IP address and netmask of the permitted host, and <hostname> with the hostname of the permitted host. 

 

Remove the default rules from the new zone. 

 

sudo firewall-cmd --permanent --zone=trusted --remove-service=ssh 

sudo firewall-cmd --permanent --zone=trusted --remove-service=dhcpv6-client 

 

Reload the Firewalld configuration. 

 

sudo firewall-cmd –reload 

 

After completing these steps, Firewalld will only allow connections to the network interface from the specified permitted hosts. All other connections will be blocked. Note that you may need to adjust the rules depending on your specific network configuration and security requirements.

 

Comments

Popular posts from this blog

NTP:

Network-Interface

NetMask