CentOS 7 - -bash: ifconfig: command not found

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2023
Перейти к:навигация, поиск
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Самые выгодные сервера в рунете


CentOS 7 - -bash: ifconfig: command not found

# uname -a
Linux 15180.server.net 2.6.32-042stab113.11 #1 SMP Fri Dec 18 17:32:04 MSK 2015 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

В шаблон CentOS-7-minimal не входит утилита ifconfig и возникает ошибка при просмотре интерфейсов:

# ifconfig
-bash: ifconfig: command not found


Решение - это доустановить пакет net-tools, которой не добавлен в дистрибутив CentOS-7-minimal:

# yum provides ifconfig
Loaded plugins: fastestmirror
base                                                                                                                          | 3.6 kB  00:00:00
extras                                                                                                                        | 3.4 kB  00:00:00
updates                                                                                                                       | 3.4 kB  00:00:00
(1/4): base/7/x86_64/group_gz                                                                                                 | 155 kB  00:00:00
(2/4): extras/7/x86_64/primary_db                                                                                             | 117 kB  00:00:00
(3/4): updates/7/x86_64/primary_db                                                                                            | 4.1 MB  00:00:00
(4/4): base/7/x86_64/primary_db                                                                                               | 5.3 MB  00:00:10
Determining fastest mirrors
* base: centos.quelquesmots.fr
* extras: centos.crazyfrogs.org
* updates: centos.quelquesmots.fr
base/7/x86_64/filelists_db                                                                                                    | 6.2 MB  00:00:00
extras/7/x86_64/filelists_db                                                                                                  | 296 kB  00:00:00
updates/7/x86_64/filelists_db                                                                                                 | 2.5 MB  00:00:00
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
Repo        : base
Matched from:
Filename    : /sbin/ifconfig


# yum whatprovides ifconfig
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.quelquesmots.fr
* extras: centos.crazyfrogs.org
* updates: centos.quelquesmots.fr
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
Repo        : base
Matched from:
Filename    : /sbin/ifconfig

Установка net-tools:

# yum install net-tools -y


Также заменить комнаду ifconfig можно штатной утилитой ip командой:

# 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
   inet6 ::1/128 scope host
      valid_lft forever preferred_lft forever
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
   link/void
   inet 127.0.0.1/32 scope host venet0
   inet 11.11.11.11/32 brd 151.80.164.34 scope global venet0:0