NAME

ifinfo - a tool to get network interface information


SYNOPSIS

ifinfo [options for ifinfo]


DESCRIPTION

ifinfo is a simple commandline network inquiry/formatting tool specifically designed to output some useful information about your network connection. It works by querying the relevant tables in /proc as well as the output of various Unix commands. Its entire purpose in life is to tell you what you want to know, hopefully in a format that is useful and compact.


OPTIONS

--ifname=interface_1[,interface_2][,interface_3]...
Choose which interfaces to display. Defaults to all interfaces. You may use as many interfaces as you wish. Repeated interface names will not generate multiple output lines. Missing interfaces will be silently ignored.

--info=parameter_1[,parameter_2][,parameter_3]...
Choose which parameters to display. Defaults to a summary of all interfaces with IP address/netmask, maximum transmit unit, bytes transmitted and received. The column headers in the below example below are not part of the output.
 Ifname  IP/netmask                    MTU     Tx (MB)      Rx (MB)
 lo:     127.0.0.1/255.0.0.0         16436    210.524 MB   210.524 MB
 eth0:   192.168.1.16/255.255.255.0   1500   1787.516 MB   186.974 MB

The parameters you may use for this are as follows:

rx_bytes: number of received bytes
rx_packets: number of received packets
rx_errors: number of receive errors
rx_drop: number of receive packets dropped
rx_fifo:
rx_frame:
rx_compressed:
rx_multicast: number of received multicast packets
tx_bytes: number of transmitted bytes
tx_packets: number of transmitted packets
tx_errors: number of transmit errors
tx_drop: number of transmit packets dropped
tx_fifo:
tx_frame:
tx_compressed:
tx_multicast: number of transmitted multicast packets
HWaddr: the hardware MAC address of the interface
name: the name of this interface according to the resolver
irq: the interrupt associated with the interface. A returned value of ``-'' means that no interrupt has been assigned to the interface.

Note: current versions of the Linux kernel have a network byte counter overflow at 4 GB, so that if you are transfering more than 4 GB of data, you will find that the counters overflow and wrap around.

--sep=output separator character
This is the character that is used to separate fields in the output.
 ifinfo --sep="," --ifname=eth0,lo --info=dev,HWaddr,irq,inet_addr,name
 lo,00:00:00:00:00:00,-,127.0.0.1,localhost.localdomain
 eth0,00:40:05:0B:9F:01,5,192.168.1.16,squash.scalableinformatics.com

--format=``sprintf format specifier''
This gives much finer grain control over the output of the program. You may use this to encode an arbitrary format string. It is possible to confuse the program with an incorrect format specifier.
 ifinfo --format="[%s],%s+%s" --ifname=eth0,lo --info=dev,HWaddr,inet_addr
 [lo],00:00:00:00:00:00+127.0.0.1
 [eth0],00:40:05:0B:9F:01+192.168.1.16

ifinfo --format=``<tr><td>%s</td><td>%s</td><td>%s</td>'' --ifname=eth0,lo --info=dev,HWaddr,inet_addr


 <tr><td>lo</td><td>00:00:00:00:00:00</td><td>127.0.0.1</td>
 <tr><td>eth0</td><td>00:40:05:0B:9F:01</td><td>192.168.1.16</td>

We recommend simply using %s as the format specifier for a particular field. Wrap the field with the text you need. The above example shows how this could be used as part of a status display for a web based machine.

--mask=[hex|range|bits]
This option controls how the netmask is printed. The usual method is in terms of the integer quads xxx.yyy.zzz.ttt. The mask option allows you to change that.
 ifinfo --mask=hex --ifname=eth0,lo
 lo:     127.0.0.1/0xff000000            16436   219.678 MB      219.678 MB
 eth0:   192.168.1.16/0xffffff00         1500    1793.610 MB     189.103 MB
 ifinfo --mask=range --ifname=eth0,lo
 lo:     127.0.0.1/8                     16436   219.685 MB      219.685 MB
 eth0:   192.168.1.16/24                 1500    1793.614 MB     189.108 MB
 ifinfo --mask=bits --ifname=eth0,lo
 lo:     127.0.0.1/11111111000000000000000000000000      16436   219.691 MB     219.691 MB
 eth0:   192.168.1.16/11111111111111111111111100000000   1500    1793.620 MB    189.114 MB

--help
The man page.

--ns
This option queries your default resolver service to return the name of the particular interface. It is a synonym for the parameter name which can be used in the --info=... option.
 ifinfo --ifname=eth0,lo --ns
 lo:     localhost.localdomain           16436   220.802 MB      220.802 MB
 eth0:   squash.scalableinformatics.com  1500    1794.392 MB     189.379 MB
 ifinfo --ifname=eth0,lo --info=dev,name
 lo,localhost.localdomain
 eth0,squash.scalableinformatics.com

--irq
This option reports the interrupt assigned to the interface. It is a synonym for the parameter irq which can be used in the --info=... option. A minus sign (-) indicates that this interface does not have an interrupt assigned. This might be the case for various network interfaces which do not have hardware drivers attached to them.
 ifinfo --ifname=eth0,lo --info=dev,name,irq
 lo,localhost.localdomain,-
 eth0,squash.scalableinformatics.com,5

--route
This option returns a simple representation of the current routing tables.
 ifinfo --ifname=eth0,lo --route
 lo:     127.0.0.0/255.0.0.0              -> 0.0.0.0
 eth0:   0.0.0.0/0.0.0.0                  -> 192.168.1.254
         192.168.1.0/255.255.255.0        -> 0.0.0.0
         169.254.0.0/255.255.0.0          -> 0.0.0.0

The route 0.0.0.0/0.0.0.0 address pointing to a particular IP address represents the default route. The masking bits above do not currently work with this option.


FILES

/usr/local/bin/ifinfo


DIAGNOSTICS

ifinfo will emit warning messages for incorrect parameters.


REQUIRES

Perl 5.6.0 or higher, Getopt::Long, POSIX.


SEE ALSO

ifconfig(8), route(8), netstat(8)


LICENSE

This code is licensed under GPL version 2.0. See http://www.gnu.org/copyleft/gpl.html#SEC1 for specific details.


AUTHOR

 Joe Landman 
 landman@scalableinformatics.com
 
L<http://scalableinformatics.com>;