ユーザ用ツール

サイト用ツール


01_linux:21_centos7:05_firewalld

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
01_linux:21_centos7:05_firewalld [2020/08/20 05:46] matsui01_linux:21_centos7:05_firewalld [2022/07/14 05:27] (現在) matsui
行 34: 行 34:
 </code> </code>
  
 +※「--permanent」 オプションを指定することで、恒久的に設定を確認できます。
  
-===== サービスの一覧 =====+===== サービス ===== 
 + 
 +==== サービスの一覧 ====
  
 「/usr/lib/firewalld/services」以下にxmlファイルがあり、ポートを記述してあります。 「/usr/lib/firewalld/services」以下にxmlファイルがあり、ポートを記述してあります。
行 49: 行 52:
 </code> </code>
  
-===== サービスの追加 =====+==== サービスの追加 ====
  
 <code> <code>
行 55: 行 58:
 </code> </code>
  
-==== サービス追加恒久的 ====+==== サービス追加(恒久的====
  
 <code> <code>
行 61: 行 64:
 </code> </code>
  
-「--permanent」 オプションを指定することで、恒久的設定をそれぞれ確認できます。+「--permanent」 オプションを指定することで、恒久的設定ます。
  
 ==== サービス削除 ==== ==== サービス削除 ====
行 68: 行 71:
 </code> </code>
  
-===== ネットワーク単位で許可する場合 =====+===== ポート単位 ===== 
 + 
 +==== 開放 ==== 
 + 
 +<code> 
 +firewall-cmd --add-port=8080/tcp --zone=public --permanent 
 +</code> 
 + 
 +==== 削除 ==== 
 + 
 +<code> 
 +firewall-cmd --remove-port=8080/tcp --zone=public --permanent 
 +</code> 
 + 
 +===== ネットワーク単位で許可 =====
  
 新しくzoneを作成する事で可能です。 新しくzoneを作成する事で可能です。
行 81: 行 98:
   sources: 10.15.0.0/24   sources: 10.15.0.0/24
 </code> </code>
 +
 +==== ネットワーク削除 ====
 +  firewall-cmd --permanent --zone=management --remove-source=10.15.0.0/16
 +
 +
 +
 +==== Nat ====
 +
 +eth1から入るものをIPマスカレードでeth0から出ていく
 +
 +<code>
 +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,ESTABLISHED -j ACCEPT
 +
 +firewall-cmd --reload
 +</code>
 +
 {{tag>centos7}} {{tag>centos7}}
01_linux/21_centos7/05_firewalld.1597902408.txt.gz · 最終更新: 2020/08/20 05:46 by matsui