linux-network-interfaces

Queries network interface configuration and statistics on a Linux system. Returns the status, IP addresses, and send/receive statistics of each interface as structured fields, based on per-interface attributes from the /sys/class/net/ directory and the output of ip addr show.

Command properties

PropertyValue
Command typeDriver query
Required permissionAdministrator
License usageCounted
Parallel executionNot supported
Distributed executionRuns on Data Node (mapper)

Syntax

linux-network-interfaces

Output fields

FieldTypeDescription
ifacestringInterface name
statusstringActive status. up or down
mtuintegerMaximum Transmission Unit (MTU)
ip_addripaddrIPv4 address
netmaskipaddrIPv4 netmask
ip_addr6ipaddrIPv6 address
prefix_lenintegerIPv6 prefix length
rx_pktslongReceived packet count
rx_byteslongReceived byte count
rx_errorslongReceive error count
rx_dropslongReceived packets dropped
rx_overrunslongReceive queue overflow losses
tx_pktslongTransmitted packet count
tx_byteslongTransmitted byte count
tx_errorslongTransmit error count
tx_dropslongTransmitted packets dropped
tx_overrunslongTransmit abort error count
tx_carrierlongCarrier error count (link disconnection, etc.)
tx_collisionslongCollision count

Error codes

Parsing errors
Error codeMessageDescription
95040no-read-permissionExecuted without administrator privileges
Runtime errors

N/A

Description

The linux-network-interfaces command collects information for each network interface from the /sys/class/net/ directory. The active status of an interface is determined by the IFF_UP bit in the flags file, and the MTU is read from the mtu file.

Send/receive statistics are read from the statistics subdirectory of the interface if it exists; otherwise, alternative statistics are collected from /proc/net/xt_qtaguid/iface_stat_fmt.

IPv4 address and netmask, and IPv6 address and prefix length are extracted from the output of ip addr show. The CIDR prefix length is converted to a netmask IP address and assigned to the netmask field.

This command requires administrator privileges. If privileges are insufficient, an error occurs at the parsing stage.

Examples

  1. Query network interface information

    linux-network-interfaces
    

    Queries configuration and statistics for all network interfaces on the current system.

  2. Filter only active interfaces

    linux-network-interfaces
    | search status == "up"
    

    Filters only network interfaces in the active (up) state.

  3. Query send and receive bytes by interface

    linux-network-interfaces
    | fields iface, rx_bytes, tx_bytes
    

    Queries only the name, received byte count, and transmitted byte count for each interface.