LinuxCommandLibrary

ifdown

Deactivate network interface

TLDR

Disable interface eth0

$ ifdown [eth0]
copy

Disable all interfaces which are enabled
$ ifdown [[-a|--all]]
copy

SYNOPSIS

ifdown [OPTIONS] INTERFACE...

PARAMETERS

INTERFACE...
    One or more network interfaces to bring down (e.g., eth0, wlan0).

-a, --all
    Bring down all interfaces configured in /etc/network/interfaces that are currently up and have a 'down' stanza or are implicitly handled.

--allow=CLASS
    Limit operations to interfaces belonging to a specific CLASS (e.g., auto, hotplug).

--exclude=PATTERN
    Exclude interfaces matching PATTERN from being processed when -a is used.

-f, --force
    Force operations, ignoring errors or allowing actions normally prevented.

-i FILE, --interfaces=FILE
    Specify an alternative interfaces configuration FILE instead of /etc/network/interfaces.

--ignore-errors
    Continue processing other interfaces even if one fails.

-n, --no-act
    Dry run; show what would be done without making actual changes.

--no-scripts
    Do not run any scripts defined in the interface configuration stanzas (e.g., pre-down, post-down).

-v, --verbose
    Provide detailed output of actions being performed.

DESCRIPTION

The ifdown command is a critical utility within Linux networking, primarily used on systems leveraging the ifupdown package (common on Debian/Ubuntu-based distributions). Its core function is to logically deactivate specified network interfaces, effectively bringing them "down."

When invoked for a particular interface, ifdown reads its configuration from the /etc/network/interfaces file. It then proceeds to remove any assigned IP addresses, delete associated routes, and execute any scripts defined in the interface's 'down', 'pre-down', or 'post-down' stanzas. This process ensures a clean shutdown of the network connection for that interface.

It's often used in conjunction with ifup, which performs the opposite action of activating an interface. ifdown requires root privileges to operate and is vital for managing network connectivity, troubleshooting, and applying network configuration changes.

CAVEATS

Requires superuser (root) privileges to execute.
Can disrupt network connectivity; use with caution on active interfaces.
Primarily used on Debian/Ubuntu-based systems and relies on the ifupdown package. Other distributions might use different network management tools (e.g., ip, nmcli, netplan).
Relies heavily on the configuration in /etc/network/interfaces.
May not fully clean up external network configurations not directly managed by ifupdown.

CONFIGURATION FILE

The primary configuration for ifdown is found in /etc/network/interfaces. This file defines how each network interface should be handled, including details like IP addresses, netmasks, gateways, and the execution of pre/post scripts when interfaces are brought up or down.

PERMISSIONS

ifdown requires superuser (root) privileges to execute, as it modifies system-level network configurations. Users typically run it with sudo.

HISTORY

The ifupdown suite, which includes ifup and ifdown, has been a cornerstone of network configuration on Debian-based Linux systems for decades. It provides a simple, script-driven approach to configure interfaces based on static files. While modern distributions and desktop environments increasingly adopt network management tools like NetworkManager or systemd-networkd for dynamic or complex setups, ifupdown remains widely used for server environments and static configurations due to its simplicity, reliability, and long-standing presence. Its development is tied to the broader ifupdown project, ensuring continued maintenance and compatibility for traditional use cases.

SEE ALSO

ifup(8), interfaces(5), ip(8), netplan(5), nmcli(1)

Copied to clipboard