linux:commands:network:firewall-cmd

差分

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

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
linux:commands:network:firewall-cmd [2022/09/20 12:23] ともやんlinux:commands:network:firewall-cmd [2022/09/20 13:35] (現在) – [サービスの許可を永続的に削除] ともやん
行 392: 行 392:
 </WRAP> </WRAP>
  
-===== デフォルトゾーンの確認 =====+===== デフォルトゾーンとアクティブゾーンの確認 =====
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
行 402: 行 402:
 </WRAP> </WRAP>
  
-<WRAP left round tip 95%>+<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +$ firewall-cmd --get-active-zones 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +FedoraWorkstation 
 +  interfaces: wlp2s0 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +<WRAP left round tip 95% minfont_12>
 はじめに__デフォルトゾーンの確認を行っておくことは重要__です。\\ はじめに__デフォルトゾーンの確認を行っておくことは重要__です。\\
 <html><code>firewall-cmd</code></html> コマンドを <html><code>--zone</code></html> オプションを省略して実行すると、すべての操作はデフォルトゾーンに対して行われます。\\ <html><code>firewall-cmd</code></html> コマンドを <html><code>--zone</code></html> オプションを省略して実行すると、すべての操作はデフォルトゾーンに対して行われます。\\
行 489: 行 499:
 </WRAP> </WRAP>
  
-===== デフォルトゾーンの変更 ===== +===== デフォルトゾーンとアクティブゾーンの変更 ===== 
-workゾーンへ変更+デフォルトゾーンを FedoraServer へ変更\\
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --set-default-zone=work+$ sudo firewall-cmd --set-default-zone=FedoraServer
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 +success
 </pre></html></WRAP> </pre></html></WRAP>
-</WRAP> 
- 
-すべてのアクセスを許可するtrustedゾーンへ変更 
-<WRAP color_term> 
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-sudo firewall-cmd --set-default-zone=trusted+$ firewall-cmd --get-default-zone
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 +FedoraServer
 </pre></html></WRAP> </pre></html></WRAP>
-</WRAP> 
-※これらの変更はすぐに反映される。 
- 
-===== アクティブゾーンの確認 ===== 
-<WRAP color_term> 
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
 $ firewall-cmd --get-active-zones $ firewall-cmd --get-active-zones
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
-FedoraServer +FedoraWorkstation 
-  interfaces: br0 ens33+  interfaces: wlp2s0
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
- +※デフォルトゾーンを変更してもアクティブゾーンが変更される訳ではない🤔\\ 
-===== アクティブゾーンの変更 =====+ これらの変更はすぐに反映される🤔\\ 
 +\\ 
 +アクティブゾーンを FedoraServer へ変更\\
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --zone=work --change-interface=ens33+$ sudo firewall-cmd --zone=FedoraServer --change-interface=wlp2s0
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 +success
 +</pre></html></WRAP>
 +<WRAP color_command><html><pre>
 +$ firewall-cmd --get-active-zones
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +FedoraServer
 +  interfaces: wlp2s0
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 532: 行 545:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-sudo firewall-cmd --list-services+$ firewall-cmd --list-services
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 542: 行 555:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-sudo firewall-cmd --list-ports+$ firewall-cmd --list-ports
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 574: 行 587:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 +success
 +</pre></html></WRAP>
 +</WRAP>
 +
 +複数サービスの許可を一括で永続的に削除🤤\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +$ sudo firewall-cmd --permanent --remove-service={ssh,cockpit}
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +success
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
  • linux/commands/network/firewall-cmd.1663644222.txt.gz
  • 最終更新: 2022/09/20 12:23
  • by ともやん