Forrest logo
back to the firewall-cmd tool

firewall-cmd:tldr:933d8

firewall-cmd: Permanently move the interface into the block zone, effectively blocking all communication.
$ firewall-cmd --permanent --zone=${block} --change-interface=${enp1s0}
try on your machine

This command is used to configure network firewall settings using the firewall-cmd command-line tool. Let's break down the command:

  • firewall-cmd: This is the command-line tool used to manipulate the firewall.
  • --permanent: This flag indicates that the changes made should be permanent, meaning they persist across system reboots.
  • --zone=${block}: This flag specifies the firewall zone to which the following rule or configuration change should be applied. The ${block} variable should be replaced with the appropriate firewall zone name, for example, "public", "internal", or "block".
  • --change-interface=${enp1s0}: This flag is used to associate or change the network interface (in this case, ${enp1s0} should be replaced with the actual network interface name, e.g., "eth0" or "ens33") linked with the specified firewall zone.

To sum up, this command sets the network interface ${enp1s0} to be associated with the firewall zone ${block} on a permanent basis. This means that all network traffic coming through that interface will be subject to the firewall rules defined in the specified block zone.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the firewall-cmd tool