Software >> OS >> Unix >> Linux >> RHEL >> 7 >> commands >> firewall-cmd >> Examples of firewall-cmd command usage

 

Purpose Command
get help on the command firewall-cmd --help
change the zone for network interface firewall-cmd --zone=home --change-interface=eth0
list all zones (default and custom) firewall-cmd --get-zones 
list a list of active zones firewall-cmd --get-active-zones
add new custom zone permanently

firewall-cmd --permanent --new-zone=zonename

firewall-cmd --reload

  firewall-cmd --permanent --add-masquerade
enable port forwarding permanent from tcp 8888 to tcp 80

firewall-cmd --permanent --add-forward-port=port=8888:proto=tcp:toport=80

firewall-cmd --reload