温馨提示×

ifconfig在Debian怎么运行

小樊
49
2026-09-03 11:47:54
栏目: 智能运维

Debian 里,ifconfig 属于 net-tools 工具包,而 newer Debian(如 Debian 10/11/12)默认 没有安装 它,所以直接运行通常会提示:

bash: ifconfig: command not found

方法一:安装 net-tools(推荐如果你习惯 ifconfig)

sudo apt update
sudo apt install net-tools

安装完成后就可以直接运行:

ifconfig

常用示例:

ifconfig
ifconfig eth0
ifconfig -a

方法二:使用 Debian 默认推荐命令(iproute2)

现代 Debian 更推荐使用 ip 命令(无需安装):

ip addr
ip link
ip route

对应关系:

  • ifconfigip addr
  • ifconfig eth0 upip link set eth0 up

总结

  • Debian 默认没有 ifconfig
  • 想用:sudo apt install net-tools
  • 更现代方式:直接用 ip 命令

如果你告诉我你的 Debian 版本(如 11 / 12),我可以给你更精确的说明。

0