ifconfig 属于 net-tools 工具包,在 Debian 10(Buster)及以后版本中默认 不再预装。你需要手动安装。
sudo apt update
sudo apt install net-tools
安装完成后即可使用:
ifconfig
which ifconfig
输出类似:
/sbin/ifconfig
ifconfig 已被认为 过时(deprecated),Debian 推荐使用 iproute2 工具:
ip addr
ip link
ip route
这些命令功能更强、更稳定,是未来的标准。
也可以不安装,直接用 ip 命令替代:
ip addr show
如果 apt 不可用,先确认源:
cat /etc/apt/sources.list
✅ Debian 安装 ifconfig:
sudo apt install net-tools
❗ 推荐长期学习使用:
ip addr
如果你告诉我你的 Debian 版本(如 11、12)或 使用场景(服务器 / 桌面 / Docker),我可以给你更合适的建议。