Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

B.11. Unable to add bridge br0 port vnet0: No such device

Symptom
The following error message appears:
Unable to add bridge name_of_bridge port vnet0: No such device
For example, if the bridge name is br0, the error message will appear as:
Unable to add bridge br0 port vnet0: No such device
In libvirt versions 0.9.6 and earlier, the same error appears as:
Failed to add tap interface to bridge name_of_bridge: No such device
Or for example, if the bridge is named br0:
Failed to add tap interface to bridge 'br0': No such device
Investigation
Both error messages reveal that the bridge device specified in the guest's (or domain's) <interface> definition does not exist.
To verify the bridge device listed in the error message does not exist, use the shell command ip addr showbr0.
A message similar to this confirms the host has no bridge by that name:
br0: error fetching interface information: Device not found
If this is the case, continue to the solution.
However, if the resulting message is similar to the following, the issue exists elsewhere:
  3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
      link/ether 1b:c4:94:cf:fd:17 brd ff:ff:ff:ff:ff:ff
      inet 192.168.122.1/24 brd 192.168.122.255 scope global br0
Solution
Edit the existing bridge or create a new bridge with virsh
Use virsh to either edit the settings of an existing bridge or network, or to add the bridge device to the host system configuration.
Edit the existing bridge settings using virsh
Use virsh edit name_of_guest to change the <interface> definition to use a bridge or network that already exists.
For example, change type='bridge' to type='network', and <source bridge='br0'/> to <source network='default'/>.
Create a host bridge using virsh
For libvirt version 0.9.8 and later, a bridge device can be created with the virsh iface-bridge command. This will create a bridge device br0 with eth0, the physical network interface which is set as part of a bridge, attached:
virsh iface-bridge eth0 br0
Optional: If desired, remove this bridge and restore the original eth0 configuration with this command:
virsh iface-unbridge br0
Create a host bridge manually
For older versions of libvirt, it is possible to manually create a bridge device on the host. Refer to Section 11.3, “Bridged Networking with libvirt” for instructions.