温馨提示×

debian ifconfig为何找不到

小樊
47
2026-09-30 16:38:37
栏目: 智能运维

在较新的 Debian 版本中,ifconfig 命令“找不到”通常是因为 它已不再是默认安装的工具。

原因

  • ifconfig 属于 net-tools 软件包
  • 从 Debian 9(Stretch)开始,默认不再安装 net-tools
  • 新系统推荐使用 iproute2 提供的 ip 命令

验证是否未安装

which ifconfig

如果输出为空,说明没有安装。


解决方法

方法一:安装 net-tools(恢复 ifconfig)

sudo apt update
sudo apt install net-tools

安装后即可使用:

ifconfig

方法二:使用推荐替代命令 ip

ip addr      # 查看 IP 地址
ip link      # 查看网卡状态
ip route     # 查看路由

建议

  • 新系统建议直接使用 ip 命令
  • ifconfig 已多年未维护,未来会逐渐淘汰

如果你是想排查网络问题,也可以告诉我具体场景,我可以给你对应的 ip 命令写法。

0 踩