在 Debian(尤其是新版本)里,ifconfig 默认可能没有安装,因为它属于比较老的网络工具包 net-tools。下面按情况给你说明:
which ifconfig
或
ifconfig
如果提示:
command not found
说明没装。
sudo apt update
sudo apt install net-tools
安装完成后:
ifconfig
就可以用了。
从 Debian 9 开始,官方推荐使用 ip 命令代替 ifconfig:
ip addr
或
ip a
ip route
sudo ip link set eth0 up
sudo ip link set eth0 down
| 老命令 | 新命令 |
|---|---|
| ifconfig | ip addr |
| route | ip route |
| ifup / ifdown | ip link set |
net-toolsip 命令ifconfig 仍然可用,但已逐渐被淘汰如果你是想配置网络 / 查 IP / 设静态地址,可以告诉我你的 Debian 版本,我可以给你更具体的命令。