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
| Property | Value |
|---|---|
| Command type | Driver query |
| Required permission | Administrator |
| License usage | Counted |
| Parallel execution | Not supported |
| Distributed execution | Runs on Data Node (mapper) |
Syntax
Output fields
| Field | Type | Description |
|---|---|---|
iface | string | Interface name |
status | string | Active status. up or down |
mtu | integer | Maximum Transmission Unit (MTU) |
ip_addr | ipaddr | IPv4 address |
netmask | ipaddr | IPv4 netmask |
ip_addr6 | ipaddr | IPv6 address |
prefix_len | integer | IPv6 prefix length |
rx_pkts | long | Received packet count |
rx_bytes | long | Received byte count |
rx_errors | long | Receive error count |
rx_drops | long | Received packets dropped |
rx_overruns | long | Receive queue overflow losses |
tx_pkts | long | Transmitted packet count |
tx_bytes | long | Transmitted byte count |
tx_errors | long | Transmit error count |
tx_drops | long | Transmitted packets dropped |
tx_overruns | long | Transmit abort error count |
tx_carrier | long | Carrier error count (link disconnection, etc.) |
tx_collisions | long | Collision count |
Error codes
Parsing errors
| Error code | Message | Description |
|---|---|---|
95040 | no-read-permission | Executed 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
-
Query network interface information
linux-network-interfacesQueries configuration and statistics for all network interfaces on the current system.
-
Filter only active interfaces
linux-network-interfaces | search status == "up"Filters only network interfaces in the active (
up) state. -
Query send and receive bytes by interface
linux-network-interfaces | fields iface, rx_bytes, tx_bytesQueries only the name, received byte count, and transmitted byte count for each interface.