Ubuntu 18.04 used a YAML based file with Netplan to configure the networking. I need to set up a server for virtualisation hosting with bonded uplinks to the ethernet switch.
This page build on the basic config to have a bonded ethernet with a vlan driver next to pick off vlans from the bond0 interface, and then the bridging driver on the vlans to allow a guest to connect to any vlan presented.
network: version: 2 renderer: networkd ethernets: ens3: dhcp4: yes
network: version: 2 renderer: networkd ethernets: ens3: addresses: - 192.168.5.YYY/24 gateway4: 192.168.5.ZZZ nameservers: search: [rainsbrook.co.uk, sub.rainsbrook.co.uk] addresses: [192.168.5.XXX, 1.1.1.1]
This renames the “newer” style of naming ethernet to the more traditional eth0/1/2 etc based on the MAC address of the interface.
network:
version: 2
renderer: networkd
ethernets:
eth0:
match:
macaddress: 00:30:48:c0:ff:ee
dhcp4: no
dhcp6: no
optional: true
set-name: eth0
eth1:
match:
macaddress: 00:fe:de:ad:be:ef
dhcp4: no
dhcp6: no
optional: true
set-name: eth1
bonds:
bond0:
interfaces: [ eth0, eth1 ]
dhcp4: no
dhcp6: no
parameters:
mode: active-backup
primary: eth0
vlans:
vlan5:
accept-ra: no
id: 5
link: bond0
dhcp4: no
dhcp6: no
vlans:
vlan7:
accept-ra: no
id: 7
link: bond0
dhcp4: no
dhcp6: no
bridges:
br1:
addresses: [ 192.168.1.x/24 ]
dhcp4: no
dhcp6: no
interfaces: [ bond0 ]
gateway4: 192.168.1.1
nameservers:
addresses: [ 192.168.1.x ]
search: [ domain1.co.uk, domain1.int ]
br5:
dhcp4: no
dhcp6: no
interfaces: [ vlan5 ]
br7:
dhcp4: no
dhcp6: no
interfaces: [ vlan7 ]
/etc/resolv/conf is now a symlink as below:-
root@argon:~# ls -l /etc/resolv.conf lrwxrwxrwx 1 root root 39 Apr 3 08:41 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf root@argon:~# ls -l /run/systemd/resolve/* -rw-r--r-- 1 systemd-resolve systemd-resolve 633 Apr 3 12:04 /run/systemd/resolve/resolv.conf -rw-r--r-- 1 systemd-resolve systemd-resolve 760 Apr 3 12:04 /run/systemd/resolve/stub-resolv.conf
Two choices seem to exist, the resolv.conf file is the one updated by netplan, so let's use this:-
root@argon:~# ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf ln: failed to create symbolic link '/etc/resolv.conf': File exists root@argon:~# mv /etc/resolv.conf /etc/resolv.conf.orig root@argon:~# ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf root@argon:~# rm /etc/resolv.conf.orig
You could just use ln -sf to force the link creation, but if something goes wrong, you loose the original file.
Test with dig or nslookup and resolution should work as expected.