Have been working on iptables for yrs and still cant get used to the more "friendly" firewalld, well, here it is the cheatsheet:
- -drop: The lowest level of trust. All incoming connections are dropped without reply and only outgoing connections are possible.
- -block: Similar to the above, but instead of simply dropping connections, incoming requests are rejected with an icmp-host-prohibited or icmp6-adm-prohibited message.
- -public: Represents public, untrusted networks. You don’t trust other computers but may allow selected incoming connections on a case-by-case basis.
- -external: External networks in the event that you are using the firewall as your gateway. It is configured for NAT masquerading so that your internal network remains private but reachable.
- -internal: The other side of the external zone, used for the internal portion of a gateway. The computers are fairly trustworthy and some additional services are available.
- -dmz: Used for computers located in a DMZ (isolated computers that will not have access to the rest of your network). Only certain incoming connections are allowed.
- -work: Used for work machines. Trust most of the computers in the network. A few more services might be allowed.
- -home: A home environment. It generally implies that you trust most of the other computers and that a few more services will be accepted.
- -trusted: Trust all of the machines in the network. The most open of the available options and should be used sparingly.
firewall-cmd --state
firewall-cmd --get-default-zone
firewall-cmd --get-active-zones
firewall-cmd --list-all
firewall-cmd --get-zones
firewall-cmd --zone=home --list-all
firewall-cmd --zone=home --list-all-zones
firewall-cmd --zone=home --change-interface=eth0
firewall-cmd --set-default-zone=home
firewall-cmd --get-services
Service Definition:
/usr/lib/firewalld/services
firewall-cmd --reload
firewall-cmd --get-services
firewall-cmd --zone=public --add-service=http
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --list-services
firewall-cmd --zone=public --add-port=5000/tcp
firewall-cmd --zone=public --permanent --add-port=4990-4999/udp
firewall-cmd --permanent --zone=public --remove-service=dhcpv6-client
firewall-cmd --zone=public --permanent --remove-port=443/tcp
firewall-cmd --zone=public --list-ports
firewall-cmd --runtime-to-permanent
Targets definition:
- ACCEPT: accept the packet.
- %%REJECT%%: reject the packet, returning a reject reply.
- DROP: drop the packet, returning no reply.
- default: don't do anything. The zone washes its hands of the problem, and kicks it "upstairs".
firewall-cmd --permanent --zone=public --set-target=DROP