温馨提示×

debian为什么没有ifconfig

小樊
39
2026-09-24 20:48:30
栏目: 智能运维

在 较新版本的 Debian(以及大多数现代 Linux 发行版)中,ifconfig 默认不再安装,主要原因如下:


1. ifconfig 属于 net-tools,已被弃用

  • ifconfig 来自 net-tools 软件包
  • net-tools 项目 早已停止维护(最后一次重大更新在 2001 年左右)
  • 官方推荐用 iproute2 替代

Debian 官方从 Debian 9(Stretch) 开始:

默认 不再安装 net-tools


2. 替代工具:ip 命令

现代 Debian 使用 iproute2 提供的 ip 命令:

旧命令 (ifconfig) 新命令 (ip)
ifconfig ip addr / ip a
ifconfig eth0 up ip link set eth0 up
ifconfig eth0 192.168.1.10 ip addr add 192.168.1.10/24 dev eth0
route ip route
arp ip neigh

3. 为什么还能看到有人用 ifconfig?

  • 老教程、老脚本还在用
  • 部分系统 手动安装了 net-tools
  • 嵌入式或老旧系统仍依赖它

4. 如果想在 Debian 上使用 ifconfig

可以手动安装:

sudo apt update
sudo apt install net-tools

安装后即可使用:

ifconfig

⚠️ 但不推荐用于新系统或新脚本


5. 推荐做法(Debian 官方建议)

✅ 使用:

ip a
ip route
ip link

✅ 网络配置:

  • /etc/network/interfaces
  • 或 systemd-networkd
  • 或 NetworkManager

总结

Debian 没有 ifconfig,不是“少了”,而是“故意不用了”
因为它已被 ip 命令全面取代,更安全、更强大、更现代。

如果你愿意,我可以帮你把常用 ifconfig 命令翻译成 ip 命令对照表。

0 踩