在 Debian 里,ifconfig 命令属于 net-tools 软件包,而现代 Debian 默认可能没有安装它(推荐使用 ip 命令)。如果你需要使用 ifconfig,可以按以下步骤开启/安装。
which ifconfig
或
ifconfig
如果提示:
command not found
说明没有安装。
sudo apt update
sudo apt install net-tools
ifconfig
看到网卡信息即表示成功。
Debian 推荐使用 ip 命令:
ip addr
或
ip a
如果你是想“开启网卡”而不是命令本身:
sudo ip link set eth0 up
(把 eth0 换成你的网卡名,如 ens33)
编辑:
sudo nano /etc/network/interfaces
示例(DHCP):
auto eth0
iface eth0 inet dhcp
然后:
sudo systemctl restart networking
如果你能说明:
我可以给你更精确的操作步骤。