Kiến Thức Linux

ifup Command in Linux

ifup Command in Linux


The Linux ifup command allows you to view network interfaces in the terminal. It is often used with ifdown and ifquery commands.

The following text elaborates on the ifup command in Linux, its options, and use cases.

ifup Command in Linuxifup Command in Linux


  • Access to the terminal.
  • Linux system (this tutorial uses Ubuntu 22.04).
  • sudo or root privileges.

Note: To ensure correct ifup functionality, the /run/network/ifstate file must be writable. If this proves challenging, solutions include employing the sudo command, obtaining root privileges, or using the –force option. Alternatively, create a symbolic link for /run/network/ifstate leading to a location with write permissions.

ifup Command Syntax

The ifup command follows this syntax:

ifup [options] [interface] 

Executing ifup without specifying any options or interface does not generate any output. While the [interface] components are obligatory, options are not. Options tailor the command to specific requirements.

Note: If your system doesn’t have ifup, run the command below.

sudo apt install ifupdown

ifup Command Options

The ifup command produces varied output based on different arguments. The table below lists the available options.

Option Description
-v, --verbose  Displays what happens before executing the command.
--force  Forces configuration.
--ignore-errors  Ignores errors.
-o OPTION=VALUE  Sets a specific network configuration option to a specified value, treating it as defined in the /etc/network/interfaces file.
--no-scripts  Does not run any hook scripts.
--no-loopback  Does not treat the loopback device differently from other network interfaces.
-n, --no-act  Prints out the actions that would occur without executing the command.
-a, --all  Processes all interfaces marked as automatically activated at the startup.
-h, --help  Shows the help message.
-V, --version  Prints copyright and version information.
-i, --interfaces FILE  Allows users to specify a custom file for defining network interface configurations.
--state-dir DIR Instructs the command to use a specific directory to store state information.
-X, --exclude PATTERN  Excludes interfaces from the operation based on a specified PATTERN.
--no-mappings Stops extra network configuration rules or settings specified through mappings. This allows the network interface to be brought up with minimal or default configuration.

Note: The --force argument resolves a common problem with ifup. Network interface records occasionally don’t accurately reflect the actual states, leading to inconsistencies. When this occurs, using --force allows ifup to carry out configuration commands regardless of the interfaces’ current state.

ifup Command Examples

Because ifup supports various arguments, it has multiple practical use cases. However, before executing ifup, users must be aware of the specific interface names. To determine these names, execute the ip command or the deprecated ifconfig command.

Confirm the interface’s names with:

ip link show
ip link show terminal outputip link show terminal output

The second option to verify interfaces is by using:

ifconfig -a
ifconfig -a terminal outputifconfig -a terminal output

Note: The ifconfig command is not available on all Linux systems. To install it, execute the command below.

sudo apt install net-tools

To make sure interfaces are active, use ping. For instance, ping

Pinging google.comPinging

For this tutorial, first execute ifdown to turn off all the interfaces:

sudo ifdown -av
sudo ifdown -avsudo ifdown -av

The command produces verbose output. To verify all interfaces are down, use ifconfig, ip, or ping. For instance:

ifconfig -a
ifconfig -a terminal output when all interfaces are downifconfig -a terminal output when all interfaces are down

The output shows interfaces are down.

The following text presents practical ifup usage examples.

Bring up a Specific Interface

To activate a specific network interface, run the following syntax:

sudo ifup [interface]

For instance, turn on the enp0s3 interface with:

sudo ifup enp0s3

The command produces no output. Verify the interface is working with ifconfig, ip, or ping.

Print Verbose Output

To display additional info in the command output, run the command with -vFor instance, bring up the lo interface with:

sudo ifup -v lo
sudo ifup lo -v terminal outputsudo ifup lo -v terminal output

Note: In general, the interface name alone should be sufficient when bringing up the interface. Therefore, sudo ifup -v [interface] is the typical syntax. However, in some configurations, the syntax is sudo ifup -v [interface] [configuration]. For example, sudo ifup -v lo=lo.

Activate all Interfaces

To bring up all interfaces and get the verbose mode, run:

sudo ifup -av
sudo ifup -avsudo ifup -av

Ignore Errors

The argument –ignore-errors instructs the system to bring up network interfaces and to proceed with the activation even if errors are encountered during the process.

For instance, to bring up all interfaces, print verbose output, and ignore errors, run:

sudo ifup --ignore-errors -av
sudo ifup --ignore-errors -av terminal outputsudo ifup --ignore-errors -av terminal output

Exclude an Interface

The --exclude option allows users to specify an interface to be excluded from the list. The syntax for this command is:

sudo ifup --exclude [interface]

For instance, exclude the lo interface with:

sudo ifup --exclude lo

The command has no output.

Simulate Interface Activation

Using the --no-act option is beneficial when users wish to preview the changes that occur while activating a network interface without actually applying those changes. The syntax is:

ifup --no-act [interface]

For example, simulate ifup on the lo interface without executing the command with:

sudo ifup --no-act -v lo
sudo ifup --no-act terminal outputsudo ifup --no-act terminal output

Note:While many Linux distributions have basic networking capabilities installed by default, sometimes automatic network adjustments for hardware changes may require additional packages. To determine if these extra packages are installed and necessary for your specific requirements, refer to the system documentation or consult the package manager.


After reading this tutorial, you are now familiar with the Linux ifup command, syntax, options, and common use case examples.

For more essential commands for networking, check out our Linux network commands cheat sheet.

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !