Open In App

ifdown command in Linux with Examples

Last Updated : 24 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The ‘ifdown’ command in Linux is a vital tool for system administrators and network engineers. It is used to bring network interfaces down, essentially disabling them so they cannot transmit or receive data. Unlike the ‘ifup command, which activates the network interface, ‘ifdown’ places the interface in a non-operational state, preventing it from handling network traffic.

Here, we will cover everything you need to know about the ‘ifdown’ command, its syntax, options, and practical examples.

Syntax

 ifdown [-nv] [--no-act] [--verbose] [-i FILE|--interfaces=FILE] [--allow CLASS] -a|IFACE... 

where,

  • IFACE refers to the network interface (e.g., eth0, wlan0) you want to bring down.
  • ‘-a’ is used to bring down all network interfaces defined in ‘/etc/network/interfaces‘.

Key Options Available with ifdown Command

1. -a(–all)

This option is used to bring all the interfaces down which are defined in ‘/etc/network/interfaces’. -a(--all)

2. –allow=CLASS

This option will only allow interfaces listed in an allow-CLASS line in ‘/etc/network/interfaces‘ to be acted upon.

3. -v(–verbose)

Display detailed information about the commands being executed.

4. -V(–version)

Show version and copyright information of the ifdown command.

ifdown Command Example in Linux

Let us execute a ping command to check the working of my interfaces, they are already configured.

Now try to down the interface down using the following command. Here, sudo is used for permissions, ‘-a’ to work on all devices and v for verbose the output.

sudo ifdown -av

Let us check our ping test and browser.

Conclusion

The ifdown command is an essential tool for managing network interfaces in Linux. By learning how to bring down interfaces selectively or all at once, you can control network traffic, perform maintenance tasks, or troubleshoot network issues with ease. Understanding the available options, such as verbose output, class filtering, and simulation mode, further enhances your ability to manage complex network setups efficiently.



Next Article
Article Tags :

Similar Reads