Create a gist now

Instantly share code, notes, and snippets.

Useful programs for CentOS 7.

Programs

firewall-cmd

firewalld command line client

View firewall state
firewall-cmd --state

--state — Check whether firewall daemon is active.

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

--get-active-zones — Print currently active zones with interfaces and sources used.

View rules
firewall-cmd --zone=public --list-all

--zone=public — Name of the zone.

--list-all — View everything added or enabled for zone.

Open port
firewall-cmd --zone=public --add-port=80/tcp --permanent

--zone=public — Name of the zone.

--add-port=80/tcp — Add port to the zone.

--permanent — Save changes permanently.

Reload firewall
firewall-cmd --reload

--reload — Reload firewall rules.

systemctl

Control the systemd system and service manager.

Reload service
systemctl reload sshd.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment