歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> CentOS 7最小化安裝後找不到‘ifconfig’命令——修復小提示

CentOS 7最小化安裝後找不到‘ifconfig’命令——修復小提示

日期:2017/2/28 14:28:46   编辑:Linux教程

就像我們所知道的,“ifconfig”命令用於配置GNU/Linux系統的網絡接口。它顯示網絡接口卡的詳細信息,包括IP地址,MAC地址,以及網絡接口卡狀態之類。但是,該命令已經過時了,而且在最小化版本的RHEL 7以及它的克隆版本CentOS 7,Oracle Linux 7和Scientific Linux 7中也找不到該命令。

試試Linux下的ip命令,ifconfig已經過時了 http://www.linuxidc.com/Linux/2014-06/102670.htm

CentOS的ifconfig, route以及ip指令的實戰應用 http://www.linuxidc.com/Linux/2013-05/83956.htm

CentOS安裝後ifconfig 無法顯示網卡 http://www.linuxidc.com/Linux/2013-04/82573.htm

CentOS的ifconfig, route以及ip指令的實戰應用 http://www.linuxidc.com/Linux/2013-05/83956.htm

ifconfig: command not found http://www.linuxidc.com/Linux/2012-07/64703.htm

CentOS 6.2下ifconfig輸出網口和ip http://www.linuxidc.com/Linux/2012-06/63672.htm

在CentOS最小化服務器版本中如何查找網卡IP和其它詳細信息?

CentOS 7最小化系統,使用“ip addr”和“ip link”命令來查找網卡詳情。要知道統計數據,可以使用“ip -s link”。

要查看網卡細節,輸入以下命令:

  1. ip addr

輸出樣例:

  1. 1: lo:<LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
  2. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  3. inet 127.0.0.1/8 scope host lo
  4. inet6 ::1/128 scope host
  5. valid_lft forever preferred_lft forever
  6. 2: venet0:<BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
  7. link/void
  8. inet 127.0.0.1/32 scope host venet0
  9. inet 192.168.1.101/32 brd 192.168.1.101 scope global venet0:0

要查看網絡接口統計數據,輸入命令:

  1. ip link

輸出樣例:

  1. 1: lo:<LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT
  2. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  3. 2: venet0:<BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
  4. link/void

或者

  1. ip -s link

輸出樣例:

  1. 1: lo:<LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT
  2. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  3. RX: bytes packets errors dropped overrun mcast
  4. 000000
  5. TX: bytes packets errors dropped carrier collsns
  6. 000000
  7. 2: venet0:<BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
  8. link/void
  9. RX: bytes packets errors dropped overrun mcast
  10. 851566766670000
  11. TX: bytes packets errors dropped carrier collsns
  12. 30040342490000

在CentOS 7最小化服務器版本中如何啟用並使用“ifconfig”命令?

如果你不知道在哪裡可以找到ifconfig命令,請按照以下簡單的步驟來找到它。首先,讓我們找出哪個包提供了ifconfig命令。要完成這項任務,輸入以下命令:

  1. yum provides ifconfig

輸出樣例:

  1. Loaded plugins: fastestmirror
  2. Loading mirror speeds from cached hostfile
  3. *base: centos.aol.in
  4. * extras: centos.aol.in
  5. * updates: centos.aol.in
  6. net-tools-2.0-0.17.20131004git.el7.x86_64 :Basic networking tools
  7. Repo:@base
  8. Matchedfrom:
  9. Filename:/usr/sbin/ifconfig

或者你也可以使用以下命令。

  1. yum whatprovides ifconfig

這裡,“provides”或者“whatprovides”開關用於找出某個包提供了某些功能或文件。

就像你在上面的輸出中所看到的,net-tools包提供了ifconfig命令。因此,讓我們安裝net-tools包來使用ifconfig命令。

  1. yum install net-tools

現在,你就可以像以往一樣使用ifconfig命令了。

  1. ifconfig -a

輸出樣例:

  1. lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436
  2. inet 127.0.0.1 netmask 255.0.0.0
  3. inet6 ::1 prefixlen 128 scopeid 0x10<host>
  4. loop txqueuelen 0(LocalLoopback)
  5. RX packets 0 bytes 0(0.0 B)
  6. RX errors 0 dropped 0 overruns 0 frame 0
  7. TX packets 0 bytes 0(0.0 B)
  8. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  9. venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500
  10. inet 127.0.0.1 netmask 255.255.255.255 broadcast 0.0.0.0 destination 127.0.0.1
  11. unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0(UNSPEC)
  12. RX packets 7073 bytes 8549159(8.1MiB)
  13. RX errors 0 dropped 0 overruns 0 frame 0
  14. TX packets 4611 bytes 359201(350.7KiB)
  15. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
  16. venet0:0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500
  17. inet 192.168.1.101 netmask 255.255.255.255 broadcast 192.168.1.101 destination 192.168.1.101
  18. unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0(UNSPEC)

盡情享受吧!

更多CentOS相關信息見CentOS 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=14

Copyright © Linux教程網 All Rights Reserved