CentOS 7最小化安装后找不到‘ifconfig’命令——修复小提示


就像我们所知道的,“ifconfig”命令用于配置GNU/Linux系统的网络接口。它显示网络接口卡的详细信息,包括IP地址,MAC地址,以及网络接口卡状态之类。但是,该命令已经过时了,而且在最小化版本的RHEL 7以及它的克隆版本CentOS7,OracleLinux 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 foundhttp://www.linuxidc.com/Linux/2012-07/64703.htm

CentOS 6.2下ifconfig输出网口和iphttp://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>mtu16436qdisc noqueue state UNKNOWN
  2. link/loopback00:00:00:00:00:00brd00:00:00:00:00:00
  3. inet127.0.0.1/8scope host lo
  4. inet6::1/128scope host
  5. valid_lft forever preferred_lft forever
  6. 2:venet0:<BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP>mtu1500qdisc noqueue state UNKNOWN
  7. link/void
  8. inet127.0.0.1/32scope host venet0
  9. inet192.168.1.101/32brd192.168.1.101scopeglobalvenet0:0

要查看网络接口统计数据,输入命令:

  1. ip link

输出样例:

  1. 1:lo:<LOOPBACK,UP,LOWER_UP>mtu16436qdisc noqueue state UNKNOWN mode DEFAULT
  2. link/loopback00:00:00:00:00:00brd00:00:00:00:00:00
  3. 2:venet0:<BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP>mtu1500qdisc noqueue state UNKNOWN mode DEFAULT
  4. link/void

或者

  1. ip-s link

输出样例:

  1. 1:lo:<LOOPBACK,UP,LOWER_UP>mtu16436qdisc noqueue state UNKNOWN mode DEFAULT
  2. link/loopback00:00:00:00:00:00brd00: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>mtu1500qdisc 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. Loadedplugins:fastestmirror
  2. Loadingmirror speedsfromcached 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:Basicnetworking 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>mtu16436
  2. inet127.0.0.1netmask255.0.0.0
  3. inet6::1prefixlen128scopeid0x10<host>
  4. loop txqueuelen0(LocalLoopback)
  5. RX packets0bytes0(0.0B)
  6. RX errors0dropped0overruns0frame0
  7. TX packets0bytes0(0.0B)
  8. TX errors0dropped0overruns0carrier0collisions0
  9. venet0:flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>mtu1500
  10. inet127.0.0.1netmask255.255.255.255broadcast0.0.0.0destination127.0.0.1
  11. unspec00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00txqueuelen0(UNSPEC)
  12. RX packets7073bytes8549159(8.1MiB)
  13. RX errors0dropped0overruns0frame0
  14. TX packets4611bytes359201(350.7KiB)
  15. TX errors0dropped0overruns0carrier0collisions0
  16. venet0:0:flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP>mtu1500
  17. inet192.168.1.101netmask255.255.255.255broadcast192.168.1.101destination192.168.1.101
  18. unspec00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00txqueuelen0(UNSPEC)

尽情享受吧!

优质内容筛选与推荐>>
1、第10组Alpha冲刺(2/4)
2、18 COUNTIF函数
3、项目管理-自上而下还是自下而上的沟通?
4、python 批量下载图片
5、Image控件与ImageBrush比较及动态改变图片路径


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号





    联系我们

    欢迎来到TinyMind。

    关于TinyMind的内容或商务合作、网站建议,举报不良信息等均可联系我们。

    TinyMind客服邮箱:support@tinymind.net.cn