GNU/Linux >> Tutoriels Linux >  >> Cent OS

"firewall-cmd:commande introuvable" sur CentOS 8 [Résolu]

Récemment, j'ai démarré une machine virtuelle CentOS 8 sur ma configuration OpenStack. Lors de la tentative de configuration des règles de pare-feu à l'aide de firewall-cmd, l'erreur "firewall-cmd :command not found s'est produite. “. Ci-dessous l'erreur complète :

# firewall-cmd
bash: firewall-cmd: command not found
Commande Firewall-cmd

Firewall-cmd est une CLI du package firewalld pour gérer dynamiquement le pare-feu.

Comment réparer firewall-cmd :commande introuvable sur CentOS 8

Pour résoudre l'erreur ci-dessus, découvrons quel est le package correspondant qui fournit le firewall-cmd commande.

# dnf whatprovides firewall-cmd
Last metadata expiration check: 2:52:34 ago on Fri 11 Feb 2022 12:26:20 PM IST.

firewalld-0.9.3-11.el8.noarch : A firewall daemon with D-Bus interface providing a dynamic firewall
Repo : baseos
Matched from:
Filename : /usr/bin/firewall-cmd

D'après la commande ci-dessus, il est clair que le package firewalld fournit le firewall-cmd commande qui provient du référentiel BaseOS.

Comment installer firewalld sur CentOS 8

Installons le firewalld package

# dnf in firewalld -y
Last metadata expiration check: 2:55:27 ago on Fri 11 Feb 2022 12:26:20 PM IST.
Dependencies resolved.
=============================================================================================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================================================================================
Installing:
firewalld noarch 0.9.3-11.el8 baseos 503 k
Installing dependencies:
firewalld-filesystem noarch 0.9.3-11.el8 baseos 78 k
ipset x86_64 7.1-1.el8 baseos 45 k
ipset-libs x86_64 7.1-1.el8 baseos 71 k
iptables x86_64 1.8.4-22.el8 baseos 584 k
iptables-ebtables x86_64 1.8.4-22.el8 baseos 72 k
libnetfilter_conntrack x86_64 1.0.6-5.el8 baseos 65 k
libnfnetlink x86_64 1.0.1-13.el8 baseos 33 k
libnftnl x86_64 1.1.5-5.el8 baseos 83 k
nftables x86_64 1:0.9.3-24.el8 baseos 323 k
python3-firewall noarch 0.9.3-11.el8 baseos 433 k
python3-nftables x86_64 1:0.9.3-24.el8 baseos 29 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install 12 Packages

Total download size: 2.3 M
Installed size: 7.4 M
Downloading Packages:
(1/12): ipset-7.1-1.el8.x86_64.rpm                                                                                                                                                                           8.6 kB/s |  45 kB     00:05
(2/12): firewalld-filesystem-0.9.3-11.el8.noarch.rpm                                                                                                                                                          14 kB/s |  78 kB     00:05
(3/12): ipset-libs-7.1-1.el8.x86_64.rpm                                                                                                                                                                      570 kB/s |  71 kB     00:00
(4/12): iptables-ebtables-1.8.4-22.el8.x86_64.rpm                                                                                                                                                            1.0 MB/s |  72 kB     00:00
(5/12): firewalld-0.9.3-11.el8.noarch.rpm                                                                                                                                                                     90 kB/s | 503 kB     00:05
(6/12): iptables-1.8.4-22.el8.x86_64.rpm                                                                                                                                                                     2.1 MB/s | 584 kB     00:00
(7/12): libnfnetlink-1.0.1-13.el8.x86_64.rpm                                                                                                                                                                 487 kB/s |  33 kB     00:00
(8/12): libnftnl-1.1.5-5.el8.x86_64.rpm                                                                                                                                                                      1.6 MB/s |  83 kB     00:00
(9/12): python3-firewall-0.9.3-11.el8.noarch.rpm                                                                                                                                                             6.8 MB/s | 433 kB     00:00
(10/12): libnetfilter_conntrack-1.0.6-5.el8.x86_64.rpm                                                                                                                                                       203 kB/s |  65 kB     00:00
(11/12): python3-nftables-0.9.3-24.el8.x86_64.rpm                                                                                                                                                            594 kB/s |  29 kB     00:00
(12/12): nftables-0.9.3-24.el8.x86_64.rpm                                                                                                                                                                    2.1 MB/s | 323 kB     00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                        203 kB/s | 2.3 MB     00:11
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                     1/1
  Installing       : libnftnl-1.1.5-5.el8.x86_64                                                                                                                                                                                        1/12
  Running scriptlet: libnftnl-1.1.5-5.el8.x86_64                                                                                                                                                                                        1/12
  Installing       : libnfnetlink-1.0.1-13.el8.x86_64                                                                                                                                                                                   2/12
  Running scriptlet: libnfnetlink-1.0.1-13.el8.x86_64                                                                                                                                                                                   2/12
  Installing       : libnetfilter_conntrack-1.0.6-5.el8.x86_64                                                                                                                                                                          3/12
  Running scriptlet: libnetfilter_conntrack-1.0.6-5.el8.x86_64                                                                                                                                                                          3/12
  Running scriptlet: iptables-1.8.4-22.el8.x86_64                                                                                                                                                                                       4/12
  Installing       : iptables-1.8.4-22.el8.x86_64                                                                                                                                                                                       4/12
  Running scriptlet: iptables-1.8.4-22.el8.x86_64                                                                                                                                                                                       4/12
  Installing       : iptables-ebtables-1.8.4-22.el8.x86_64                                                                                                                                                                              5/12
  Running scriptlet: iptables-ebtables-1.8.4-22.el8.x86_64                                                                                                                                                                              5/12
  Installing       : nftables-1:0.9.3-24.el8.x86_64                                                                                                                                                                                     6/12
  Running scriptlet: nftables-1:0.9.3-24.el8.x86_64                                                                                                                                                                                     6/12
  Installing       : python3-nftables-1:0.9.3-24.el8.x86_64                                                                                                                                                                             7/12
  Installing       : python3-firewall-0.9.3-11.el8.noarch                                                                                                                                                                               8/12
  Installing       : ipset-libs-7.1-1.el8.x86_64                                                                                                                                                                                        9/12
  Running scriptlet: ipset-libs-7.1-1.el8.x86_64                                                                                                                                                                                        9/12
  Installing       : ipset-7.1-1.el8.x86_64                                                                                                                                                                                            10/12
  Installing       : firewalld-filesystem-0.9.3-11.el8.noarch                                                                                                                                                                          11/12
  Installing       : firewalld-0.9.3-11.el8.noarch                                                                                                                                                                                     12/12
  Running scriptlet: firewalld-0.9.3-11.el8.noarch                                                                                                                                                                                     12/12
  Verifying        : firewalld-0.9.3-11.el8.noarch                                                                                                                                                                                      1/12
  Verifying        : firewalld-filesystem-0.9.3-11.el8.noarch                                                                                                                                                                           2/12
  Verifying        : ipset-7.1-1.el8.x86_64                                                                                                                                                                                             3/12
  Verifying        : ipset-libs-7.1-1.el8.x86_64                                                                                                                                                                                        4/12
  Verifying        : iptables-1.8.4-22.el8.x86_64                                                                                                                                                                                       5/12
  Verifying        : iptables-ebtables-1.8.4-22.el8.x86_64                                                                                                                                                                              6/12
  Verifying        : libnetfilter_conntrack-1.0.6-5.el8.x86_64                                                                                                                                                                          7/12
  Verifying        : libnfnetlink-1.0.1-13.el8.x86_64                                                                                                                                                                                   8/12
  Verifying        : libnftnl-1.1.5-5.el8.x86_64                                                                                                                                                                                        9/12
  Verifying        : nftables-1:0.9.3-24.el8.x86_64                                                                                                                                                                                    10/12
  Verifying        : python3-firewall-0.9.3-11.el8.noarch                                                                                                                                                                              11/12
  Verifying        : python3-nftables-1:0.9.3-24.el8.x86_64                                                                                                                                                                            12/12

Installed:
  firewalld-0.9.3-11.el8.noarch                firewalld-filesystem-0.9.3-11.el8.noarch    ipset-7.1-1.el8.x86_64         ipset-libs-7.1-1.el8.x86_64       iptables-1.8.4-22.el8.x86_64            iptables-ebtables-1.8.4-22.el8.x86_64
  libnetfilter_conntrack-1.0.6-5.el8.x86_64    libnfnetlink-1.0.1-13.el8.x86_64            libnftnl-1.1.5-5.el8.x86_64    nftables-1:0.9.3-24.el8.x86_64    python3-firewall-0.9.3-11.el8.noarch    python3-nftables-1:0.9.3-24.el8.x86_64

Complete!

Démarrer firewalld et activez-le pour qu'il démarre automatiquement au démarrage du système.

# systemctl start firewalld

# systemctl enable firewalld

Vérifiez l'état du pare-feu en cours d'exécution.

# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-02-11 15:23:58 IST; 43s ago
Docs: man:firewalld(1)
Main PID: 99066 (firewalld)
Tasks: 2 (limit: 23558)
Memory: 23.8M
CGroup: /system.slice/firewalld.service
└─99066 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid

Feb 11 15:23:57 centos8.local systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 11 15:23:58 centos8.local systemd[1]: Started firewalld - dynamic firewall daemon.

Vous pouvez maintenant exécuter le firewall-cmd pour configurer les règles.

# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
# firewall-cmd --reload
success

Cent OS
  1. Commande ifconfig introuvable – CentOS/RHEL 7

  2. "lsb_release :commande introuvable" – Correction dans CentOS/RHEL

  3. id :commande introuvable

  4. w :commande introuvable

  5. df :commande introuvable

Commande semanage introuvable dans CentOS 7/6 et RHEL 7/6 - Solution rapide

Commande netstat introuvable sur CentOS 8 / RHEL 8 - Solution rapide

Commande ifconfig introuvable sur CentOS 8 / RHEL 8 - Solution rapide

Installation minimale de CentOS7 :"Ifconfig" :Commande introuvable [Résolu]

Commande ifconfig introuvable sur l'installation minimale de CentOS 7

Comment réparer la commande Ifconfig introuvable sur CentOS 7