Are you seeing the error -bash: ifup: command not found (or ifdown: command not found) on your Ubuntu or Debian system? These commands are part of the legacy ifupdown
package, which is used to bring network interfaces up or down based on the configuration defined in /etc/network/interfaces
file. If these commands are missing in your system, the ifupdown package is not installed – which is common in newer versions of Ubuntu and Debian that use Netplan or NetworkManager instead.
What the commands in ifupdown do:
- ifup – Brings a network interface online using its configuration in
/etc/network/interfaces
- ifdown – Takes a network interface offline
- ifquery – Parses and displays configuration information for a network interface
To have the commands working, simply install the package:
sudo apt update && sudo apt install ifupdown
It’s a lightweight package, so the installation should complete quickly.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
ppp rdnssd
The following NEW packages will be installed:
ifupdown
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 62.1 kB of archives.
After this operation, 204 kB of additional disk space will be used.
Get:1 file:/etc/apt/mirrors/debian.list Mirrorlist [30 B]
Get:2 https://deb.debian.org/debian bookworm/main amd64 ifupdown amd64 0.8.41 [62.1 kB]
Fetched 62.1 kB in 0s (1375 kB/s)
Selecting previously unselected package ifupdown.
(Reading database ... 27702 files and directories currently installed.)
Preparing to unpack .../ifupdown_0.8.41_amd64.deb ...
Unpacking ifupdown (0.8.41) ...
Setting up ifupdown (0.8.41) ...
Created symlink /etc/systemd/system/multi-user.target.wants/networking.service → /lib/systemd/system/networking.service.
Created symlink /etc/systemd/system/network-online.target.wants/networking.service → /lib/systemd/system/networking.service.
Processing triggers for man-db (2.11.2-2) ...
After the installation is done, you can use ifup, ifdown, and ifquery as expected.
$ which ifup
/usr/sbin/ifup
$ which ifdown
/usr/sbin/ifdown
$ which ifquery
/usr/sbin/ifquery
Below is an example of a network configuration file used to create an OVS (Open vSwitch) bridge:
auto ovsbr0
iface ovsbr0 inet static
ovs_type OVSBridge
ovs_ports ens8
address 172.35.1.2
netmask 255.255.255.0
auto ens8
iface ens8 inet manual
ovs_bridge ovsbr0
ovs_type OVSPort
To bring up the interface using ifup
, run the following command:
sudo ifup ovsbr0
Confirm that the interface is up using the following command:
$ ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:52:a9:b0 brd ff:ff:ff:ff:ff:ff
altname enp0s3
inet 172.35.1.210/24 metric 100 brd 172.35.1.255 scope global dynamic ens3
valid_lft 3139sec preferred_lft 3139sec
inet6 fe80::5054:ff:fe52:a9b0/64 scope link
valid_lft forever preferred_lft forever
3: ens8: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 52:54:00:cf:59:7a brd ff:ff:ff:ff:ff:ff
altname enp0s8
4: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether ea:8d:24:ee:92:5f brd ff:ff:ff:ff:ff:ff
5: ovsbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether 66:fc:d3:58:94:4c brd ff:ff:ff:ff:ff:ff
inet 172.35.1.2/24 brd 172.35.1.255 scope global ovsbr0
valid_lft forever preferred_lft forever
inet6 fe80::64fc:d3ff:fe58:944c/64 scope link
valid_lft forever preferred_lft forever