I have configured my network interfaces in my Ubuntu bionic (18.04)
server using netplan
, and afterwords I ran netplan apply
and the configuration kicked in.
In particular, I configured the DNS servers, and my server did resolved ips with the nameservers I configured in my netplan
configuration.
But, after reboot, the configuration didn't last and any resolving was by default to the 127.0.0.53
nameserver. Only after running netplan apply
the configuration kicked in again.
How can I make the netplan
configuration persistent to reboots?
Output of cat /etc/*-release
:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
Output of cat /etc/network/interfaces
:
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
My netplan yaml files:
10-nameservers.yaml
:
network:
version: 2
ethernets:
ens160:
nameservers:
addresses: [127.0.0.1]
50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
ens160:
addresses: []
dhcp4: true
dhcp-identifier: mac
version: 2
interfaces_ens160.yaml
network:
ethernets:
ens160:
addresses: [172.16.0.1/16]
dhcp4: 'no'
dhcp6: 'no'
gateway4: 172.16.100.1
nameservers:
addresses: [10.0.0.8, 8.8.8.8, 10.15.0.18]
version: 2
cat /etc/netplan/*.yaml
andcat /etc/network/interfaces
. Report back.interfaces_ens160.yaml
and10-nameservers.yaml
... And my system demands an static IP. Both nameservers are needed... After runningnetplan apply
this conf works perfectly, but when the server reboots, the conf doesn't seem to be applied... @heynnemadpkg -l *dnsmasq* and
ls -al /etc/resolv.conf` andcat /etc/resolv.conf
.