CentOS-7 没ifconfig命令的解决方法

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/zz657114506/article/details/53554228
  • 执行 ifconfig
[root@slave ~]# ifconfig
-bash: ifconfig: command not found

[root@slave ~]# which ifconfig
/usr/bin/which: no ifconfig in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
  • yum 安装ifconfig
[root@slave ~]# yum search ifconfig
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.nwsuaf.edu.cn
 * extras: mirrors.btte.net
 * updates: mirrors.nwsuaf.edu.cn
========================================================== Matched: ifconfig ==========================================================
net-tools.x86_64 : Basic networking tools
  • ifconfig这个命令是在net-tools.x86_64
[root@slave ~]# yum install net-tools.x86_64
  • 检测ifconfig
[root@slave ~]# ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.175.134  netmask 255.255.255.0  broadcast 192.168.175.255
        inet6 fe80::20c:29ff:fec1:247d  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:c1:24:7d  txqueuelen 1000  (Ethernet)
        RX packets 43856  bytes 61461634 (58.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 22750  bytes 1414117 (1.3 MiB)
        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

[root@slave ~]# which ifconfig
/usr/sbin/ifconfig
展开阅读全文

linux ifconfig 命令的疑问

04-23

PID USER VSZ STAT COMMANDrn 1 root 2144 S init rn 2 root 0 SW< [kthreadd]rn 3 root 0 SW< [migration/0]rn 4 root 0 SW< [ksoftirqd/0]rn 5 root 0 SW< [migration/2]rn 6 root 0 SW< [ksoftirqd/2]rn 7 root 0 SW< [events/0]rn 8 root 0 SW< [events/2]rn 9 root 0 SW< [khelper]rn 77 root 0 SW< [kblockd/0]rn 78 root 0 SW< [kblockd/2]rn 86 root 0 SW< [ata/0]rn 87 root 0 SW< [ata/2]rn 88 root 0 SW< [ata_aux]rn 97 root 0 SW< [khubd]rn 119 root 0 SW [pdflush]rn 120 root 0 SW [pdflush]rn 121 root 0 SW< [kswapd0]rn 168 root 0 SW< [aio/0]rn 169 root 0 SW< [aio/2]rn 179 root 0 SW< [cifsoplockd]rn 180 root 0 SW< [cifsdnotifyd]rn 188 root 0 SW [kcdfsd]rn 848 root 0 SW< [zd1211rw]rn 860 root 0 SW< [scsi_eh_0]rn 901 root 0 SW< [scsi_eh_1]rn 902 root 0 SW< [usb-storage]rn 929 root 0 SW< [mtdblockd]rn 956 root 0 SW< [kmmcd]rn 961 root 0 SW< [c2sd]rn 980 root 0 SW< [rpciod/0]rn 981 root 0 SW< [rpciod/2]rn 987 root 0 SW< [yaffs-bg-1]rn 988 root 0 SW< [yaffs-bg-1]rn 989 root 0 SW< [yaffs-bg-1]rn 1110 root 2160 S udhcpc -n --script=/sdroot/sbin/udhcpc.script rn 1117 root 3680 S /sdroot/usr/sbin/dropbear rn 1119 root 2160 S -/bin/sh rn 1139 root 0 SW< [galcore daemon ]rn 1154 root 2800 S //bin/dbus-daemon --fork --print-pid 4 --print-addresrn 1163 root 1792 S ./lircd rn 1205 root 2144 R ps rn~ # ping 10.128.119.1rnPING 10.128.119.1 (10.128.119.1): 56 data bytesrn64 bytes from 10.128.119.1: seq=0 ttl=255 time=9.576 msrn64 bytes from 10.128.119.1: seq=1 ttl=255 time=0.771 msrn64 bytes from 10.128.119.1: seq=2 ttl=255 time=0.768 msrn64 bytes from 10.128.119.1: seq=3 ttl=255 time=0.758 msrn64 bytes from 10.128.119.1: seq=4 ttl=255 time=0.765 msrnrn--- 10.128.119.1 ping statistics ---rn5 packets transmitted, 5 packets received, 0% packet lossrnround-trip min/avg/max = 0.758/2.527/9.576 msrn~ # ifconfig eth0 downrn~ # ping 10.128.119.1rnPING 10.128.119.1 (10.128.119.1): 56 data bytesrnping: sendto: Network is unreachablern~ # ifconfig eth0 up rn~ # ping 10.128.119.1rnPING 10.128.119.1 (10.128.119.1): 56 data bytesrn64 bytes from 10.128.119.1: seq=0 ttl=255 time=22.469 msrn64 bytes from 10.128.119.1: seq=1 ttl=255 time=0.826 msrn64 bytes from 10.128.119.1: seq=2 ttl=255 time=0.774 msrnrn--- 10.128.119.1 ping statistics ---rn3 packets transmitted, 3 packets received, 0% packet lossrnround-trip min/avg/max = 0.774/8.023/22.469 msrn~ # ifconfig eth0 10.128.119.123rn~ # ifconfig eth0 downrn~ # ifconfig eth0 uprn[color=#FF0000]Segmentation fault[/color]~ # 】rnrn1、如上为什么 这样就段错误,系统死机了。rnrn2、还有请问下,设备首先通过DHCP 获取了IP, 这个时候 可以ping 通外面的设备。 但是如果我通过ifconfig 来指定设备IP 后,就无法ping 通别的设备了?rnrn3、再此的使用UDHCPC ,来获取地址 成功。但是ifconfig 来查看的时候,地址没有变成获取的地址?rnrn 论坛

没有更多推荐了,返回首页