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

ifconfig”命令用于配置GNU/Linux系统的网络接口。它显示网络接口卡的详细信息,包括IP地址,MAC地址,以及网络接口卡状态之类。但是,该命令已经过时了,而且在最小化版本的RHEL 7以及它的克隆版本CentOS 7,Oracle Linux 7和Scientific Linux 7中也找不到该命令。

在CentOS最小化服务器版本中如何查找网卡IP和其它详细信息?
1.要查看网卡细节
[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:89:6b:e9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.5.144/24 brd 192.168.5.255 scope global eno16777736
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe89:6be9/64 scope link 
       valid_lft forever preferred_lft forever
2.要查看网络接口统计数据
[root@localhost ~]# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000

    link/ether 00:0c:29:89:6b:e9 brd ff:ff:ff:ff:ff:ff

或者

[root@localhost ~]# ip -s link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    RX: bytes  packets  errors  dropped overrun mcast   
    3416       40       0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    3416       40       0       0       0       0       
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 00:0c:29:89:6b:e9 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    16878592   13481    0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    256530     3635     0       0       0       0   


在CentOS 7最小化服务器版本中如何启用并使用“ifconfig”命令?

[root@localhost ~]# yum provides ifconfig
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.aol.in
* extras: centos.aol.in
* updates: centos.aol.in
net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
Repo : @base
Matched from:
Filename : /usr/sbin/ifconfig

或者你也可以使用以下命令。
[root@localhost ~]# yum whatprovides ifconfig
这里,“provides”或者“whatprovides”开关用于找出某个包提供了某些功能或文件。
就像你在上面的输出中所看到的, net-tools包提供了ifconfig命令。因此,让我们安装net-tools包来使用ifconfig命令。
[root@localhost ~]# yum install net-tools
现在,你就可以像以往一样使用 ifconfig命令了
[root@localhost ~]# ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.5.144  netmask 255.255.255.0  broadcast 192.168.5.255
        inet6 fe80::20c:29ff:fe89:6be9  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:89:6b:e9  txqueuelen 1000  (Ethernet)
        RX packets 13512  bytes 16881300 (16.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3658  bytes 259216 (253.1 KiB)
        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 40  bytes 3416 (3.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 40  bytes 3416 (3.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


转自:https://linux.cn/article-3631-1.html


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值