Low Orbit Flux Logo 2 F

Debian Networking

Three options for network configuration:

Using the interface file is generally a good option for a desktop or other system that will probably not be moving. The Network Manger is a better choice for laptops or systems that my change frequently. Another modern choice is systemd-networkd.

Useful Commands

List interfaces on the system using one of the following commands:


ls /sys/class/net 
ifconfig -a
ip a

Bring an interface up and down:


ifdown enp3s0
ifup enp3s0

Check the status of networking:


systemctl status networking

Debian Networking - DHCP Setup

You can setup interfaces to use DHCP using the interfaces file.

DHCP:

/etc/network/interfaces
auto eth0 allow-hotplug eth0 iface eth0 inet dhcp

DHCP, IPv6:

/etc/network/interfaces
iface eth0 inet6 dhcp

Restart networking:


systemctl restart networking

Debian Networking - Static IP Setup

You can also setup interfaces to use Static IP addresses using the interfaces file.

Setup static IP address with IPv4:

/etc/network/interfaces
auto eth0 iface eth0 inet static address 192.0.3.25/24 gateway 192.0.3.1

Setup static IP address with IPv6:

/etc/network/interfaces
iface eth0 inet6 static address 2001:db8::c0ca:1eaf/64 gateway 2001:db8::1ead:ed:beef

Setup DNS Nameservers:

/etc/resolv.conf
nameserver 8.8.8.8 nameserver 8.8.4.4

Restart networking:


systemctl restart networking

Network Manager

Network manager will not configure any interface that is defined in the /etc/network/interfaces file unless the following is set:

/etc/NetworkManager/NetworkManager.conf
managed=true

Network Manager components:

network-manager backend service
nmcli CLI
nmtui another CLI
nm-tray GUI widget
network-manager-gnome Gnome GUI
plasma-nm KDE GUI

Systemd

This will show you how to use systemd instead of the interfaces file for networking.

First move the interfaces file out of the way.


mv /etc/network/interfaces /etc/network/interfaces.save

Next, enable systemd-networkd but don’t restart yet.


systemctl enable systemd-networkd

Systemd network configuration files can be placed here:

/etc/systemd/network/

A dynamic configuration would look like this:

/etc/systemd/network/dhcp.network
[Match] Name=en* [Network] DHCP=yes

A static configuration would look like this:

/etc/systemd/network/static.network
[Match] Name=en* [Network] Address=192.168.3.25/24 Gateway=192.168.3.1 DNS=8.8.8.8

Once the configuration files are in place reboot the system to make the changes effective and to make sure that it works as it should.

Other components:

Releases

Here is a table of Debian releases that I keep find myself needed to look at:

Debian 12 (bookworm) testing
Debian 11 (bullseye) current stable release
Debian 10 (buster) current oldstable release
Debian 9 (stretch) oldoldstable release, under LTS support
Debian 8 (jessie) archived release, under extended LTS support
Debian 7 (wheezy) obsolete stable release
Debian 6.0 (squeeze) obsolete stable release
Debian 5.0 (lenny) obsolete stable release
Debian 4.0 (etch) obsolete stable release
Debian 3.1 (sarge) obsolete stable release
Debian 3.0 (woody) obsolete stable release
Debian 2.2 (potato) obsolete stable release
Debian 2.1 (slink) obsolete stable release
Debian 2.0 (hamm) obsolete stable release

References