このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
|
centos:firewall-cmd [2020/06/01 16:40] y2sunlight [firewall-cmdコマンド] |
centos:firewall-cmd [2020/06/02 08:03] (現在) y2sunlight |
||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | > 編集中 | ||
| - | |||
| ====== firewall-cmdコマンド ====== | ====== firewall-cmdコマンド ====== | ||
| Version CentOS 7.2 | Version CentOS 7.2 | ||
| 行 18: | 行 16: | ||
| * [[centos: | * [[centos: | ||
| * [[centos: | * [[centos: | ||
| - | * [[centos: | + | * firewall-cmd --- ファイアウォールの操作 |
| リンク | リンク | ||
| 行 29: | 行 27: | ||
| ==== ゾーン ==== | ==== ゾーン ==== | ||
| - | ファイアウォールは、ゾーン毎に設定を行います。そして、インターフェース(NIC)に対してそのゾーンを割り当てます。結果として各ゾーンは複数のインターフェースを持つことになります。事前定義されたゾーンは ''/ | + | ファイアウォールは、ゾーン毎に設定を行います。そして、インターフェース(NIC)に対してそのゾーンを割り当てます。結果として各ゾーンは複数のインターフェースを持つことになります。事前定義されたゾーンは ''/ |
| - | 以下は、現在のゾーン割り当てを見る例です: | + | {{fa> |
| < | < | ||
| - | irewall-cmd --get-active-zones | + | firewall-cmd --get-active-zones |
| public | public | ||
| interfaces: eth0 | interfaces: eth0 | ||
| 行 39: | 行 38: | ||
| ゾーンの割り当てのないインターフェースには、デフォルトゾーンが割り当てられます。以下のコマンドは、デフォルトゾーンを表示します。 | ゾーンの割り当てのないインターフェースには、デフォルトゾーンが割り当てられます。以下のコマンドは、デフォルトゾーンを表示します。 | ||
| + | |||
| + | {{fa> | ||
| < | < | ||
| firewall-cmd --get-default-zone | firewall-cmd --get-default-zone | ||
| + | |||
| public | public | ||
| </ | </ | ||
| 行 47: | 行 49: | ||
| ==== サービス ==== | ==== サービス ==== | ||
| - | > TODO: | + | |
| + | サービスを使用すると、ポートのオープン、プロトコルの定義、パケット転送などを一括して行う事ができます。ゾーンにサービスを追加することで、そのサービス用のファイアウォール設定が反映されます。各サービスのファイアウォール設定は ''/ | ||
| + | |||
| + | {{fa>question-circle}} ファイアウォール設定で使用できるサービスの一覧を表示する | ||
| + | < | ||
| + | firewall-cmd --get-services | ||
| + | |||
| + | RH-Satellite-6 amanda-client bacula bacula-client dhcp dhcpv6 dhcpv6-client dns freeipa-ldap freeipa-ldaps freeipa-replication ftp high-availability http https imaps ipp ipp-client ipsec iscsi-target kerberos kpasswd ldap ldaps libvirt libvirt-tls mdns mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql proxy-dhcp radius rpc-bind rsyncd samba samba-client smtp ssh telnet tftp tftp-client transmission-client vdsm vnc-server wbem-https | ||
| + | </ | ||
| + | |||
| + | \\ | ||
| ===== firewall-cmdのユースケース ===== | ===== firewall-cmdのユースケース ===== | ||
| 行 53: | 行 65: | ||
| 以下の例は、publicゾーンを対象とした場合を想定しています。他のゾーンを指定する場合は、'' | 以下の例は、publicゾーンを対象とした場合を想定しています。他のゾーンを指定する場合は、'' | ||
| - | {{fa> | + | === サービスの許可 === |
| + | {{fa> | ||
| < | < | ||
| + | firewall-cmd --list-service | ||
| + | </ | ||
| + | |||
| + | {{fa> | ||
| + | < | ||
| + | firewall-cmd --add-service=http | ||
| + | firewall-cmd --add-service=http --permanent | ||
| + | |||
| + | # | ||
| + | firewall-cmd --reload | ||
| + | </ | ||
| + | |||
| + | {{fa> | ||
| + | < | ||
| + | firewall-cmd --remove-service=http | ||
| + | firewall-cmd --remove-service=http --permanent | ||
| + | |||
| + | firewall-cmd --reload | ||
| + | </ | ||
| + | |||
| + | === ポート番号の許可 === | ||
| + | |||
| + | {{fa> | ||
| + | < | ||
| + | firewall-cmd --list-ports | ||
| + | </ | ||
| + | |||
| + | {{fa> | ||
| + | < | ||
| + | firewall-cmd --add-port=8080/ | ||
| + | firewall-cmd --add-port=8080/ | ||
| + | |||
| + | # | ||
| + | firewall-cmd --reload | ||
| + | </ | ||
| + | |||
| + | {{fa> | ||
| + | < | ||
| + | firewall-cmd --remove-port=8080/ | ||
| + | firewall-cmd --remove-port=8080/ | ||
| + | |||
| + | firewall-cmd --reload | ||
| + | </ | ||
| + | |||
| + | === IPアドレスの許可 === | ||
| + | |||
| + | {{fa> | ||
| + | < | ||
| + | firewall-cmd --list-sources | ||
| + | </ | ||
| + | |||
| + | {{fa> | ||
| + | < | ||
| + | firewall-cmd --add-source=192.168.1.0/ | ||
| + | firewall-cmd --add-source=192.168.1.0/ | ||
| + | |||
| + | firewall-cmd --reload | ||
| + | </ | ||
| + | |||
| + | {{fa> | ||
| + | < | ||
| + | firewall-cmd --remove-source=192.168.1.0/ | ||
| + | firewall-cmd --remove-source=192.168.1.0/ | ||
| + | |||
| + | firewall-cmd --reload | ||
| </ | </ | ||
| \\ | \\ | ||
| - | ===== ゾーン ===== | + | |