温馨提示×

ubuntu ifconfig找不到怎么办

小樊
34
2026-10-14 02:13:17
栏目: 智能运维

在较新的 Ubuntu 版本中,ifconfig 命令默认可能没有安装,因为它属于 net-tools 工具包,而 Ubuntu 推荐使用 ip 命令(来自 iproute2)。

你可以按下面步骤解决:


一、临时替代方案(推荐先试)

使用 ip 命令查看网络信息:

ip addr

查看网卡状态:

ip link

查看路由:

ip route

二、安装 ifconfig(如果你一定要用)

1. 更新软件源

sudo apt update

2. 安装 net-tools

sudo apt install net-tools

3. 使用 ifconfig

ifconfig

三、常见情况说明

  • Ubuntu 18.04 / 20.04 / 22.04 / 24.04
    默认都不带 ifconfig
  • 报错通常是:
    Command 'ifconfig' not found
    

四、建议

✅ 新系统建议直接使用:

ip a

比 ifconfig 更强大、更标准。

如果你是想配置 IP、看网卡名、排查网络问题,可以告诉我具体需求,我可以给你对应命令。

0 踩