Before you begin open a terminal with root user privileges.
There are 3 files that need to be edited.
First, edit the /etc/hosts file
nano /etc/hosts
Create a new line to show
127.0.0.1 <myhostname>.<myworkgroup/domain> <myhostname>
Press ctrl+o, then Enter to save. ctrl+x to quit
Edit the Hostname file
nano /etc/hostname
Optionally you could use the output redirect operator
echo "<myhostname>" > /etc/hostname
Edit the interfaces file
nano /etc/network/interfaces
If you’re using DHCP you can use the following
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
Or more likely if you would like to statically configure your IP address
auto eth0
iface eth0 inet static
address 192.0.2.7/24
gateway 192.0.2.254
If you prefer netmask in dot-decimal notation to CIDR notation you can use
auto eth0
iface eth0 inet static
address 192.0.2.7
netmask 255.255.255.0
gateway 192.0.2.254
Update your system
apt update && apt upgrade -y
Edit your DNS settings. DNS settings can either be obtained via DHCP or by configuring it manually through the /etc/resolv.conf file
nano /etc/resolv.conf
Then add your 3 allowed name servers in order of fail-over
nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 208.67.222.222
You could be using your Pi-Hole or your forward proxy DNSMASQ for your first name server.
Reboot
reboot