温馨提示×

debian怎么找ifconfig

小樊
37
2026-09-06 16:06:55
栏目: 智能运维

在 Debian(尤其是新版本)里,ifconfig 默认可能没有安装,因为它属于比较老的网络工具包 net-tools。下面按情况给你说明:


一、先确认 ifconfig 是否存在

which ifconfig

或

ifconfig

如果提示:

command not found

说明没装。


二、安装 ifconfig(Debian)

sudo apt update
sudo apt install net-tools

安装完成后:

ifconfig

就可以用了。


三、推荐的新命令(Debian 官方更推荐)

从 Debian 9 开始,官方推荐使用 ip 命令代替 ifconfig:

查看网卡信息

ip addr

或

ip a

查看路由

ip route

启用 / 禁用网卡

sudo ip link set eth0 up
sudo ip link set eth0 down

四、快速对照表

老命令 新命令
ifconfig ip addr
route ip route
ifup / ifdown ip link set

五、总结

  • 找不到 ifconfig → 装 net-tools
  • 新系统建议 → 用 ip 命令
  • ifconfig 仍然可用,但已逐渐被淘汰

如果你是想配置网络 / 查 IP / 设静态地址,可以告诉我你的 Debian 版本,我可以给你更具体的命令。

0 踩