ifdata – network interface information tool – ifconfig alternative

ifdata is a quick, lightweight and simple tool to display network interface information in Linux, which can be used as an alternative for ip addr show or ifconfig.

Sometimes I want to quickly find out, if the particular network interface exists in the system or I want to display it’s IP address or MTU value only. If I used ifconfig for this case, I would have to parse the output using grep or other tools. ifdata resolves this problem in more sophisticated manner – it utilizes parameters to better control the output we want to obtain. This is another reason why ifdata is more friendly for use in BASH scripting.

Installation (moreutils package provides ifdata):

[root@tuxfixer ~]# yum install moreutils

Examples of ifdata usage:

1. Check, if the network interface exists

[root@tuxfixer ~]# ifdata -pe eth1

2. Display network interface info

[root@tuxfixer ~]# ifdata -p eth1 1500

3. Display MTU value of the interface

[root@tuxfixer ~]# ifdata -pm eth1

4. Display interface flags

[root@tuxfixer ~]# ifdata -pf eth1
On  Up
On  Broadcast
Off Debugging
Off Loopback
Off Ppp
Off No-trailers
On  Running
Off No-arp
Off Promiscuous
Off All-multicast
Off Load-master
Off Load-slave
On  Multicast
Off Port-select
Off Auto-detect
Off Dynaddr
Off Unknown-flags

5. Display the number of input packets on interface

[root@tuxfixer ~]# ifdata -sip eth1

6. Display the number of output bytes on interface

[root@tuxfixer ~]# ifdata -sob eth1

7. Verify if the interface exists, exits nonzero if it does not – useful in BASH scripting

if $(ifdata -e eth1); then
   echo "Interface eth1 exists"
   echo "Interface eth1 doesn't exist"

Leave a Reply

Name *
Email *

This site uses Akismet to reduce spam. Learn how your comment data is processed.