温馨提示×

怎样安装linux ifconfig工具

小樊
44
2026-10-04 23:22:55
栏目: 智能运维

在较新的 Linux 发行版中,ifconfig 命令属于 net-tools 软件包,而很多系统默认只安装了 iproute2(使用 ip 命令)。如果你发现系统中没有 ifconfig,可以按下面的方法安装。


一、先确认是否真的没有 ifconfig

which ifconfig

或

ifconfig

如果提示 command not found,说明未安装。


二、根据发行版安装 net-tools

1. Debian / Ubuntu / Linux Mint

sudo apt update
sudo apt install net-tools

2. CentOS / RHEL / Rocky / AlmaLinux

sudo yum install net-tools

或(CentOS 8+ / RHEL 8+):

sudo dnf install net-tools

3. Arch Linux

sudo pacman -S net-tools

4. openSUSE

sudo zypper install net-tools

三、验证安装

ifconfig

或查看某个网卡:

ifconfig eth0

四、推荐说明(重要)

⚠️ ifconfig 已被弃用,官方推荐使用:

ip addr
ip link
ip route

功能和 ifconfig 类似,且更强大。


如果你告诉我具体的 Linux 发行版和版本号,我可以给你更精确的命令。

0 踩