このページの2つのバージョン間の差分を表示します。
次のリビジョン | 前のリビジョン | ||
01_linux:21_centos7:05_firewalld [2019/12/25 01:32] – 作成 matsui | 01_linux:21_centos7:05_firewalld [2022/07/14 05:27] (現在) – matsui | ||
---|---|---|---|
行 34: | 行 34: | ||
</ | </ | ||
+ | ※「--permanent」 オプションを指定することで、恒久的に設定を確認できます。 | ||
- | ===== サービスの一覧 | + | ===== サービス ===== |
+ | |||
+ | ==== サービスの一覧 ==== | ||
「/ | 「/ | ||
行 49: | 行 52: | ||
</ | </ | ||
- | ===== サービスの追加 | + | ==== サービスの追加 ==== |
< | < | ||
# firewall-cmd --add-service=https --zone=public | # firewall-cmd --add-service=https --zone=public | ||
</ | </ | ||
+ | |||
+ | ==== サービス追加(恒久的) ==== | ||
+ | |||
+ | < | ||
+ | # firewall-cmd --add-service=https --zone=public --permanent | ||
+ | </ | ||
+ | |||
+ | ※「--permanent」 オプションを指定することで、恒久的に設定します。 | ||
==== サービス削除 ==== | ==== サービス削除 ==== | ||
行 60: | 行 71: | ||
</ | </ | ||
- | ===== ネットワーク単位で許可する場合 | + | ===== ポート単位 ===== |
+ | |||
+ | ==== 開放 ==== | ||
+ | |||
+ | < | ||
+ | firewall-cmd --add-port=8080/ | ||
+ | </ | ||
+ | |||
+ | ==== 削除 ==== | ||
+ | |||
+ | < | ||
+ | firewall-cmd --remove-port=8080/ | ||
+ | </ | ||
+ | |||
+ | ===== ネットワーク単位で許可 ===== | ||
新しくzoneを作成する事で可能です。 | 新しくzoneを作成する事で可能です。 | ||
+ | < | ||
| | ||
| | ||
行 71: | 行 97: | ||
management | management | ||
sources: 10.15.0.0/ | sources: 10.15.0.0/ | ||
+ | </ | ||
+ | |||
+ | ==== ネットワーク削除 ==== | ||
+ | firewall-cmd --permanent --zone=management --remove-source=10.15.0.0/ | ||
+ | |||
+ | |||
+ | |||
+ | ==== Nat ==== | ||
+ | |||
+ | eth1から入るものをIPマスカレードでeth0から出ていく | ||
+ | |||
+ | < | ||
+ | firewall-cmd --get-active-zones | ||
+ | firewall-cmd --permanent --zone=internal --change-interface=eth1 | ||
+ | firewall-cmd --permanent --zone=internal --add-masquerade | ||
+ | |||
+ | firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -o eth0 -j MASQUERADE | ||
+ | firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i eth1 -o eth0 -j ACCEPT | ||
+ | firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i eth0 -o eth1 -m state --state RELATED, | ||
+ | |||
+ | firewall-cmd --reload | ||
+ | </ | ||
{{tag> | {{tag> |