tldr/pages/linux/firewall-cmd.md

33 lines
1.0 KiB
Markdown
Raw Permalink Normal View History

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