How to Add a Bridge Network on Ubuntu 18.04 Server

In order for your VMs or guest machines to communicate with each other or with the host, you should set a bridge network on your hypervisor.

To do this, edit the default network file :

sudo nano /etc/netplan/50-cloud-init.yaml

Then, add the below content to the file.  Remember to replace eno1 with the name of your interface and 192.168.0.50with the correct IPV4 address.

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    eno1:
      dhcp4: no
      dhcp6: no  
  bridges:
    br0:
      interfaces: [eno1]
      dhcp4: no
      addresses: [192.168.0.50/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [192.168.0.1]

Then, on the guest machine, the network files should look as shown below:

# This is the network config written by 'subiquity'
network:
  version: 2
  ethernets:
    ens3:
      dhcp4: no
      addresses: [192.168.0.14/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [192.168.0.1]

Remember to apply the settings by running:

sudo netplan apply

 

Ads by Google

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.