Bash ifconfig: command not found on CentOS/RHEL 7

Channel: Linux
Abstract: 0 (0.0 b) TX byteseth0 Link encap

ifconfig command is useful for getting details of the network configuration in Linux-based systems. Mostly when I install an older version of Linux operating systems, ifconfig command packages were default installed during installation of the operating system but when recently I installed CentOS 7 operating system, ifconfig command was not installed default with operating system installation.

Install Package for ifconfig Command

ifconfig command comes from net-tools rpm package. Install this package using following command which is available under default repositories.

yum install net-tools
Getting Interface Information using ifconfig

Now use ifconfig command to check network configuration details. Below command will show details for all interfaces in system

[[email protected] ~]# ifconfig 

eth0      Link encap:Ethernet  HWaddr 08:00:27:AC:2D:45
          inet addr:192.168.10.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feae:2545/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:877052 errors:0 dropped:0 overruns:0 frame:0
          TX packets:840432 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1269001025 (1.1 GiB)  TX bytes:61342574 (58.5 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Use below command to show details for interface eth0 in system

ifconfig eth0

To get all interfaces details using ifconfig use following command.

ifconfig -a

Ref From: tecadmin

Related articles