shimgo
7/4/2017 - 1:47 PM

firewalldについて

firewalldについて

####起動

systemctl start firewalld.service

####NICに割り当てられているゾーンを表示

firewall-cmd --get-active-zones

####ゾーンに割り当てられているサービスを表示

firewall-cmd --list-services --zone=public --permanent

####各サービスの詳細を見る 以下コマンドで表示されるファイル内を見ればいい

ls /usr/lib/firewalld/services/

###サービスを追加する

  • 設定ファイルを編集する場合
以下のフォルダ下にあるファイルを編集する
/etc/firewalld/zones/
<zone>
  <short>Public</short>
  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <service name="dhcpv6-client"/>
  <service name="http"/>
  <service name="ssh"/>
</zone>
  • コマンドで追加する場合
    permanentをつけないとreloadしたときにリセットされるので注意
firewall-cmd --add-service=http --zone=public --permanent

####設定されているポート状況を表示

iptables-save