FIREWALLD.ZONES(5)

✨ firewalld.zones β€” the manual page, but make it a group chat ✨

okay bestie, welcome to firewalld.zones(5) πŸ’– this is the zone lore. pull up a chair, get a snack, we're doing firewall vibes today πŸ“


🌸 NAME 🌸

firewalld.zones β€” firewalld zones. that's it. that's the name. iconic behavior honestly πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

πŸ’« What is a zone? πŸ’«

okay so. a network zone is basically a trust level for network connections. and it's a one to many relation, which means: a connection can only be part of one zone, but a zone can be used for many network connections. one zone, many connections. she's popular. she's in demand. πŸ‘‘

the zone defines the firewall features that are enabled in this zone:

  • Intra Zone Forwarding β€” lets packets received by a zone be forwarded to other interfaces or sources within the same zone, even if the zone's target is not ACCEPT. yes, even then. no cap.
  • Predefined services β€” a service is a combination of port and/or protocol entries. optionally, netfilter helper modules can be added, and also an IPv4 and IPv6 destination address. so, like, a little bundle. a service bundle. a curated set. ✨
  • Ports and protocols β€” definition of tcp, udp, sctp or dccp ports, where ports can be a single port or a port range. single or range, your call, bestie.
  • ICMP blocks β€” blocks selected Internet Control Message Protocol (ICMP) messages. these messages are either information requests or created as a reply to information requests or in error conditions. internet control message protocol. say it with me. πŸ“£
  • ICMP block inversion β€” changes how ICMP messages are handled. when enabled, all ICMP message types are blocked, except for those in the ICMP block list. inversion! she flipped it! πŸ”„
  • Masquerading β€” the addresses of a private network are mapped to and hidden behind a public IP address. this is a form of address translation. she's hiding. she's mysterious. she's NAT-coded. πŸ«₯
  • Forward ports β€” a forward port is either mapped to the same port on another host, or to another port on the same host, or to another port on another host. three options. pick your fighter. πŸ”₯
  • Rich language rules β€” the rich language extends the elements (service, port, icmp-block, masquerade, forward-port and source-port) with additional source and destination addresses, logging, actions and limits for logs and actions. it can also be used for host or network white and black listing. for more information, please have a look at firewalld.richlanguage(5). she does it all. main character energy for real. πŸ‘‘

for more information on the zone file format, please have a look at firewalld.zone(5) πŸŽ€

🌈 Which zones are available? 🌈

here are the zones provided by firewalld, sorted according to the default trust level of the zones from untrusted to trusted. we love a sorted list. we love a spectrum. from "stranger danger" to "you're basically family" πŸ’œ

  • drop β€” any incoming network packets are dropped, there is no reply. only outgoing network connections are possible. she's not answering. she's not even reading your texts. πŸ’€
  • block β€” any incoming network connections are rejected with an icmp-host-prohibited message for IPv4 and icmp6-adm-prohibited for IPv6. only network connections initiated within this system are possible. she will reply, but only to say "no". 😭
  • public β€” for use in public areas. you do not trust the other computers on networks to not harm your computer. only selected incoming connections are accepted. public wifi energy. stay safe out there. πŸ™ˆ
  • external β€” for use on external networks with masquerading enabled, especially for routers. you do not trust the other computers on networks to not harm your computer. only selected incoming connections are accepted. masquerading is on for this one, router besties πŸ›œ
  • dmz β€” for computers in your demilitarized zone that are publicly-accessible with limited access to your internal network. only selected incoming connections are accepted. demilitarized. dramatic. she's got boundaries. πŸ’…
  • work β€” for use in work areas. you mostly trust the other computers on networks to not harm your computer. only selected incoming connections are accepted. coworkers... mostly fine. mostly. 🧚
  • home β€” for use in home areas. you mostly trust the other computers on networks to not harm your computer. only selected incoming connections are accepted. home sweet home 🏠✨
  • internal β€” for use on internal networks. you mostly trust the other computers on the networks to not harm your computer. only selected incoming connections are accepted. notice this one says "on the networks" plural, that's the original, i'm not editing her πŸŽ€
  • trusted β€” all network connections are accepted. packets not addressed to this host will be forwarded. everyone's welcome. the door is open. the vibes are immaculate. πŸ‘‘

🌸 Which zone should be used? 🌸

a public WIFI network connection, for example, should be mainly untrusted. a wired home network connection should be fairly trusted. select the zone that best matches the network you are using. vibe check your network. match the energy. that's the whole assignment fr fr ✨

🫢 How to configure or add zones? 🫢

to configure or add zones you can either use one of the firewalld interfaces to handle and change the configuration:

  • the graphical configuration tool firewall-config
  • the command line tool firewall-cmd
  • or the D-Bus interface

or you can create or copy a zone file in one of the configuration directories. here's the tea:

  • /usr/lib/firewalld/zones is used for default and fallback configurations
  • /etc/firewalld/zones is used for user created and customized configuration files

like, know the difference. it matters. iykyk πŸ’–

πŸ’… How to set or change a zone for a connection? πŸ’…

the zone is stored into the ifcfg of the connection with the ZONE= option. if the option is missing or empty, the default zone set in firewalld is used.

if the connection is controlled by NetworkManager, you can also use nm-connection-editor to change the zone. cute little GUI moment πŸŽ€

for the addition or change of interfaces that are not under control of NetworkManager: firewalld tries to change the ZONE setting in the ifcfg file, if an ifcfg file exists that is using the interface.

only for the removal of interfaces that are not under control of NetworkManager: firewalld is not trying to change the ZONE setting in the ifcfg file. this is needed to make sure that an ifdown of the interface will not result in a reset of the zone setting to the default zone. only the zone binding is then removed in firewalld then.

🚨 okay hear me on this one because it's the sneaky bit: that "not changing the ZONE setting" thing on removal is on purpose. if it did change it, an ifdown would yeet your zone setting back to the default zone and you'd be like ??? so it doesn't. only the zone binding gets removed in firewalld. periodt. πŸ’―

πŸ”₯ SEE ALSO πŸ”₯

go read these too, bestie, they're all connected: firewall-applet(1), firewalld(1), firewall-cmd(1), firewall-config(1), firewalld.conf(5), firewalld.direct(5), firewalld.dbus(5), firewalld.icmptype(5), firewall-offline-cmd(1), firewalld.richlanguage(5), firewalld.service(5), firewalld.zone(5), firewalld.zones(5), firewalld.policy(5), firewalld.policies(5), firewalld.ipset(5), firewalld.helper(5)


⭐ NOTES ⭐


πŸ‘‘ AUTHORS πŸ‘‘

the legends who made this happen, give them their flowers πŸ’

  • Thomas Woerner <twoerner@redhat.com> β€” Developer
  • Jiri Popelka <jpopelka@redhat.com> β€” Developer
  • Eric Garver <eric@garver.life> β€” Developer

and that's the whole page, bestie!! this was firewalld 2.5.2 and yes, the manual name really is FIREWALLD.ZONES(5) β€” thank you for coming to my ted talk, go configure your zones responsibly, mwah πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from