在较新的 Debian 版本(大概是 Debian 9 及以上)里,ifconfig 默认没有安装,所以你会遇到“command not found”或者直接查不到网卡信息的情况。
ifconfig 属于 net-tools 工具包,而 Debian 现在默认使用 iproute2,推荐用 ip 命令替代。
ip 命令ip addr
或者只看网卡名:
ip link
查看 IP:
ip -4 addr show
如果你一定要用 ifconfig:
sudo apt update
sudo apt install net-tools
安装完后:
ifconfig
如果 ip addr 也看不到网卡:
lspci | grep -i net
ip link show
可能是:
ifconfigip addrip routess(替代 netstat)如果你是在服务器 / 虚拟机 / 容器环境,也可以告诉我具体版本,我可以更精确地帮你查。