このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
01_linux:21_centos7:05_firewalld [2021/01/05 06:16] – matsui | 01_linux:21_centos7:05_firewalld [2022/07/14 05:27] (現在) – matsui | ||
---|---|---|---|
行 71: | 行 71: | ||
</ | </ | ||
- | ===== ネットワーク単位で許可する場合 | + | ===== ポート単位 ===== |
+ | |||
+ | ==== 開放 ==== | ||
+ | |||
+ | < | ||
+ | firewall-cmd --add-port=8080/ | ||
+ | </ | ||
+ | |||
+ | ==== 削除 ==== | ||
+ | |||
+ | < | ||
+ | firewall-cmd --remove-port=8080/ | ||
+ | </ | ||
+ | |||
+ | ===== ネットワーク単位で許可 ===== | ||
新しくzoneを作成する事で可能です。 | 新しくzoneを作成する事で可能です。 | ||
行 86: | 行 100: | ||
==== ネットワーク削除 ==== | ==== ネットワーク削除 ==== | ||
- | 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> |