NZ Techonverse: Manually specifying network interface parameters on Debian

First published on NZ Techonverse

I have two computers I use regularly which have two (or with a Vodem, three) network adapters. The reason for this is at present I have two different internet connections I use regularly. One is unlimited data but has certain restrictions on it, the second is unrestricted but has a data cap. I hope to soon move to a single unrestricted connection but that is very dependent on progress with Vodafone who have so far caused four months of delays in getting connected.

One of the computers has LXQt on top of Debian, the other has KDE. Both are set up to use manually specified adapter settings in the /etc/network/interfaces file. This has continued to be the case when reinstalled and somehow in the past the user profile settings controlling this must have been set up because it keeps working with each reinstallation.

A typical entry in the file will look something like

auto enp1s0
allow-hotplug enp1s0
iface enp1s0 inet dhcp

if you are using DHCP to set up the connection.

For a static configuration the entry will look like this:

auto enp1s0
allow-hotplug enp1s0
iface enp1s0 inet
static
address aaa.bbb.ccc.ddd
netmask 255.255.255.0
gateway eee.fff.ggg.hhh

Whilst I am unaware of exactly what all these parameters mean, this is what is working for me on these computers. enp1s0 is the system generated name for the network adapter. This can however be renamed with an entry like

rename oldname=newname

which is placed at the top of a set of entries for an interface.

The rest is pretty self explanatory hopefully. If you have a second network adapter as in my case, another group of entries in the file can set that up as well.

After editing and saving the interfaces file, issue this command to reload the networking configuration:

systemctl restart networking

However this is apparently being deprecated and instead you should use the commands ifdown and ifup e.g.

ifdown enp1s0

ifup enp1s0

Then type in ip addr to check the settings and maybe a ping, traceroute or two to ensure the default gateway is correct. Google provides a couple of servers that can be tested against, these are 8.8.8.8 and 1.1.1.1

The man page for interfaces gives more information on how to set the network interfaces up.

Read More