Interfaces configuration file:

The network interfaces in Debian may be set in two locations, the /etc/networks/interfaces file is the primary place for network configuration setups. The second place for network configuration files is under /etc/networks/interfaces.d/ directory, where network configuration files can be placed in a file format rather than putting everything in one interface file, that is managed by the networking.service daemon, which is a wrapper around the ifup and ifdown commands, both of which are wrappers around ifconfig (or ip for ifupdown2). see man interfaces for more options. Before you start, make sure you have a Debian server instance installed and you have a sudo user configured.

This guide covered the following version of Debian, but was not limited to:

  • Debian 8 Jessie
  • Debian 9 Stretch
  • Debian 10 Buster
  • Debian 11 Bullseye
  • Debian 12 Bookworm

Useful Command:

##Check Network Info##

ip link
ifconfig        #need to install net-tools
ip address
ip -c link show
ip -br -c link show
lshw -class network

##Restart the networking service to apply changes to /etc/network/interfaces##
ifdown eth0
ifup eth0
##Reinitialize new network setup##
systemctl status networking
systemctl restart networking
systemctl restart ifup@eth0
/etc/init.d/network restart
systemctl restart NetworkManager.service

##Other Tools##
nmtui
nmcli ethtool

DHCP configuration:


##/etc/network/interfaces##

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

Configuring the interface manually (static):


##/etc/network/interfaces##

##allow-hotplug
auto eth0
iface lo inet loopback
iface eth0 inet static
    address 10.0.0.50/24
    gateway 10.0.0.100
    dns-nameservers 1.1.1.2 9.9.9.9

##OR##

auto eth0 
iface lo inet loopback
iface eth0 inte static
address 10.0.0.50 
netmask 255.255.255.0 
gateway 10.0.0.100
dns-nameservers 1.1.1.2 9.9.9.9  #/etc/resolv.conf#

Applying New Network Settings

If you've already made all of the changes you wish to implement, you may just reboot the system, but this may take too long. The following command may make things simpler for you. Use commands ifup and ifdown to apply changes to that interface, for example with an interface named eth0:

Bring the interface down: ifdown eth0 , and then the interface back online: ifup eth0 will apply the new setting.

Note: ifconfig is a general tool for configuring network interfaces, if you are using NetworkManager (most likely you are if you use the GUI), will not apply the settings and restarting will not help in this scenario.

References