← 返回命令列表

Linux command

ifdown 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Disable

ifdown [eth0]

Disable all

ifdown -a

Show

ifdown -n [eth0]

Force

ifdown --force [eth0]

Verbose

ifdown -v [eth0]

Use an alternate

ifdown -i [/path/to/interfaces] [eth0]

说明

ifdown brings down network interfaces that were previously configured with ifup. It reads interface definitions from /etc/network/interfaces and executes the appropriate commands and scripts to deconfigure the interface. The command performs any necessary cleanup including removing IP addresses, stopping DHCP clients, and running user-defined scripts defined in the interfaces file.

参数

-a, --all
Affect all defined interfaces, brought down in the order listed in the state file.
--allow _CLASS_
Only act on interfaces listed in an `allow-CLASS` stanza in /etc/network/interfaces (e.g. `allow-hotplug`).
-i _FILE_, --interfaces=_FILE_
Read interface definitions from _FILE_ instead of /etc/network/interfaces.
--state-dir=_DIR_
Keep interface state in _DIR_ instead of /run/network.
-X _PATTERN_, --exclude=_PATTERN_
Exclude interfaces matching _PATTERN_.
-o _OPTION=VALUE_
Set _OPTION_ to _VALUE_ as if defined in /etc/network/interfaces.
-n, --no-act
Don't configure any interfaces or run up/down commands (dry run).
-v, --verbose
Show commands as they are executed.
-f, --force
Force deconfiguration even if ifupdown believes the interface is not up.
--ignore-errors
Continue even if a command or script fails.
--no-mappings
Do not run mappings during deconfiguration.
--no-scripts
Don't run any scripts under /etc/network/if-*.d/.
-V, --version
Show copyright and version information.
-h, --help
Show summary of options.

FAQ

What is the ifdown command used for?

ifdown brings down network interfaces that were previously configured with ifup. It reads interface definitions from /etc/network/interfaces and executes the appropriate commands and scripts to deconfigure the interface. The command performs any necessary cleanup including removing IP addresses, stopping DHCP clients, and running user-defined scripts defined in the interfaces file.

How do I run a basic ifdown example?

Run `ifdown [eth0]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --all do in ifdown?

Affect all defined interfaces, brought down in the order listed in the state file.