Wednesday, February 11, 2015

Using fiirewall-cmd on Fedora 21 and Red Hat 7

I ran into a situation today where I had to open ports on the fireall on my Acer Aspire One that is running Fedora 21.  I used the firewall GUI but wanted to learn how to do this via the command line via firewall-cmd.  I found the following post on StackOverflow. I had to run the --reload for any changes to take affect.


Here are a few commands I used:

 ZZ=$(sudo firewall-cmd --get-zones); for Z in $ZZ; do echo -n "<Z=${Z}> ";firewall-cmd --zone=$Z --query-port=21/tcp; done

sudo firewall-cmd --get-zones

sudo firewall-cmd --zone=internal --add-port=21/tcp --permanent

sudo firewall-cmd --reload



No comments: