在 Debian 里,ifconfig 默认不再预装,它属于 net-tools 软件包。你可以通过下面方式安装:
sudo apt update
sudo apt install net-tools
安装完成后,就可以正常使用:
ifconfig
可以先检查:
which ifconfig
或
ifconfig --version
从 Debian 9 开始,官方更推荐使用 ip 命令(来自 iproute2,一般已默认安装):
ip addr # 查看网卡和 IP
ip link # 查看网卡状态
ip route # 查看路由
例如:
ip a
ifconfig → 装 net-toolsip a如果你是在 最小化安装 / 容器 / 云服务器 里,我也可以帮你判断用哪种方式更合适。