在 CentOS 8/RHEL 8 上找不到 ifconfig 命令 – 快速修复

[ad_1]

如果配置 是一个命令行实用程序,用于查看连接到 Linux 机器的网络接口和分配给网络接口的 IP 地址、网络掩码等网络信息。
此外,它还显示发送和接收的网络数据包的计数以及错误和丢弃的数据包的计数。
你得到’如果配置在您的 RHEL 8 / CentOS 8 最小服务器安装中找不到命令?. RHEL 8 / CentOS 8 的最小安装不附带 ifconfig 命令.

-bash: ifconfig: command not found

本指南将帮助您 安装获取 ifconfig 命令所需的包.

安装 ifconfig 包

让我们看看哪个包为我们提供了使用 YUM 命令的 ifconfig 命令。

# yum whatprovides ifconfig

示例输出:

CentOS-8 - AppStream                                     1.1 MB/s | 6.3 MB     00:05
CentOS-8 - Base                                          954 kB/s | 7.9 MB     00:08
CentOS-8 - Extras                                        569  B/s | 2.1 kB     00:03
Extra Packages for Enterprise Linux 8 - x86_64           617 kB/s | 3.2 MB     00:05
net-tools-2.0-0.51.20160912git.el8.i686 : Basic networking tools
Repo        : BaseOS
Matched from:
Filename    : /usr/sbin/ifconfig

net-tools-2.0-0.51.20160912git.el8.x86_64 : Basic networking tools
Repo        : BaseOS
Matched from:
Filename    : /usr/sbin/ifconfig

从上面的命令可以看出 网络工具包 为您提供 ifconfig 命令. 现在, 安装网络工具包 使用 yum 命令。

# yum -y install net-tools

示例输出:

Last metadata expiration check: 0:00:51 ago on Sun 22 Dec 2019 09:07:03 AM EST.
Dependencies resolved.
=========================================================================================
 Package           Arch           Version                           Repository      Size
=========================================================================================
Installing:
 net-tools         x86_64         2.0-0.51.20160912git.el8          BaseOS         323 k

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

Total download size: 323 k
Installed size: 1.0 M
Downloading Packages:
net-tools-2.0-0.51.20160912git.el8.x86_64.rpm            264 kB/s | 323 kB     00:01
-----------------------------------------------------------------------------------------
Total                                                    148 kB/s | 323 kB     00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                 1/1
  Installing       : net-tools-2.0-0.51.20160912git.el8.x86_64                       1/1
  Running scriptlet: net-tools-2.0-0.51.20160912git.el8.x86_64                       1/1
  Verifying        : net-tools-2.0-0.51.20160912git.el8.x86_64                       1/1

Installed:
  net-tools-2.0-0.51.20160912git.el8.x86_64

Complete!

安装完成后,运行ifconfig查看是否可用。

# ifconfig

结论

就这样。 您现在拥有 在 CentOS 8 / RHEL 8 机器上可用的 ifconfig 命令. 如果您有任何问题或反馈,请在下面的评论部分与我们分享。

[ad_2]

Related Posts