在 Debian(尤其是较新版本)中,ifconfig 命令默认可能没有安装,因为它是属于 net-tools 软件包的工具,而现代 Debian 更推荐使用 ip 命令。
下面分情况说明:
ifconfig: command not foundsudo apt update
sudo apt install net-tools
ifconfig
或查看某个网卡:
ifconfig eth0
ip 命令替代 ifconfigip addr # 查看所有网卡和 IP
ip link # 查看网卡状态
ip route # 查看路由
启用/禁用网卡:
sudo ip link set eth0 up
sudo ip link set eth0 down
sudo ifconfig eth0 up
sudo ifconfig eth0 down
Debian 网络配置通常在:
/etc/network/interfaces
或使用 NetworkManager / systemd-networkd(取决于桌面或服务器版本)
如果你愿意,可以告诉我:
cat /etc/os-release)我可以给你更精确的配置方法。