ifconfig无输出的解决办法

简介:
问题

执行 ifconfig 命令无任何报错,也无任何输出信息

[root@linuxprobe ~]#  ifconfig
[root@linuxprobe ~]#
排错
1. 检查PATH变量
[root@linuxprobe ~]# echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/root/bin

若路径 /sbin 不在PATH变量中,执行以下命令将其加入。

export PATH=$PATH:/sbin

注:此例中 PATH 变量正常

2. 检查 /sbin/ifconfig

通常情况下,ifconfig 如果有显示,但没有某一项的信息(比如识别不到网卡)时,可以先检查 /etc/sysconfig/network-scripts/ 下配置文件是否正确。 但此例中由于执行 ifconfig 及 /sbin/ifconfig 没有任何的输出,因此先检查了下 /sbin/ifconfig 文件。发现有以下错误:

[root@linuxprobe ~]# ls -la /sbin/ifconfig
-rwxr-xr-x 1 root root 0 Apr  5 14:56 /sbin/ifconfig
[root@linuxprobe ~]# file /sbin/ifconfig
/sbin/ifconfig: empty
3. 解决方法

从局域网另一台机器上使用 scp 命令 copy 了一份 /sbin/ifconfig 到这台机器上

[root@yezi ~]#  scp /sbin/ifconfig root@192.168.10.10:/sbin
The authenticity of host '192.168.10.10 (192.168.10.10)' can't be established.
ECDSA key fingerprint is b2:e4:20:20:ae:ae:2e:20:ce:49:76:05:bd:c4:42:39.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.10' (ECDSA) to the list of known hosts.
root@192.168.10.10's password: 
ifconfig                                      100%   80KB  80.1KB/s   00:00  

再执行 ifconfig , 可以正常显示了

[root@linuxprobe ~]# file /sbin/ifconfig
/sbin/ifconfig: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0x64131021c4fd2c38cf37a9ed9a20bdc52e9bdf33, stripped
[root@linuxprobe ~]#  ls -al /sbin/ifconfig
-rwxr-xr-x. 1 root root 81976 Feb 14  2014 /sbin/ifconfig
[root@linuxprobe ~]# ifconfig
eno16777736: flags=4163  mtu 1500
        inet 192.168.10.10  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::20c:29ff:fe97:5c27  prefixlen 64  scopeid 0x20
        ether 00:0c:29:97:5c:27  txqueuelen 1000  (Ethernet)
        RX packets 153  bytes 16477 (16.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 166  bytes 144357 (140.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 0  (Local Loopback)
        RX packets 1431  bytes 114546 (111.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1431  bytes 114546 (111.8 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


 



相关文章
|
19天前
|
网络协议 Windows 网络架构
ipconfig all 命令行输出结果的解读
ipconfig all 命令行输出结果的解读
10 0
|
8月前
Ping 命令配置 -c、-i、-w 指令使用
Ping 命令配置 -c、-i、-w 指令使用
104 0
|
4月前
|
存储 Shell Perl
使用shell脚本从ifconfig命令结果中提取IP地址
使用shell脚本从ifconfig命令结果中提取IP地址
64 0
成功解决dos内的输入ipconfig出现错误:不是内部或外部命令……
成功解决dos内的输入ipconfig出现错误:不是内部或外部命令……
|
Linux 云计算
Linux输入dhclient ens33后出现HOSTNAME命令未找到的解决方案
博主配置了一些云计算集群的环境 在机器上配置了免密登录以及主机名和ip地址的映射 其中有一台机器的主机名是master315 但是在输入吗,命令dhclient ens33后出现了这样的问题:
340 0
Linux输入dhclient ens33后出现HOSTNAME命令未找到的解决方案
|
网络协议 Linux
Linux命令参数详细解析-ping
概要 ping [-aAbBdDfhLnOqrRUvV] [-c count] [-F flowlabel] [-i interval] [-I inter‐ face] [-l preload] [-m mark] [-M pmtudisc_op...
1580 0
|
监控 网络协议 Unix
ping 命令的 7 大用法,看完秒变大牛!
ping 命令的 7 大用法,看完秒变大牛!
215 0
ping 命令的 7 大用法,看完秒变大牛!
|
Perl Shell Linux
系统无ifconfig,一条命令获取本机ip并将其赋值给指定变量来使用
在Linux系统中,准确地获取本机IP信息是非常有用的。在写bash shell脚本事经常会用到IP,这时就需要我们使用一些办法获取本机IP并赋值给变量来使用。
1882 0