H2S Forum

Ifconfig not found centos 7 or Redhat 7

To get the IP address of the CentOS or Redhat running Linux server or Deskop, we can use the command ifconfig and in case it giving an error

bash: ifconfig command not found 

That means it has not been installed on the system and need to be. For that use this net-tools installation command:

sudo yum install net-tools

Output of the above command:

[root@f9d67561fb16 /]# yum install net-tools
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
 * base: mirror.horizon.vn
 * extras: mirror.horizon.vn
 * updates: mirror.horizon.vn
base                                                                                             | 3.6 kB  00:00:00
extras                                                                                           | 3.4 kB  00:00:00
updates                                                                                          | 3.4 kB  00:00:00
(1/4): base/7/x86_64/group_gz                                                                    | 166 kB  00:00:02
(2/4): extras/7/x86_64/primary_db                                                                | 205 kB  00:00:02
(3/4): base/7/x86_64/primary_db                                                                  | 6.0 MB  00:00:12
(4/4): updates/7/x86_64/primary_db                                                               | 6.5 MB  00:00:21
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.24.20131004git.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                   Arch                   Version                                    Repository            Size
========================================================================================================================
Installing:
 net-tools                 x86_64                 2.0-0.24.20131004git.el7                   base                 306 k

Transaction Summary
========================================================================================================================
Install  1 Package

Total download size: 306 k
Installed size: 918 k
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/net-tools-2.0-0.24.20131004git.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for net-tools-2.0-0.24.20131004git.el7.x86_64.rpm is not installed
net-tools-2.0-0.24.20131004git.el7.x86_64.rpm                                                    | 306 kB  00:00:09
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-6.1810.2.el7.centos.x86_64 (@CentOS)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : net-tools-2.0-0.24.20131004git.el7.x86_64                                                            1/1
  Verifying  : net-tools-2.0-0.24.20131004git.el7.x86_64                                                            1/1

Installed:
  net-tools.x86_64 0:2.0-0.24.20131004git.el7

Complete!
[root@f9d67561fb16 /]#

Now run the ifconfig command on centos or Redhat Linux

ifconfig