Bridged network connection for KVM question

I’m familiarizing myself with KVM and I was wondering if it’s possible to setup a bridged connection without using wicked. I’m testing this out on my laptop and would like to use network manager for the convenience of being able to select wifi access points, however it looks like there is no longer an option to create a bridged connection in network manager, although I’m pretty sure I’ve done that in the past. So, if I want to setup a bridged connection for KVM, is wicked my only option? Thanks.

This is certainly possible so you will need to explain in more details what you did and what did not work.

What you ask for is entirely possible.

Basic concepts which apply to setting this up using any virtualization technology (not just KVM)

  • Your Guest internal network connection (Guest OS) should always be configured with a wired connection, and this never changes. For this reason, Wicked works just fine although NM can be used, too.
  • Your Guest Properties should be configured to use your wireless network adapter. Although “bridged” can be configured, if other machines don’t need to connect to your Guest (ie your Guest providing network services), then NAT is better so that your Guest will always be configured for the same network connections no matter what network you are attached to. Remember, when configured using bridging, your Guest will need to use the main network’s network services like DHCP and DNS and perhaps more so your connections become complicated. You can avoid all of this by configuring a NAT connection instead.
  • Properly set up,by binding your Guest network connection to your WiFi adapter, your Guest should automatically be working with whatever WiFi network your HostOS is connected to, so although Wicked is fine for the GuestOS, you will need to configure NM for the HostOS.

HTH,
TSU

If you used YaST to install KVM, there would have been an offer to create a bridging device called br0.
Point your Guest Netowrking properties (not within your Guest) to this device (br0).
But, as I described unless you have a reason to prefer bridging over NAT, you should instead configure a NAT connection for better portability and less reliance on external network services.

TSU

There was no option to create the br0 interface when I installed via YaST. I just selected the KVM server and KVM tools options and it installed. There were no other options given. I installed KVM on a CentOS server using the br0 interface, and that seems to work just fine. My problem is that I can’t seem to figure out how to get a bridged connection to work on my laptop. Bridging the guest NIC to my wifi connection in virt-manager doesn’t work. I get no network connectivity on the guest. Alternately, I thought I’d try to create a bridged connection and select that for the interface in virt-manager, but there doesn’t seem to be a way of doing that outside of using wicked. NM has no options for creating a bridged interface. Searching the internet, all instructions just say to select “bridged” connection when creating a new connection in NM. Well, there is no bridged option.

Sounds like you may have installed KVM using the Software Manager module like any other software.
If you had instead installed using the YaST “Install Virtualiation” tool, the setup would have been more complete.

No matter.
Bridge devices can be created a number of different ways, especially if a simple one.

First,
I’d recommend you run the following to verify whether or not bridge devices already exist on your system, and if any do exist what their names are

brctl show

You can then create a bridge device with the following command

brctl addbr br0

Then, add interfaces to your newly created bridge

brctl addif br0 eth0 wlan0

You’ll find more info in the brctl MAN pages and guides like the following
https://www.tldp.org/HOWTO/BRIDGE-STP-HOWTO/set-up-the-bridge.html
https://www.thegeekstuff.com/2017/06/brctl-bridge/

If you prefer to create your bridge device using a GUI tool instead,
You have two choices,
You can use YaST.
Or, you can use the libvirt tool vm manager, all bridge devices you create using libvirt will be named “virbr” so for instance the first one you create might be called “virbr0.”

However you create your bridge using the tool you choose, it should work without any difference.
But, if you were creating a more complex bridge for instance supporting NAT with its own DhCP server and DHCP scope, I’d recommend vm manager over all others.

TSU

Bridging with WiFi usually does not work because forwarded frames have different MAC which is not accepted by AP (AP knows which clients are associated). It may be possible to make it work by setting 4addr mode if driver/card support it. This is probably better discussed on dedicated wireless forum though.

NM has no options for creating a bridged interface.

Again - it has (Leap 15, XFCE), so you need to start describing what you actually did.

Sounds like you may have installed KVM using the Software Manager module like any other software.
If you had instead installed using the YaST “Install Virtualiation” tool, the setup would have been more complete.

I installed it using the “Install Virtualization” tool.

brctl addif br0 wlan0

results in

can't add wlan0 to bridge br0: Operation not supported

I guess I can’t create a bridge with the wifi card. Creating it on my ethernet interface works.

Maybe in xfce there is an option in NM to create a bridge, but I don’t see it anywhere in the KDE plasma version.

There is no “KDE plasma version of NetworkManager”. There is one NetworkManager and multiple frontends. There are always native frontends (nm-connection-editor for GUI or nmtui for text mode full screen or nmcli) which allow you to configure most aspects of NM behavior.

If specific frontend (KDE Plasma applet in this case) does not offer editing bridge, it does not mean NetworkManager can not do it nor that you cannot configure it using other tools.

After a bit of double-checking,
It seems that it’s not likely possible to bridge wlan0 directly to a bridging device, and many have remarked about this.
If you decide to use NAT instead of bridging as I suggested, that apparently is possible.
And, I see an article where someone used a tun/tap which echoes something I did long ago which was to use MacVtap to “tap” into the network device.

At the moment I can’t remember exactly what I set up…
Been awhile but I had to set up bridging mode to run aircrack-ng.
The first time I did it using KVM, I know it wasn’t possible and I had to set up the MacVtap, but seems to me later I was able to set up using a normal bridge device… but unless I can replicate it, I guess that’s just something that might not be possible today.

So,
Those seem to be your workable options…

TSU