温馨提示×

Debian ifconfig命令在哪

小樊
44
2026-09-03 11:53:58
栏目: 智能运维

在 Debian 中,ifconfig 命令属于 net-tools 软件包,而较新的 Debian 版本(如 Debian 9 及以后)默认 不再安装 net-tools,所以会出现“command not found”。

一、如果 ifconfig 不存在,如何安装

sudo apt update
sudo apt install net-tools

安装完成后即可使用:

ifconfig

二、查看 ifconfig 命令位置

which ifconfig

或

ls -l /sbin/ifconfig

通常位于:

/sbin/ifconfig

注意:/sbin 可能不在普通用户的 PATH 中,可用:

/sbin/ifconfig

或使用 sudo


三、推荐替代命令(Debian 官方建议)

Debian 推荐使用 ip 命令(来自 iproute2):

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

四、简单总结

命令 状态
ifconfig 需安装 net-tools
ip 系统自带,推荐

如果你是在 Docker / 容器 / 最小化 Debian 环境,也可以告诉我,我可以给你对应的解决办法。

0 踩