Ifconfig command not found in CentOS 7 and RHEL 7

Dear friend, today we will see how to resolve the issue “ifconfig command not found” in CentOS 7and RHEL 7. When we have installed CentOS 7 and RHEL 7 with minimal server option, then ifconfig command will not be running, this because net-tools package is not installed by default with minimal server option.

If you wan this command in your CentOS 7 and RHEL 7 server then you will need to be install net-tools then you can run ifconfig command.

You can see below I have installed minimal CentOS 7 and ifconfig command is not working on this server.

[root@urclouds ~]# ifconfig -a
-bash: ifconfig: command not found
[root@urclouds ~]#

Install net-tools on CentOS 7 and RHEL 7 as like below:-

[root@urclouds ~]# yum install net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.crazyfrogs.org
* extras: centos.mirror.fr.planethoster.net
* updates: centos.crazyfrogs.org
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
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:00
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-2.1511.el7.centos.2.10.x86_64 (@anaconda)
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

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

[root@urclouds ~]#

We can see above we have successfully install net-tools on CentOS. Now we can check ifconfig working or nor?

[root@urclouds ~]# ifconfig -a
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet netmask broadcast
inet6 fe80::250:56ff:fe99:5ce4 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:99:5c:e4 txqueuelen 1000 (Ethernet)
RX packets 20966517 bytes 1435439716 (1.3 GiB)
RX errors 0 dropped 11976 overruns 0 frame 0
TX packets 4573 bytes 340407 (332.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet netmask
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 198 bytes 16144 (15.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 198 bytes 16144 (15.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[root@urclouds ~]#

We can see, now ifconfig command is working properly.

If we want to check our interface link status, speed and duplex then we can run ethtool <interface name> like below:-

[root@urclouds ~]# ethtool ens160
Settings for ens160:
Supported ports: [ TP ]
Supported link modes: 1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: No
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Speed: 10000Mb/s
Duplex: Full
Port: Twisted Pair
Transceiver: internal
Auto-negotiation: off
MDI-X: Unknown
Supports Wake-on: uag
Wake-on: d
Link detected: yes
[root@urclouds ~]#

You can see here interface link is detected. Check your cables or switch ports status if link detected No. There will be some problem in switch ports and cables.

Speed 10000Mb/s and duplex Full, Speed and duplex can also be set with ethtool commands.

That’s all..!

You can also check this link to configure network after CentOS 7 minimal installation.


This Post Has 4 Comments

  1. oprol evorter

    There are some attention-grabbing points in time on this article however I don’t know if I see all of them heart to heart. There is some validity however I will take maintain opinion until I look into it further. Good article , thanks and we wish more! Added to FeedBurner as properly

  2. Karim

    Excellent Excellent Excellent, thx its 100% working.

  3. Renae Kasky

    Holiday in Croatia, Kroatien Urlaub, kvarner bay villas, Kvarner bay apartments, Croatia kvarner bay, apartments in kvarner bay

  4. bedliner

    This is actually attractive, You’re an exceedingly qualified author. I have signed up with your feed plus expect enjoying the useful write-ups. Furthermore, I’ve shared your web blog throughout our internet sites.

Leave a Reply