如果你不知道在哪里可以找到ifconfig命令,请按照以下简单的步骤来找到它。首先,让我们找出哪个包提供了ifconfig命令。要完成这项任务,输入以下命令:
- 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
或者你也可以使用以下命令。
- yum whatprovides ifconfig
这里,“provides”或者“whatprovides”开关用于找出某个包提供了某些功能或文件。
就像你在上面的输出中所看到的,net-tools包提供了ifconfig命令。因此,让我们安装net-tools包来使用ifconfig命令。
- yum install net-tools
现在,你就可以像以往一样使用ifconfig命令了。
- ifconfig -a
输出样例:
- lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436
- inet 127.0.0.1 netmask 255.0.0.0
- inet6 ::1 prefixlen 128 scopeid 0x10<host>
- loop txqueuelen 0 (Local Loopback)
- RX packets 0 bytes 0 (0.0 B)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 0 bytes 0 (0.0 B)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500
- inet 127.0.0.1 netmask 255.255.255.255 broadcast 0.0.0.0 destination 127.0.0.1
- unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0 (UNSPEC)
- RX packets 7073 bytes 8549159 (8.1 MiB)
- RX errors 0 dropped 0 overruns 0 frame 0
- TX packets 4611 bytes 359201 (350.7 KiB)
- TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- venet0:0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500
- inet 192.168.1.101 netmask 255.255.255.255 broadcast 192.168.1.101 destination 192.168.1.101
- unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0 (UNSPEC)