Comment regler -bash: ifconfig: command not found dans Centos 7

Si vous avez installé CentOS 7 minimal, vous pourriez voir message d’erreur si vous essayez d’utiliser ifconfig pour voir votre adresse IP:

[root@localhost ~]# ifconfig
-bash: ifconfig: command not found

Si vous cherchez l’exécutable, il est dans le paquet net-tools

[root@localhost ~]# yum search ifconfig
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.iweb.ca
 * extras: mirror.csclub.uwaterloo.ca
 * updates: mirror.csclub.uwaterloo.ca
=================================================================== Matched: ifconfig ====================================================================
net-tools.x86_64 : Basic networking tools

Au cas où vous ne voulez pas installer le paquet supplémentaire et simplement de voir votre adresse IP, vous pouvez utiliser la commande ip addr

[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:eb:6b:89 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.15/24 brd 10.0.0.255 scope global dynamic enp0s3
       valid_lft 85578sec preferred_lft 85578sec
    inet6 fe80::a00:27ff:feeb:6b89/64 scope link
       valid_lft forever preferred_lft forever

Pour installer ifconfig

[root@localhost ~]# yum install net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.iweb.ca
 * extras: mirror.csclub.uwaterloo.ca
 * updates: mirror.csclub.uwaterloo.ca
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================
 Package                            Arch                            Version                                           Repository                     Size
==========================================================================================================================================================
Installing:
 net-tools                          x86_64                          2.0-0.17.20131004git.el7                          base                          304 k

Transaction Summary
==========================================================================================================================================================
Install  1 Package

Total download size: 304 k
Installed size: 917 k
Is this ok [y/d/N]: y
Downloading packages:
net-tools-2.0-0.17.20131004git.el7.x86_64.rpm                                                                                      | 304 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                                              1/1
  Verifying  : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                                              1/1

Installed:
  net-tools.x86_64 0:2.0-0.17.20131004git.el7

Complete!

et puis vous pouvez l’utiliser

[root@localhost ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::a00:27ff:feeb:6b89  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:eb:6b:89  txqueuelen 1000  (Ethernet)
        RX packets 11316  bytes 14098176 (13.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3224  bytes 264337 (258.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Si vous avez trouvé une faute d’orthographe, veuillez nous en informer en sélectionnant le texte en question et en appuyant sur Ctrl + Entrée .

Laisser un commentaire

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.