---
title: "CentOS出现ifconfig: command not found的解决办法"
url: https://www.landian.news/archives/38609.html
date: 2017-08-18T14:16:52+08:00
modified: 2017-08-18T06:16:52+00:00
author: "山外的鸭子哥"
description: "CentOS 发行版在安装锐速安装包时需要配置设备的网卡因此会使用到 ipconfig 命令来完成某些必要的操 [&hellip;]"
categories: ""
tags: "CentOS, ipconfig, SSH, 环境变量"
---

# CentOS出现ifconfig: command not found的解决办法

CentOS 发行版在[安装锐速安装包时需要配置设备的网卡](https://www.landian.news/archives/28720.html)因此会使用到 ipconfig 命令来完成某些必要的操作。

其他情况下你可能也会使用 ipconfig 命令来配置网络选项，如果是初次安装的系统你可能就会遇到如下问题：

```
ipconfig: command not found
serverspeeder.sh: line 141: ifconfig: command not found
serverspeeder.sh: line 144: ifconfig: command not found
```

出现此问题的原因绝大多数情况下可能都是系统没有附带ipconfig，例如你安装的是CentOS最小安装包模式。

因此这个时候只需要我们使用命令安装ipconfig即可，命令如下：

```
yum install upgrade
yum install net-tools
```

如果本身已经安装了ipconfig但依然报错那就需要看看环境变量的设置：

```
#echo $PATH
```

如果环境变量中没有包含ipconfig命令的路径则需要临时修改环境变量：

```
$export PATH = $PATH:/sbin
```

修改完成后测试ipconfig是否可以正常使用，如果可以正常使用则需要永久修改：打开`/etc/profile`

然后在该文件中填写`export PATH=$PATH:/sbin`并保存，保存后重启系统即可直接使用 ipconfig 命令了。

---

Source: [CentOS出现ifconfig: command not found的解决办法](https://www.landian.news/archives/38609.html)
