このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
01_linux:21_centos7:05_firewalld [2020/08/20 05:46] – matsui | 01_linux:21_centos7:05_firewalld [2022/07/14 05:27] (現在) – matsui | ||
---|---|---|---|
行 34: | 行 34: | ||
</ | </ | ||
+ | ※「--permanent」 オプションを指定することで、恒久的に設定を確認できます。 | ||
- | ===== サービスの一覧 | + | ===== サービス ===== |
+ | |||
+ | ==== サービスの一覧 ==== | ||
「/ | 「/ | ||
行 49: | 行 52: | ||
</ | </ | ||
- | ===== サービスの追加 | + | ==== サービスの追加 ==== |
< | < | ||
行 55: | 行 58: | ||
</ | </ | ||
- | ==== サービス追加恒久的 ==== | + | ==== サービス追加(恒久的) ==== |
< | < | ||
行 61: | 行 64: | ||
</ | </ | ||
- | 「--permanent」 オプションを指定することで、恒久的な設定をそれぞれ確認できます。 | + | ※「--permanent」 オプションを指定することで、恒久的に設定します。 |
==== サービス削除 ==== | ==== サービス削除 ==== | ||
行 68: | 行 71: | ||
</ | </ | ||
- | ===== ネットワーク単位で許可する場合 | + | ===== ポート単位 ===== |
+ | |||
+ | ==== 開放 ==== | ||
+ | |||
+ | < | ||
+ | firewall-cmd --add-port=8080/ | ||
+ | </ | ||
+ | |||
+ | ==== 削除 ==== | ||
+ | |||
+ | < | ||
+ | firewall-cmd --remove-port=8080/ | ||
+ | </ | ||
+ | |||
+ | ===== ネットワーク単位で許可 ===== | ||
新しくzoneを作成する事で可能です。 | 新しくzoneを作成する事で可能です。 | ||
行 81: | 行 98: | ||
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> |