Stuck with Unable to add bridge port vnet0? We can help you.
Recently we had a customer who came across the error, Unable to add bridge name_of_bridge port vnet0: No such device.
As part of our Server Management Services, we assist our customers with several such errors.
Today, let us discuss the cause and solution for the same.
Unable to add bridge port vnet0: No such device
Generally, the error message appears as:
Unable to add bridge name_of_bridge port vnet0: No such device
For example, if the bridge name is br0, the error message will be like this:
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
For instance, if the bridge is named br0:
Failed to add tap interface to bridge ‘br0′: No such device
Find the error
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, we use:
ip addr show br0
A message similar to this confirms the host has no bridge by that name:
br0: error fetching interface information: Device not found
If the resulting message is similar to the following, the issue exists elsewhere:
br0 Link encap:Ethernet HWaddr 00:00:5A:11:70:48 inet addr:10.22.1.5 Bcast:10.255.255.255 Mask:255.0.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:249841 errors:0 dropped:0 overruns:0 frame:0 TX packets:281948 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:106327234 (101.4 MiB) TX bytes:21182634 (20.2 MiB)
Solution for Unable to add bridge port vnet0
-
Edit the existing bridge or create a new bridge with virsh
We 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
We use virsh to 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, we can create a bridge device with the virsh iface-bridge command.
This creates a bridge device br0 with eth0, the physical network interface that is set as part of a bridge, attached:
virsh iface-bridge eth0 br0
If necessary, remove this bridge and restore the original eth0 configuration using
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.
Depending on our environment, setting up a bridge with libvirt in Red Hat Enterprise Linux 7 may require disabling Network Manager. Our Support Techs does not recommend that. This also requires libvirtd to run for the bridge to operate.
We can use the text user interface tool nmtui to configure bridging in a terminal window. Issue the following command to start the tool:
~]$ nmtui
Eventually, the text user interface appears. Any invalid command prints a usage message.
To navigate, we use the arrow keys or press Tab to step forwards and press Shift+Tab to step back through the options.
Then press Enter to select an option. The Space bar toggles the status of a check box.
- From the starting menu, select Edit a connection. Select Add, the New Connection screen opens.
- Then select Bridge, the Edit connection screen opens.
- To add slave interfaces to the bridge select Add, the New Connection screen opens. Once the type of Connection has been chosen, select the Create button to cause the bridge’s Edit Connection display to appear.
- Enter the required slave’s device name or MAC address in the Device section. If required, enter a clone MAC address to be used as the bridge’s MAC address by selecting Show to the right of the Ethernet label. Select the OK button.
If the device is specified without a MAC address the Device section will be automatically populated once the Edit Connection window is reloaded, but only if it successfully finds the device. - The name of the bridge slave appears in the Slaves section. Repeat the above steps to add further slave connections.
- Finally, review and confirm the settings before selecting the OK button.
[Couldn’t fix the error? We’d be happy to further assist you]
Conclusion
In short, when the bridge device specified in the guest’s (or domain’s) <interface> definition does not exist, we come across the error, Unable to add bridge port vnet0: No such device. Today, we saw how our Support Techs fix the same.
0 Comments