From wikistone
Revision as of 12:59, 20 July 2021 by Bill (talk | contribs) (Created page with "==Quick Set== Make permanent: <pre>firewall-cmd --runtime-to-permanent</pre> or <pre>firewall-cmd --add-service=xxx --premanent</pre> -note: Note immediately active. Reset to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Quick Set

Make permanent:

firewall-cmd --runtime-to-permanent

or

firewall-cmd --add-service=xxx --premanent

-note: Note immediately active.

Reset to perm rules:

firewall-cmd --reload

List stuff:

firewall-cmd --list-all-zones
firewall-cmd --zone={zone} --list-all

Add / remove stuff: Add:

firewall-cmd --add-service=
firewall-cmd --add-port= {n}/{tcp|udp}
firewall-cmd --add-protocol= {protocol name, eg: smb2}

Remove:

firewall-cmd --remove ...

Zones:

firewall-cmd --get-zones
firewall-cmd --get-active-zones

firewall-cmd --set-default-zone={zone}

firewall-cmd --zone={zone} --add-interface={ifname}
firewall-cmd --zone={zone} --change-interface={ifname}
firewall-cmd --zone={zone} --remove-interface={ifname}
firewall-cmd --zone={zone} --query-interface={ifname}

Custom services: Clone/add and edit here: /usr/lib/firewalld/services

<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>SSH</short>
  <port protocol="tcp" port="22"/>
</service>


ICMP Inversion

What is blocked is allowed. What is allowed is blocked. Enable to allow all ICMP.

firewall-cmd --zone=drop --add-icmp-block-inversion --permanent

ICMP Services:

firewall-cmd --get-icmptypes

address-unreachable bad-header communication-prohibited destination-unreachable echo-reply echo-request fragmentation-needed host-precedence-violation host-prohibited host-redirect host-unknown host-unreachable ip-header-bad neighbour-advertisement neighbour-solicitation network-prohibited network-redirect network-unknown network-unreachable no-route packet-too-big parameter-problem port-unreachable precedence-cutoff protocol-unreachable redirect required-option-missing router-advertisement router-solicitation source-quench source-route-failed time-exceeded timestamp-reply timestamp-request tos-host-redirect tos-host-unreachable tos-network-redirect tos-network-unreachable ttl-zero-during-reassembly ttl-zero-during-transit unknown-header-type unknown-option