LoginSignup
0
0

More than 5 years have passed since last update.

[CentOS7] firewallについての覚書

Last updated at Posted at 2018-05-20

firewallについての覚書です。
補足等ございましたら、コメントください!!

環境

OS: CentOS Linux release 7.4

設定の確認

ゾーン一覧

# firewall-cmd --get-zones 
block dmz drop external home internal public trusted work

アクティブゾーンの確認

# firewall-cmd --get-active-zones
public
  interfaces: eth0

デフォルトゾーンの確認

# firewall-cmd --get-default-zones
public
## firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: dhcpv6-client ssh http https
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

serviceの追加/削除(--permanet は恒久的な設定になる)

# firewall-cmd --add-service=service-name (--permanent)
# firewall-cmd --remove-service=service-name (--permanent)

登録済みserviceの一覧

ls -la /usr/lib/firewalld/services

permanent オプションについて

--add-service だけでは即時反映はされるが、再起動時は元に戻ります。
--permanent を指定した場合は恒久的な設定になります。ただし、設定の際読み込みが必要です。

# firewall-cmd --list-services --zone=public --permanent
# firewall-cmd --add-service=http --permanent
# firewall-cmd --reload

参考

firewalldの設定方法(基本設定編)
CentOS 7 firewalld よく使うコマンド

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0