Table of Contents
ifupdown
ifupdown is the traditional network manager on GNU/Linux systems. It has since been replaced by systemd-networkd.
It was especially commmon in Debian systems before Debian 12 (Bookworm).
The “if” part is short for “interface”. “up” and “down” refer to ifup and ifdown commands, which are used to bring an interface link up and down + run some configuration scripts.
Install
On Debian 10 and Debian 11:
sudo apt install ifupdown
Don't install ifupdown if you're using a different network manager, such as systemd-networkd!
Manual
man ifupman ifdownman ifqueryman interfaces
/etc/network/interfaces
All configuration lies in /etc/network/ directory. The following is a list of files in that directory
$ ls /etc/network if-down.d if-post-down.d if-pre-up.d if-up.d interfaces interfaces.d
The main configuration file is /etc/network/interfaces. The *.d directories contain auxiliary configuration and scripts.
The following is the minimal possible configuration. It only configures the loopback interface. Configuring the loopback interface gives you addresses 127.0.0.1 (IPv4) and ::1 (IPv6). These are home addresses so that you can ping yourself ping 127.0.0.1 (hence why it's called a “loopback”). Lines that begin with '#' are comments. You can comment out or change any parts of the configuration file.
# /etc/network/interfaces # Loopback auto lo iface lo inet loopback # ... place your other config here ...
Configuration examples
To configure a loopback device (the only device that's technically necessary)
# Loopback
auto lo
iface lo inet loopback
To configure an eth0 interface dynamically (IPv4):
# IPv4 dynamic (DHCPv4)
allow-hotplug eth0
iface eth0 inet dhcp
To configure an eth0 interface statically (IPv4):
# IPv4 static
auto eth0
iface eth0 inet static
address 192.168.1.50
netmask 255.255.255.0
gateway 192.168.1.1
To configure an eth0 interface dynamically (IPv6):
The interface acquires IPv6 through SLAAC via Router Advertisements (RA).
No DHCPv6 required.
# IPv6 dynamic
auto eth0
iface eth0 inet6 auto
accept_ra
To configure an eth0 interface statically (IPv6):
# IPv6 static auto eth0 iface eth0 inet6 static address 2001:db8:1::50 netmask 64 gateway 2001:db8:1::1
To configure an eth0 interface statically (IPv4 + IPv6):
# IPv4 static block iface eth0 inet static address 192.168.1.50 netmask 255.255.255.0 gateway 192.168.1.1 # IPv6 static block iface eth0 inet6 static address 2001:db8:1::50 netmask 64 gateway 2001:db8:1::1
Full configuration (loopback + IPv4 + IPv6)
# /etc/network/interface # Loopback auto lo iface lo inet loopback # IPv4 static block iface eth0 inet static address 192.168.1.50 netmask 255.255.255.0 gateway 192.168.1.1 # IPv6 static block iface eth0 inet6 static address 2001:db8:1::50 netmask 64 gateway 2001:db8:1::1
Commands (ifup ifdown ifquery)
There are three commands you should know about
ifup- Reads/etc/network/interfaceand brings an interface upifdown- Reads/etc/network/interfaceand brings an interface downifquery- Reads/etc/network/interfaceand tells you some information about the interface
Bringing an eth0 interface up:
# ifup eth0
Bringing all interfaces up
# ifup -a
Bringing eth0 interface down
# if down eth0
These examples assume your network interface is named eth0 by udev.
Relation to ifconfig and route
The commands ifconfig and route seem related to ifup, ifdown and ifquery. However the former two are rather low-level commands that modify the kernel state. The latter three are high-level commands that sit on top of the former two.
The ifconfig and route commands are themselves considered legacy and replaced with ip command (provided by iproute2 package) in a similar way systemd-networkd replaces ifupdown.
