ifquery
Query network interface configuration
SYNOPSIS
ifquery [options] [interface]
ifquery [options] {--list | --all | --state | --syntax-check}
PARAMETERS
-a, --all
Query all interfaces defined in /etc/network/interfaces.
-l, --list
List all configured interfaces.
-s, --state
Show the operational state (up or down) for the specified or all interfaces.
--allow-state STATE
Only consider interfaces whose current state matches the specified STATE (e.g., 'up' or 'down').
--syntax-check
Perform a syntax check on the /etc/network/interfaces file and report any errors.
-S FILE, --with-sources FILE
Read configuration from the specified FILE instead of the default /etc/network/interfaces.
-n, --dry-run
Suppress actual operations; only show what would be done (less impactful for query commands).
-q, --quiet
Suppress normal output for successful operations.
-v, --verbose
Provide more detailed output.
-h, --help
Display a help message and exit.
-V, --version
Display version information and exit.
DESCRIPTION
ifquery is a command-line utility used to inspect and report on the status and configuration of network interfaces defined in the /etc/network/interfaces file. It is part of the ifupdown package, which traditionally manages network interface configuration on Debian-based Linux distributions.
Unlike ifup or ifdown, ifquery does not change the operational state of interfaces; instead, it provides information about their current status (up or down, according to the ifupdown system) and the properties assigned to them in the configuration file. It can be used to list all configured interfaces, check the state of specific interfaces, or even perform a syntax check on the interfaces configuration file.
CAVEATS
ifquery's primary function is to report on the configuration managed by the ifupdown system. It does not provide real-time kernel interface status as tools like ip link do. Its utility is limited to systems that utilize ifupdown for network configuration; it will not be relevant for systems using alternative network management solutions like NetworkManager, Netplan, or systemd-networkd.
CONFIGURATION FILES
The primary configuration file that ifquery consults is /etc/network/interfaces. This file defines network interfaces, their addresses, and other networking parameters. It can also include other configuration files using the source or source-directory directives.
EXIT STATUS
ifquery exits with a status of 0 on success. A non-zero exit status indicates an error, such as a malformed configuration file when using --syntax-check, or an invalid interface name.
HISTORY
ifquery is an integral part of the ifupdown package, which has been a foundational component for managing network interfaces on Debian and Ubuntu Linux distributions for many years. It provides a programmatic way to inquire about the state and configuration of interfaces managed by this traditional system, complementing the ifup and ifdown commands for activation and deactivation.