在较新版本的 Debian(例如 Debian 9 及以后,尤其是 Debian 10/11/12)中,默认已经不再自带 ifconfig 命令。
原因:
ifconfig 属于 net-tools 软件包ip 命令)替代 net-tools✅ 检查是否可用:
which ifconfig
若没有输出,说明未安装。
✅ 安装 ifconfig(如果需要):
sudo apt update
sudo apt install net-tools
✅ 推荐替代命令(Debian 自带):
ip addr
ip link
ip route
总结:
如果你是服务器或容器环境,通常也是没有 ifconfig 的。