published: 2nd of November 2019
Ubuntu 1804 server uses netplan for network management. This post will cover how to create a bridge interface with netplan in order to have multiple virtual machines share the same physical interface.
Create the following /etc/netplan/01-netcfg.yaml file in order to configure the bridge interface.
sudo tee /etc/netplan/01-netcfg.yaml > /dev/null << "EOF"
network:
version: 2
renderer: networkd
ethernets:
eno1:
dhcp4: no
dhcp6: no
bridges:
br0:
interfaces: [eno1]
dhcp4: no
dhcp6: no
addresses: [10.0.0.10/24]
gateway4: 10.0.0.1
nameservers:
addresses: [10.0.0.5]
parameters:
stp: false
forward-delay: 0
EOF
There are a couple of things I would like to highlight.
Rename the default cloud-init network file. This will prevent cloud-init from attempting to configure the network on reboot.
sudo mv /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.old
Finally disable network portion of the cloud-init config by creating the the below /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg file.
sudo tee /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg > /dev/null << "EOF"
network: {config: disabled}
EOF
This post covered how to create a bridge interface using netplan on Ubuntu 1804 server edition. This allows you to have multiple VMs share a single physical interface.
https://help.ubuntu.com/lts/serverguide/libvirt.html.en
https://www.hiroom2.com/2018/05/11/ubuntu-1804-kvm-en/
https://www.linuxtechi.com/install-configure-kvm-ubuntu-18-04-server/
https://www.mankier.com/1/osinfo-query
https://www.itzgeek.com/how-tos/linux/centos-how-tos/install-kvm-qemu-on-centos-7-rhel-7.html
https://askubuntu.com/questions/971126/17-10-netplan-config-with-bridge