{"id":6698,"date":"2017-05-08T14:26:15","date_gmt":"2017-05-08T06:26:15","guid":{"rendered":"http:\/\/rmohan.com\/?p=6698"},"modified":"2017-05-08T14:26:15","modified_gmt":"2017-05-08T06:26:15","slug":"centos-rhel-7-firewalld-command-line-reference-cheat-sheet","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6698","title":{"rendered":"CentOS \/ RHEL 7 firewalld : Command line reference (Cheat Sheet)"},"content":{"rendered":"<p>Firewalld is the new way of interacting with the iptables rules in RHEL 7. It allows to set new sucurity rules and activate them in runtime without disconnecting any existing connections.<\/p>\n<p>Managing firewalld<\/p>\n<p># firewall-cmd &#8211;state                 &#8212; Display whether service is running<br \/>\n# systemctl status firewalld           &#8212; Another command to display status of service<br \/>\n# systemctl restart firewall-cmd       &#8212; To restart service<br \/>\n# firewall-cmd &#8211;reload                &#8212; To reload the permanent rules without interrupting existing persistent connections<br \/>\nTo start\/stop\/status firewalld service<\/p>\n<p># systemctl start firewalld.service<br \/>\n# systemctl stop firewalld.service<br \/>\n# systemctl status firewalld.service<br \/>\nTo enable\/disable firewalld service at boot time<\/p>\n<p>To enable firewalld service from starting at boot time.<\/p>\n<p># systemctl enable firewalld<br \/>\nTo disable firewalld service from starting at boot time.<\/p>\n<p># systemctl disable firewalld<br \/>\nTo list details of default and active zones<\/p>\n<p># firewall-cmd &#8211;get-default-zone<br \/>\n# firewall-cmd &#8211;get-active-zones<br \/>\n# firewall-cmd &#8211;list-all<br \/>\nTo add\/remove interfaces to zones<\/p>\n<p>To add interface \u201ceth1\u201d to \u201cpublic\u201d zone.<\/p>\n<p># firewall-cmd &#8211;zone=public &#8211;change-interface=eth1<br \/>\nTo list\/add\/remove services to zones<\/p>\n<p>To list available services :<\/p>\n<p># firewall-cmd &#8211;get-services<br \/>\nTo add \u201csamba and samba-client\u201d service to a specific zone. You may include, \u201cpermanent\u201d flag to make this permanent change.<\/p>\n<p># firewall-cmd &#8211;zone=public &#8211;add-service=samba &#8211;add-service=samba-client &#8211;permanent<br \/>\nTo list services configured in a specific zone.<\/p>\n<p># firewall-cmd &#8211;zone=public &#8211;list-service<br \/>\nTo list and Add ports to firewall<\/p>\n<p># firewall-cmd &#8211;list-ports<br \/>\n# firewall-cmd &#8211;zone=public &#8211;add-port=5000\/tcp<br \/>\nNote:<br \/>\nYou may restart the Network service followed by Firewall server.<\/p>\n<p># systemctl restart network.service<br \/>\n# systemctl restart firewalld.service<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Firewalld is the new way of interacting with the iptables rules in RHEL 7. It allows to set new sucurity rules and activate them in runtime without disconnecting any existing connections.<\/p>\n<p>Managing firewalld<\/p>\n<p># firewall-cmd &#8211;state &#8212; Display whether service is running # systemctl status firewalld &#8212; Another command to display status of service # [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6698"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6698"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6698\/revisions"}],"predecessor-version":[{"id":6699,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6698\/revisions\/6699"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}