Preface
I've been working with Debian and its various flavors as a daily driver for several years now. It truly is a universal operating system. From hundred-terabyte servers to simple ARM routers, I've run it on everything that it's feasible to run it on.
For me, the reason I love Debian is it's pure simplicity. Everything is built for bare-bones, little-effort-required simplicity. Installing packages, managing updates, changing network settings, managing services, it's all built to be simple.
This is the start of a series of guides on Debian’s networking setup. This is also the same networking setup as Ubuntu up to version 16.04.
The Basics
On Debian, all network configuration goes in one file.
# Default Debian Network Configuration
## The loopback interface
auto lo
iface lo inet loopback
## The first Ethernet interface
auto eth0
iface eth0 inet dhcp
## End
This is a bare-bones configuration. It establishes the loopback interface, and has the first Ethernet interface request an IP through DHCP.
Static Addresses
Assigning a static address is just as easy, if a little longer.
# Static IP Debian Network Configuration
## The loopback interface
auto lo
iface lo inet loopback
## The first Ethernet interface
auto eth0
iface eth0 inet static
address 192.168.0.2 # The address for the server
netmask 255.255.255.0 # The subnet mask for the network
gateway 192.168.0.1 # The address of the router
dns-nameservers 1.1.1.1 1.0.0.1 # DNS servers
dns-domain example.com # DNS domain
dns-search example.com # DNS search
The DNS options override everything in /etc/resolv.conf.