温馨提示×

Debian怎么安装ifconfig

小樊
38
2026-08-05 12:46:45
栏目: 智能运维

在 Debian 里,ifconfig 已经不再默认安装,它属于 net-tools 软件包。你可以通过安装 net-tools 来使用 ifconfig

方法一:安装 net-tools(推荐)

sudo apt update
sudo apt install net-tools

安装完成后即可使用:

ifconfig

方法二:使用 ip 命令(官方推荐,替代 ifconfig)

Debian 官方更推荐使用 ip 命令(来自 iproute2,一般已默认安装):

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

例如:

ip addr show

常见问题

1️⃣ ifconfig: command not found

说明没有安装 net-tools,按方法一安装即可。

2️⃣ 是否必须安装 ifconfig?

不是必须

  • ifconfig:老工具,功能有限
  • ip:现代、功能更强,推荐学习使用

总结

工具 是否需要安装 推荐程度
ifconfig 需要 ⭐⭐
ip 通常已安装 ⭐⭐⭐⭐⭐

如果你是在 服务器 / 容器 / 最小化 Debian 环境,我也可以帮你判断用哪种方式更合适。

0