在 Debian(尤其是较新版本,如 Debian 9 及以后)中,默认不再安装 ifconfig 命令,主要原因如下:
ifconfig 属于 net-tools 工具包,该工具包已经 多年不再积极维护,存在以下问题:
因此,Linux 社区和发行版(包括 Debian)推荐使用 iproute2 替代 net-tools。
iproute2Debian 默认安装的是 iproute2,它提供了更强大、统一的网络管理命令:
| 旧命令(net-tools) | 新命令(iproute2) |
|---|---|
| ifconfig | ip addr / ip link |
| route | ip route |
| arp | ip neigh |
| netstat | ss |
例如:
ip addr show
ip route
ip link set eth0 up
可以手动安装:
sudo apt update
sudo apt install net-tools
安装后即可使用:
ifconfig
⚠️ 不推荐长期使用,仅用于兼容旧脚本或习惯。
Debian 没有 ifconfig,是因为它已被现代工具
ip取代,net-tools 已不再默认安装。
如果你愿意,我可以帮你:
ifconfig 命令翻译成 ip 命令