Flaxplax

Personal documentation

Firewalld

Firewalld is a linux firewall application.

Installation

You can easily install firewalld through apt

apt install firewalld

Zones

You can list zones with the following command

firewall-cmd --get-zones
block dmz drop external home internal public trusted work

You list what services are associated what a zone, if you don’t speceified what zone it will query the default zone

firewall-cmd --list-all
public
  target: default
  icmp-block-inversion: no
  interfaces: 
  sources: 
  services: dhcpv6-client ssh
  ports: 
  protocols: 
  forward: yes
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 

You can also specify the zone

firewall-cmd --zone=external --list-all
external
  target: default
  icmp-block-inversion: no
  interfaces: 
  sources: 
  services: ssh
  ports: 
  protocols: 
  forward: yes
  masquerade: yes
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules:

Allow and deny port

You can allow a port with the following command.

firewall-cmd --add-port=2252/udp

You can allow it permanently by adding --permanent as follows.

firewall-cmd --permanent --add-port=2252/udp

If you want to remove it later you can do it with the following command.

firewall-cmd --permanent --remove-port=2252/udp

Title: Firewalld

Author: Flaxplax

Publish Date: 21, Apr 2024

Last updated: 21, Apr 2024