前言
使用ifconfig
和 apt install ifconfig
命令失败,如下:
root@c83011ff7528:/$ ifconfig
bash: ifconfig: command not found
root@c83011ff7528:/# apt install ifconfig
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ifconfig
解决办法
- 出现以上问题的原因是没有安装
net-tools
工具; - 执行
apt-get install net-tools
之后即可使用ifconfig
命令(已在root环境下,不需要在命令前加sudo)
root@c83011ff7528:/# ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:ac:11:00:02
inet addr:172.17.0.5 Bcast:172.17.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3535 errors:0 dropped:0 overruns:0 frame:0
TX packets:2697 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4692046 (4.6 MB) TX bytes:148692 (148.6 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)