BETTER NETWORKING FOR UBUNTU

SETUP

Define a hostname

vi /etc/hostname # short name is fine
hostname HOSTNAME # idem
vi /etc/hosts # long name FOLLOWED BY short name

Switch back to the old school /etc/network/interfaces (unless you prefer netplan)

apt update
apt install net-tools ifupdown

rmdir /etc/network/interfaces.d/
#mv /etc/network/interfaces.d/50-cloud-init.cfg /etc/network/interfaces.fuck.the.cloud-init.cfg
mv /etc/network/interfaces /etc/network/interfaces.dist

and proceed with a typical Debian network setup

vi /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address x.x.x.x/xx
    gateway x.x.x.x
    dns-nameservers x.x.x.x
    #dns-nameservers 208.67.222.222 208.67.220.220
    #dns-search example.local

Apply, check that your local and caching stub-resolver points to your true validating resolver

systemctl restart networking
ifconfig
systemd-resolve --status

and see next section for disabling netplan at boot time

Eventually disable UFW

ufw disable

and if you really need to enable system firewalling see Netfilter

ADDITIONAL NOTES

name resolution

systemctl list-unit-files | grep resolv

cd /etc/
ls -lhF resolv.conf*
mv resolv.conf resolv.conf.dist
cat > resolv.conf <<-EOF
search example.local
nameserver 208.67.222.222
nameserver 208.67.222.220
EOF
cat resolv.conf

//older releases

#systemctl status resolvconf
#systemctl stop resolvconf
#systemctl disable resolvconf

//artful debian9/stretch bionic

systemctl status systemd-resolved
systemctl stop systemd-resolved
systemctl disable systemd-resolved

#more shit seen on a bionic dedibox
systemctl stop bind9
systemctl disable bind9
systemctl status bind9-resolvconf

TROUBLESHOOTING

In case you get,

RTNETLINK answers: File exists

while restarting networking, look at the logs and proceed against the relevant interface,

ip addr flush dev NETIF

RESOURCES

How to install Ubuntu 17.10 (Artful Aardvark) Minimal Server - Page 2 https://www.howtoforge.com/tutorial/ubuntu-minimal-server-install/2/

no symlink for resolv.conf Comment 7 for bug 548885 https://bugs.launchpad.net/ubuntu/+source/ntp/+bug/548885/comments/7


HOME | GUIDES | BENCHMARKS | html