在 Debian 里,ifconfig 属于 net-tools 工具包,而 newer Debian(如 Debian 10/11/12)默认 没有安装 它,所以直接运行通常会提示:
bash: ifconfig: command not found
sudo apt update
sudo apt install net-tools
安装完成后就可以直接运行:
ifconfig
常用示例:
ifconfig
ifconfig eth0
ifconfig -a
现代 Debian 更推荐使用 ip 命令(无需安装):
ip addr
ip link
ip route
对应关系:
ifconfig → ip addrifconfig eth0 up → ip link set eth0 upsudo apt install net-toolsip 命令如果你告诉我你的 Debian 版本(如 11 / 12),我可以给你更精确的说明。