解决在centos7用不了命令ifconfig的方法

优质老薛主机推荐:15%终身付款折扣:xwseo15 25%首次付款折扣 : xwseo115 点击下图进入购买

相信大家在使用centos7的时候会出现ifconfig使用不了的方法,这个是因为在centos7变为用ip addr来查看ip地址,在centos6的时候命令是ifconfig那么centos用习惯了ifconfig命令的时候,我们如何解决centos7的问题呢?

我们看下,以下是解决案例:

-bash: ifconfig: command not found

解决方法:

运行命令:yum install net-tools -y 直接运行本命令即可解决。

[root@localhost ~]# ifconfig
-bash: ifconfig: command not found
[root@localhost ~]# yum install net-tools
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
updates/7/x86_64/primary_db | 6.0 MB 00:00:07
Loading mirror speeds from cached hostfile
* base: mirrors.nwsuaf.edu.cn
* extras: mirrors.nwsuaf.edu.cn
* updates: mirrors.nwsuaf.edu.cn
Resolving Dependencies
–> Running transaction check
—> Package net-tools.x86_64 0:2.0-0.22.20131004git.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================
Installing:
net-tools x86_64 2.0-0.22.20131004git.el7 base 305 k

Transaction Summary
=======================================================================================================================
Install 1 Package

Total download size: 305 k
Installed size: 917 k
Is this ok [y/d/N]: y
Downloading packages:
net-tools-2.0-0.22.20131004git.el7.x86_64.rpm | 305 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : net-tools-2.0-0.22.20131004git.el7.x86_64 1/1
Verifying : net-tools-2.0-0.22.20131004git.el7.x86_64 1/1

Installed:
net-tools.x86_64 0:2.0-0.22.20131004git.el7

Complete!
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.100.29 netmask 255.255.255.0 broadcast 192.168.100.255
inet6 fe80::9bcf:d0ee:5f4:3343 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:06:28:1c txqueuelen 1000 (Ethernet)
RX packets 79200 bytes 11564511 (11.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3170 bytes 373772 (365.0 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 1 (Local Loopback)
RX packets 68 bytes 5916 (5.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68 bytes 5916 (5.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[root@localhost ~]#

赞 (0)
分享到:更多 ()