2015-01-12 10:45:34 -05:00
|
|
|
# firewall-cmd
|
|
|
|
|
2021-05-20 16:13:41 -04:00
|
|
|
> The firewalld command-line client.
|
2021-07-09 16:45:55 +02:00
|
|
|
> More information: <https://firewalld.org/documentation/man-pages/firewall-cmd>.
|
2015-01-12 10:45:34 -05:00
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- View the available firewall zones:
|
2015-01-12 10:45:34 -05:00
|
|
|
|
|
|
|
`firewall-cmd --get-active-zones`
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- View the rules which are currently applied:
|
2015-01-12 10:45:34 -05:00
|
|
|
|
|
|
|
`firewall-cmd --list-all`
|
|
|
|
|
2020-03-03 18:21:21 +01:00
|
|
|
- Permanently move the interface into the block zone, effectively blocking all communication:
|
|
|
|
|
|
|
|
`firewall-cmd --permanent --zone={{block}} --change-interface={{enp1s0}}`
|
|
|
|
|
2021-01-31 14:05:18 -03:00
|
|
|
- Permanently open the port for a service in the specified zone (like port 443 when in the `public` zone):
|
2015-01-12 10:45:34 -05:00
|
|
|
|
|
|
|
`firewall-cmd --permanent --zone={{public}} --add-service={{https}}`
|
|
|
|
|
2021-01-31 14:05:18 -03:00
|
|
|
- Permanently close the port for a service in the specified zone (like port 80 when in the `public` zone):
|
2015-01-12 10:45:34 -05:00
|
|
|
|
|
|
|
`firewall-cmd --permanent --zone={{public}} --remove-service={{http}}`
|
|
|
|
|
2020-03-03 18:21:21 +01:00
|
|
|
- Permanently open two arbitrary ports in the specified zone:
|
|
|
|
|
|
|
|
`firewall-cmd --permanent --zone={{public}} --add-port={{25565/tcp}} --add-port={{19132/udp}}`
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Reload firewalld to force rule changes to take effect:
|
2015-01-12 10:45:34 -05:00
|
|
|
|
|
|
|
`firewall-cmd --reload`
|