Forrest logo
back to the firewall-cmd tool

firewall-cmd:tldr:8dbc7

firewall-cmd: Permanently open two arbitrary ports in the specified zone.
$ firewall-cmd --permanent --zone=${public} --add-port=${25565-tcp} --add-port=${19132-udp}
try on your machine

This command is used to add specific firewall rules for network ports on a Linux system using the firewall-cmd command line tool.

Here is a breakdown of the command:

  • firewall-cmd: This is the command line tool used to manage firewalld, which is a firewall management solution for Linux systems.
  • --permanent: This option specifies that the rule change should be permanent, meaning it will survive system reboots. If this option is not used, the rule change would only be temporary until the next system restart.
  • --zone=${public}: This specifies the firewall zone for which the rule is being added. The ${public} is a shell variable that holds the zone name. The zone represents a network zone with specific firewall settings, such as "public" zone for a public network.
  • --add-port=${25565-tcp}: This adds a rule to allow incoming traffic on port 25565 using the TCP protocol. Similar to the zone, ${25565-tcp} is a shell variable containing the port number and protocol.
  • --add-port=${19132-udp}: This adds a rule to allow incoming traffic on port 19132 using the UDP protocol. Again, ${19132-udp} is a shell variable representing the port number and protocol.

Overall, the command adds two rules to the firewall configuration: one for TCP port 25565 and another for UDP port 19132, allowing incoming traffic on these ports in the specified firewall zone. The --permanent option ensures that these rules will persist across system reboots.

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