My objective is simple, I want to use my Ubuntu server which has one physical ethernet interface as a bridge networking device to which, so that my VMs can attach to it and talk to other devices on the LAN and the internet. I don't want to use NAT.

Now the issue I've been facing the past few days is that when I get VM to run on my LAN and talk to the internet, my server DNS gets messed up and becomes unable to connect to the internet. I have to manually go tweak the dns settings and I feel that what I'm doing is a band-aid solution and not the correct method.

Here's my understanding: a bridge interface is a software network switch which can have ports assigned to it. It can contain multiple L3 devices like a typical network. When I create a bridge using ip utility, the typical use case scenario is to use the linux box as a switch and "bridge" multiple ethernet ports on it which may separately connect to an edge router/firewall and internal LAN. The ethernet ports become a slave to a virtual bridge interface which takes all packets coming into the slave interface.

I thought that by creating this bridge interface I would be able to utilize my single ethernet interface for all my 2 VMs that run on my machine PLUS my host itself. But here's the catch: when I assign the bridge a static IP address, who gets the IP address? Is it a switched virtual interface? The host? The VM?

What is the correct way to use bridge interfaces, and is a bridge even needed in this scenario? Thanks.

  • Please note that if you don't want to use NAT all VMs will have to get IP addresses from the outside - the computer needs more than one IP address if VMs need to communicate with the outside world. An exception would be if you only want to map certain ports on the computer to one of the VMs.
    – Ned64
    Feb 24, 2020 at 10:10
  • @Ned64 No I don't want port forwarding either. My vms should behave as physical devices and get their address via dhcp.
    – Weezy
    Feb 24, 2020 at 10:13

1 Answer 1


You can utilize a bridge interface to serve IPs to multiple VMs on one interface, and it is absolutely needed if you plan to have your VMs be on the same network as the host.

When you create the bridge interface and assign it a static IP, that is the IP of the host machine. Keep in mind, you need to set the static IP on the bridge interface, not the physical interface itself. You only need to assign the physical interface to the bridge interface using the command brctl addif <bridge> <device>, for example. Use brctl show to confirm the change.

When you then create a VM and set it to use that bridge interface, you can set its own static IP (or DHCP assigned ip) inside the VM's OS. That VM will now be on the same network as the host with the IP you defined. You should be able to ping the guest, and guest should be able to ping the outside.

Since you are using Ubuntu, if you are using version 16.04 or above, you can implement this setup using netplan very easily. Here's what /etc/netplan/01-netcfg.yaml (or whatever file you have there, could also be 50-cloud-init.yaml) should look like, assuming the physical interface is called eno1 and you wanted to name the bridge br0:

  version: 2
  renderer: networkd
      dhcp4: no
      interfaces: [eno1]
      dhcp4: yes

This will create the bridge and enable DHCP on the host machine on the bridge interface. Notice how I disabled DHCP on the physical interface eno1. If you would like your host to have a static IP see this page for more examples.

Then run netplan apply to apply the changes. If you then run ip a on the host, your physical interface will have master br0 indicated. The physical interface should not have an IP. You should now also have a br0 interface with the IP you specified above.

If you are using /etc/network/interfaces instead of netplan, check here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .