LinuxCommandLibrary

ifstatus

Check the status of network interfaces

TLDR

Display interface status

$ ifstatus [interface_name]
copy

Display help
$ ifstatus
copy

SYNOPSIS

ifstatus [OPTIONS] [interface]

PARAMETERS

interface
    Specifies the name of a particular network interface (e.g., `eth0`, `enp0s3`, `wlan0`) for which to display status. If omitted, the command typically displays status for all configured interfaces that it manages.

-a, --all
    Displays the status of all available network interfaces. This option is often used when no specific interface is provided.

-s, --state
    Outputs only the operational state of the interface(s) (e.g., `UP`, `DOWN`, `NO-CARRIER`), providing a concise summary.

-j, --json
    Formats the output as a JSON object, which is useful for programmatic parsing and integration with other scripts or applications.

-v, --verbose
    Provides more detailed information about the interface(s), potentially including additional configuration parameters or diagnostic messages.

DESCRIPTION

The `ifstatus` command is a utility used to display the current operational status and configuration details of network interfaces on a Linux system. While not a standalone binary in all distributions, it is commonly provided as a script or function within various network management frameworks, such as ifupdown, ifupdown2, or as part of systemd-networkd's networkctl utility. Its primary purpose is to offer a quick overview of network connectivity, including whether an interface is UP or DOWN, its assigned IP addresses (IPv4 and IPv6), MAC address, MTU, operational state, and sometimes even link speed and duplex settings.

Users frequently employ `ifstatus` to diagnose network issues, verify network configuration changes, or simply to get an instant snapshot of their system's network setup without sifting through verbose logs or complex configuration files. It acts as a convenient wrapper around lower-level networking tools like `ip` or `ifconfig`, presenting the information in a more readable and often summarized format tailored for quick diagnostics. The exact output and available options can vary significantly depending on the underlying network management system in use.

CAVEATS

The `ifstatus` command is not universally standardized across all Linux distributions or network management systems. Its availability, exact syntax, supported options, and output format can vary significantly. Some systems might not provide `ifstatus` as a direct command, instead offering similar functionality through utilities like `networkctl status` (part of systemd-networkd) or `netplan status` (for netplan-configured systems). Users should consult their distribution's documentation or the `man` pages for their specific network configuration tools to understand the precise behavior of `ifstatus` on their system.

OUTPUT FORMATS

The output of `ifstatus` typically appears in a human-readable, tabular, or list format, summarizing key details like interface name, state, IP address, and MAC address.

Modern implementations, particularly those from ifupdown2 or similar frameworks, often provide an option (e.g., -j or --json) to output the status in a structured JSON format. This is highly beneficial for scripting and automation, allowing other programs to easily parse and utilize the network interface data. The exact information presented can vary based on the command's options and the underlying system's capabilities.

COMMON IMPLEMENTATIONS

The `ifstatus` utility can be found as part of several distinct network management systems:

  • ifupdown / ifupdown2: Often provided as a script that queries the state of interfaces managed by the `interfaces(5)` file. `ifupdown2` offers a richer set of options, including JSON output.
  • systemd-networkd: While not directly named `ifstatus`, the `networkctl status` command provides analogous functionality for interfaces configured via systemd-networkd unit files.
  • Netplan: On systems using Netplan for network configuration, `netplan status` serves a similar purpose, displaying the current state of interfaces defined in Netplan YAML files.
  • In older or minimal setups, a simple `ifconfig` or `ip a` command might be the direct equivalent for status checks.

HISTORY

The concept of easily checking network interface status dates back to early Unix-like systems with tools like `ifconfig`. As Linux networking evolved, particularly with the introduction of the iproute2 suite, more robust methods for querying interface state became available via the `ip` command. The `ifstatus` command itself often emerged as a convenience wrapper or script, particularly within network management frameworks such as ifupdown and its successor ifupdown2. It aimed to provide a user-friendly interface that aggregates relevant status information in a single, easy-to-parse output, abstracting away the complexities of underlying tools. Its adoption grew as distributions sought more integrated and less fragmented ways to manage network configurations, leading to various implementations across different networking backends.

SEE ALSO

ip(8), ifconfig(8), networkctl(1), netplan(5), ifup(8), ifdown(8)

Copied to clipboard