How does one set up tun and tap interfaces on systems that use netplan?
Normally you'd use pre-up in /etc/network/interfaces to call ip tuntap for creating the interface, but I haven't found anything in the netplan docs to do this.
How does one set up tun and tap interfaces on systems that use netplan?
Normally you'd use pre-up in /etc/network/interfaces to call ip tuntap for creating the interface, but I haven't found anything in the netplan docs to do this.
I ran into this problem when upgrading to 18.04 broke my tap based OpenVPN server. It is quite annoying when a headless server just stops working because Ubuntu dropped support for defining bridges in /etc/network/interfaces. There are a few examples already but pretty much you need to create a .yaml file in /etc/netplan that looks something like one of the configs below. Note that you will need the
bridge-utils
package installed.Replace
eth0
with the name of your ethernet device. You can find this usingifconfig -a
.Additionally you can set the MAC address of the bridge using the
macaddress: xx:xx:xx:xx:xx:xx
option wherexx:xx:xx:xx:xx:xx
is replaced with the address you want to use./etc/netplan/00-bridge.yaml
For DHCP:
For a static IP:
I didn't find a way to do a tap interface from netplan yaml file, I think you will have to read in deep the reference manual from web page. It is possible the tunnel interface with gretap mode should be a solution. Anyway my advice is use the ip command in a boot script in systemd for example, if you wanna to configure it fast.
/usr/bin/tap.sh
/lib/systemd/system/tap.service
Netplan docs: https://netplan.io/reference/#properties-for-device-type-tunnels%3A