温馨提示×

debian ifconfig在哪里

小樊
49
2026-09-15 17:29:21
栏目: 智能运维

在 Debian 里,ifconfig 默认可能找不到,原因是:

1. ifconfig 属于 net-tools

在新版 Debian(如 Debian 9+)中,net-tools 默认不再安装。

检查是否安装

which ifconfig

如果没输出,说明没装。

安装 ifconfig

sudo apt update
sudo apt install net-tools

安装后即可使用:

ifconfig

2. 推荐使用的替代命令(Debian 官方推荐)

Debian 更推荐使用 iproute2 工具:

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

启停网卡:

ip link set eth0 up
ip link set eth0 down

3. 常见位置

如果已安装,ifconfig 一般在:

/sbin/ifconfig

普通用户可能不在 PATH 中,可用:

/sbin/ifconfig

或切换为 root。


✅ 总结

  • 找不到 → 没装 net-tools
  • 解决 → apt install net-tools
  • 更现代 → 用 ip 命令

如果你是想配置网络或设置静态 IP,我也可以直接给你 Debian 的做法。

0 踩