CentOs 7最小安装版–没有ifconfig命令

avatar 2019年9月4日15:58:20 评论 1,081 次浏览

首先查看一下命令,确定一下命令是否存在:

#ifconfig
-bash: /usr/sbin/ifconfig: 没有那个文件或目录

可以通过运行yum install ifconfig 来确定安装ifconfig所依赖的包net-tools.x86_64。

#yum search ifconfig
已加载插件:fastestmirror
base                                                                                                                   | 3.6 kB  00:00:00     
extras                                                                                                                 | 3.4 kB  00:00:00     
http://mirrors.aliyun.com/centos/7.6.1810/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.aliyun.com; 未知的名称或服务"
正在尝试其它镜像。
updates                                                                                                                | 3.4 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                                                                          | 166 kB  00:00:00     
(2/4): extras/7/x86_64/primary_db                                                                                      | 200 kB  00:00:01     
(3/4): updates/7/x86_64/primary_db                                                                                     | 5.0 MB  00:00:03     
(4/4): base/7/x86_64/primary_db                                                                                        | 6.0 MB  00:02:33     
Determining fastest mirrors
 * base: mirror.jdcloud.com
 * extras: mirror.jdcloud.com
 * updates: mirror.jdcloud.com
=============================================================== 匹配:ifconfig ===============================================================
net-tools.x86_64 : Basic networking tools

找到依赖包后就可以安装以来包了,可以直接安装

#yum -y install net-tools.x86_64

#yum -y install net-tools

验证一下:

#ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.211.55.20  netmask 255.255.255.0  broadcast 10.211.55.255
        inet6 fe80::21c:42ff:fe90:ec47  prefixlen 64  scopeid 0x20<link>
        inet6 fdb2:2c26:f4e4:0:21c:42ff:fe90:ec47  prefixlen 64  scopeid 0x0<global>
        ether 00:1c:42:90:ec:47  txqueuelen 1000  (Ethernet)
        RX packets 9336  bytes 12786268 (12.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5305  bytes 365031 (356.4 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

 

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: