温馨提示×

debian为何ifconfig消失

小樊
54
2026-09-09 13:51:53
栏目: 智能运维

较新版本的 Debian(大约从 Debian 9 / 10 开始)中,ifconfig 命令“消失”,并不是真的被删除了,而是因为:


1. ifconfig 属于 net-tools,默认不再安装

  • ifconfig 来自 net-tools
  • 新版 Debian 默认 只安装 iproute2
  • iproute2 提供了更现代、更强大的命令:ip

所以:

which ifconfig
# 没有任何输出

2. 官方推荐用 ip 替代 ifconfig

ifconfig 被认为:

  • 老旧
  • 功能有限
  • 不能完整反映现代网络(如策略路由、命名空间)

对应替代关系:

ifconfig ip 命令
ifconfig ip addr
ifconfig eth0 up ip link set eth0 up
ifconfig eth0 192.168.1.10 ip addr add 192.168.1.10/24 dev eth0

3. 如何恢复 ifconfig

如果你确实想用:

sudo apt update
sudo apt install net-tools

安装后:

ifconfig

就可以正常使用了。


4. 为什么 Debian 这样设计?

  • 减少不必要的旧工具
  • 统一网络管理接口
  • 更好地支持 systemd-networkd / NetworkManager

总结一句话

Debian 没“删” ifconfig,只是默认不再装 net-tools,推荐你用 ip 命令。

如果你愿意,我可以给你一份 ifconfig → ip 命令对照速查表

0