差分

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

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
linux:commands:network:firewall-cmd [2022/09/20 13:03] – [デフォルトゾーンとアクティブゾーンの確認] ともやんlinux:commands:network:firewall-cmd [2025/02/21 12:16] (現在) – [サービスで許可されるポートを調べる] ともやん
行 3: 行 3:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo dnf install firewalld+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">dnf</font> install firewalld
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 11: 行 11:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-zones+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--get-zones</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 20: 行 20:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --list-all-zones+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--list-all-zones</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result_long><html><pre> <WRAP color_result_long><html><pre>
行 226: 行 226:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-zones+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--get-zones</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 235: 行 235:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --list-all-zones+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--list-all-zones</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result_long><html><pre> <WRAP color_result_long><html><pre>
行 395: 行 395:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-default-zone+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--get-default-zone</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 404: 行 404:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-active-zones+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--get-active-zones</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 420: 行 420:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-default-zone+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--get-default-zone</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 426: 行 426:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --list-services+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--list-services</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 432: 行 432:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --zone=FedoraWorkstation --list-services+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--zone=FedoraWorkstation --list-services</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 438: 行 438:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --zone=FedoraServer --list-services+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--zone=FedoraServer --list-services</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 448: 行 448:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-default-zone+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--get-default-zone</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 454: 行 454:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-active-zones+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--get-active-zones</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 463: 行 463:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --zone=FedoraServer --change-interface=enp8s0+<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--zone=FedoraServer --change-interface=enp8s0</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 469: 行 469:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-active-zones+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--get-active-zones</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 479: 行 479:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --list-services+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--list-services</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 503: 行 503:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --set-default-zone=FedoraServer+<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--set-default-zone=FedoraServer</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 509: 行 509:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-default-zone+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--get-default-zone</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 515: 行 515:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-active-zones+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--get-active-zones</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 528: 行 528:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --zone=FedoraServer --change-interface=wlp2s0+<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd </font> <font color="#A347BA">--zone=FedoraServer --change-interface=wlp2s0</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 534: 行 534:
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-active-zones+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd </font> <font color="#A347BA">--get-active-zones</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 545: 行 545:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-sudo firewall-cmd --list-services+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--list-services</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 555: 行 555:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-sudo firewall-cmd --list-ports+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd </font> <font color="#A347BA">--list-ports</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 565: 行 565:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --get-services+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd </font> <font color="#A347BA">--get-services</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 575: 行 575:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --permanent --add-service=ssh+<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--permanent --add-service=ssh</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 +success
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 584: 行 585:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --permanent --remove-service=ssh+<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--permanent --remove-service=ssh</font>
 </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>
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--permanent</font> <font color="#A347BA">--remove-service=</font><font color="#12488B"><b>{</b></font><font color="#A347BA">ssh,cockpit</font><font color="#12488B"><b>}</b></font>
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +success
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 593: 行 605:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --permanent --add-port=22022/tcp+<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--permanent --add-port=22022/tcp</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 +success
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 602: 行 615:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --permanent --remove-port=22022/tcp+<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--permanent --remove-port=22022/tcp</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 +success
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 611: 行 625:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --permanent --add-source=192.168.1.0/24+<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA"> --permanent --add-source=192.168.1.0/24</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 +success
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 621: 行 636:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --permanent --add-source=192.168.1.0/24 --zone=drop +<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--permanent --add-source=192.168.1.0/24 --zone=drop</font>
-$ sudo firewall-cmd --permanent --add-source=192.168.1.1 --zone=drop+
 </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>
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--permanent --add-source=192.168.1.1 --zone=drop</font>
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +success
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 631: 行 652:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --list-sources --zone=drop+<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--list-sources --zone=drop</font>
 192.168.1.0/24 192.168.1.1 192.168.1.0/24 192.168.1.1
 </pre></html></WRAP> </pre></html></WRAP>
行 641: 行 662:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --permanent --remove-source=192.168.1.0/24 --zone=drop +<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--permanent --remove-source=192.168.1.0/24 --zone=drop</font> 
-$ sudo firewall-cmd --permanent --remove-source=192.168.1.1 --zone=drop+<font color="#0087FF"><b>$</b></font> <font color="#26A269">sudo firewall-cmd</font> <font color="#A347BA">--permanent --remove-source=192.168.1.1 --zone=drop</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
行 651: 行 672:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ sudo firewall-cmd --reload+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--reload</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result><html><pre> <WRAP color_result><html><pre>
 +success
 </pre></html></WRAP> </pre></html></WRAP>
 </WRAP> </WRAP>
行 661: 行 683:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-cat /usr/lib/firewalld/services/ldap.xml+<font color="#0087FF"><b>$</b></font> <font color="#26A269">bat</font> <u style="text-decoration-style:solid">/usr/lib/firewalld/services/ldap.xml</u> 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +<font color="#444444">   1</font> <font color="#FFFFFF">&lt;?</font><font color="#F92672">xml</font><font color="#F8F8F2"> </font><font color="#A6E22E">version</font><font color="#F8F8F2">=</font><font color="#E6DB74">&quot;1.0&quot;</font><font color="#F8F8F2"> </font><font color="#A6E22E">encoding</font><font color="#F8F8F2">=</font><font color="#E6DB74">&quot;utf-8&quot;</font><font color="#FFFFFF">?&gt;</font> 
 +<font color="#444444">   2</font> <font color="#FFFFFF">&lt;</font><font color="#F92672">service</font><font color="#FFFFFF">&gt;</font> 
 +<font color="#444444">   3</font> <font color="#F8F8F2">  </font><font color="#FFFFFF">&lt;</font><font color="#F92672">short</font><font color="#FFFFFF">&gt;</font><font color="#F8F8F2">LDAP</font><font color="#FFFFFF">&lt;/</font><font color="#F92672">short</font><font color="#FFFFFF">&gt;</font> 
 +<font color="#444444">   4</font> <font color="#F8F8F2">  </font><font color="#FFFFFF">&lt;</font><font color="#F92672">description</font><font color="#FFFFFF">&gt;</font><font color="#F8F8F2">Lightweight Directory Access Protocol (LDAP) server</font><font color="#FFFFFF">&lt;/</font><font color="#F92672">description</font><font color="#FFFFFF">&gt;</font> 
 +<font color="#444444">   5</font> <font color="#F8F8F2">  </font><font color="#FFFFFF">&lt;</font><font color="#F92672">port</font><font color="#F8F8F2"> </font><font color="#A6E22E">protocol</font><font color="#F8F8F2">=</font><font color="#E6DB74">&quot;tcp&quot;</font><font color="#F8F8F2"> </font><font color="#A6E22E">port</font><font color="#F8F8F2">=</font><font color="#E6DB74">&quot;389&quot;</font><font color="#FFFFFF">/&gt;</font> 
 +<font color="#444444">   6</font> <font color="#FFFFFF">&lt;/</font><font color="#F92672">service</font><font color="#FFFFFF">&gt;</font>
 </pre></html></WRAP> </pre></html></WRAP>
-<WRAP color_result> 
-<code xml> 
-<?xml version="1.0" encoding="utf-8"?> 
-<service> 
-  <short>LDAP</short> 
-  <description>Lightweight Directory Access Protocol (LDAP) server</description> 
-  <port protocol="tcp" port="389"/> 
-</service> 
-</code></WRAP> 
 </WRAP> </WRAP>
  
行 677: 行 698:
 <WRAP color_term> <WRAP color_term>
 <WRAP color_command><html><pre> <WRAP color_command><html><pre>
-$ firewall-cmd --help+<font color="#0087FF"><b>$</b></font> <font color="#26A269">firewall-cmd</font> <font color="#A347BA">--help</font>
 </pre></html></WRAP> </pre></html></WRAP>
 <WRAP color_result_long><html><pre> <WRAP color_result_long><html><pre>
  • linux/commands/network/firewall-cmd.1663646603.txt.gz
  • 最終更新: 2022/09/20 13:03
  • by ともやん