Skip to content
Home » Linux » How to Use ifconfig, netstat or route on Enterprise Linux 7

How to Use ifconfig, netstat or route on Enterprise Linux 7

You may have know that ifconfig is no longer the default command of networking on Enterprise Linux 7.
[root@test ~]# ifconfig
-bash: ifconfig: command not found
[root@test ~]# netstat
-bash: netstat: command not found

Actually, their functions have been replaced by command ip which is packaged in iproute since enterprise linux 7.
[root@test ~]# rpm -qa | grep iproute
iproute-3.10.0-21.el7.x86_64
[root@test ~]# yum info iproute
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.ksu.edu.tw
 * extras: ftp.ksu.edu.tw
 * updates: ftp.ksu.edu.tw
Installed Packages
Name        : iproute
Arch        : x86_64
Version     : 3.10.0
Release     : 21.el7
Size        : 1.2 M
Repo        : installed
From repo   : anaconda
Summary     : Advanced IP routing and network device configuration tools
URL         : http://kernel.org/pub/linux/utils/net/iproute2/
License     : GPLv2+ and Public Domain
Description : The iproute package contains networking utilities (ip and rtmon,
            : for example) which are designed to use the advanced networking
            : capabilities of the Linux 2.4.x and 2.6.x kernel.

 If you insist to use ifconfig, you have to install a package named net-tools to get the command. Let's see what we can have in this package.
[root@test ~]# yum info net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.ksu.edu.tw
 * extras: ftp.ksu.edu.tw
 * updates: ftp.ksu.edu.tw
Available Packages
Name        : net-tools
Arch        : x86_64
Version     : 2.0
Release     : 0.17.20131004git.el7
Size        : 304 k
Repo        : base/7/x86_64
Summary     : Basic networking tools
URL         : http://sourceforge.net/projects/net-tools/
License     : GPLv2+
Description : The net-tools package contains basic networking tools,
            : including ifconfig, netstat, route, and others.
            : Most of them are obsolete. For replacement check iproute package.

Wow, we can have ifconfig, netstat and route command. It may be a good practice to install it.
[root@test ~]# yum -y install net-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.ksu.edu.tw
 * extras: ftp.ksu.edu.tw
 * updates: ftp.ksu.edu.tw
Resolving Dependencies
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

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

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

Total download size: 304 k
Installed size: 917 k
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/net-tools-2.0-0.17.20131004git.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for net-tools-2.0-0.17.20131004git.el7.x86_64.rpm is not installed
net-tools-2.0-0.17.20131004git.el7.x86_64.rpm              | 304 kB   00:03
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) <[email protected]>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-1.1503.el7.centos.2.8.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : net-tools-2.0-0.17.20131004git.el7.x86_64                    1/1
  Verifying  : net-tools-2.0-0.17.20131004git.el7.x86_64                    1/1

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

Complete!

Let's test the command.
[root@test ~]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
...

Leave a Reply

Your email address will not be published. Required fields are marked *