新装的 CentOS 7 最小化系统中运行 ifconfig 查看 IP 地址常提示 “-bash: ifconfig: command not found”。本文介绍 net-tools 工具包安装及现代 Linux 标准替代命令。
一、 解决方案:安装 net-tools 软件包
sudo yum install -y net-tools安装后即可正常使用 ifconfig、netstat、arp 等传统网络管理命令。
二、 现代标准替代:使用 ip addr 命令(无需安装任何包)
在现代 Linux 发行版中,net-tools 已逐渐被更强大的 iproute2 工具链取代:
# 极简查看所有网卡 IP 地址
ip addr
# 简写形式:
ip a