解決CentOS中ifconfig命令不顯示IP地址

來源:互聯網
上載者:User

解決CentOS中ifconfig命令不顯示IP地址

CentOS中ifconfig命令不顯示IP地址

[plain]view plaincopy
  1. $ifconfig
  2. bash:ifconfig:commandnotfound
環境:

非root使用者登入

[plain]view plaincopy
  1. $lsb_release-a
  2. LSBVersion::core-3.0-amd64:core-3.0-ia32:core-3.0-noarch:graphics-3.0-amd64:graphics-3.0-ia32:graphics-3.0-noarch
  3. DistributorID:CentOS
  4. Description:CentOSrelease4.3(Final)
  5. Release:4.3
  6. Codename:Final

解決:

[plain]view plaincopy
  1. $whereisifconfig
  2. ifconfig:/sbin/ifconfig.old/sbin/ifconfig/usr/share/man/man8/ifconfig.8.gz/usr/share/man/man8/ifconfig.8
[plain]view plaincopy
  1. $/sbin/ifconfig
  2. eth1Linkencap:EthernetHWaddrXXXXXXX
  3. inetaddr:XXXXXXXXXBcast:XXXXXXXXMask:255.255.255.128
  4. UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
  5. RXpackets:740194638errors:0dropped:398overruns:0frame:15
  6. TXpackets:1409116497errors:0dropped:0overruns:0carrier:0
  7. collisions:0txqueuelen:1000
  8. RXbytes:622505947542(579.7GiB)TXbytes:1299620061208(1.1TiB)
  9. Interrupt:36
  10. loLinkencap:LocalLoopback
  11. inetaddr:127.0.0.1Mask:255.0.0.0
  12. UPLOOPBACKRUNNINGMTU:16436Metric:1
  13. RXpackets:590278628errors:0dropped:0overruns:0frame:0
  14. TXpackets:590278628errors:0dropped:0overruns:0carrier:0
  15. collisions:0txqueuelen:0
  16. RXbytes:121711705636(113.3GiB)TXbytes:121711705636(113.3GiB)
解決二:

查看登入使用者的path:

[plain]view plaincopy
  1. $echo$PATH
path中沒有/sbin/ifconfig ,添加到path中:[plain]view plaincopy
  1. $exportPATH=$PATH:/sbin
再次執行:[plain]view plaincopy
  1. $ifconfig
  2. eth1Linkencap:EthernetHWaddrXXXXXXXXX
  3. inetaddr:XXXXXXXXBcast:XXXXXXXMask:255.255.255.128
  4. UPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1
  5. RXpackets:740213476errors:0dropped:398overruns:0frame:15
  6. TXpackets:1409138987errors:0dropped:0overruns:0carrier:0
  7. collisions:0txqueuelen:1000
  8. RXbytes:622508623742(579.7GiB)TXbytes:1299632841268(1.1TiB)
  9. Interrupt:36
  10. loLinkencap:LocalLoopback
  11. inetaddr:127.0.0.1Mask:255.0.0.0
  12. UPLOOPBACKRUNNINGMTU:16436Metric:1
  13. RXpackets:590326935errors:0dropped:0overruns:0frame:0
  14. TXpackets:590326935errors:0dropped:0overruns:0carrier:0
  15. collisions:0txqueuelen:0
  16. RXbytes:121723122294(113.3GiB)TXbytes:121723122294(113.3GiB)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.