# Help: bridging a virtual machine with the physical network

## VinzC

Hi all.

I'm trying to bridge (if that's the way to go) the network card of one of my virtual machines with the physical network. In vain. Here's what I have:Ethernet card: Broadcom BCM5784M (eth0)

Wireless: Intel Wifi Link 5100 (wlan0)

```
eth0  ---+

         |

       bond0 --+

         |     |

wlan0 ---+     |

              br1 --> IP from the LAN DHCP server (eth0/wlan0)

               |

  (VM) vif0  --+
```

I have created a bonding interface, bond0 with both wlan0 and eth0. Then I've created a tun/tap interface, vif0, for my VM and a bridge interface, br1, which is comprised of bond0 and vif0. When I run my virtual machine, I can only the IP address of my laptop (the host machine) but no machine in the LAN on which the host is connected.

I have another bridge (br0) for a routed network between other virtual machines and all of them are able to reach the local network. But they use routing/nating instead.

Does anyone have an idea on what's (possibly) wrong? From what I know, this could be an ARP issue. However I have no clue on how to solve it.

Thanks in advance for any hint/suggestion.

----------

## Letharion

I'm really bad with networking, so I don't really understand the details, but I've had this successfully working with the KVM instructions on the wiki.

----------

## VinzC

 *Letharion wrote:*   

> I'm really bad with networking, so I don't really understand the details, but I've had this successfully working with the KVM instructions on the wiki.

 

My network setup is globally the same, except the physical LAN is made of both eth0 and wlan0 bonded together. But I'm almost sure this is where it hurts as I know wireless interfaces can be problematic with bonding and bridging in some circumstances. I'll try bridging eth0 with the virtual network directly and see if there's a difference.

----------

## AngelKnight

To VinzC: not sure what you're aiming for, but why are eth0 and wlan0 bonded?  Could you not just get by with attaching eth0, wlan0 and vif0 as ports on the same bridge br1, then go from there?

----------

## VinzC

 *AngelKnight wrote:*   

> To VinzC: not sure what you're aiming for, but why are eth0 and wlan0 bonded?  Could you not just get by with attaching eth0, wlan0 and vif0 as ports on the same bridge br1, then go from there?

 

Yes I could. But bridging considerably slows down network starting time plus it doesn't offer redundancy like bonding. With bonding I can use either or both interfaces without being required to enable STP and the like. In general bonding is much more convenient than bridging. however I'll try bridging eth0 without wlan0 first since I suspect wireless firmwares to disallow such flexibility. I'll report the results.

----------

## VinzC

Bridging vif0 with eth0 worked, so as I suspected there is a problem with my wireless interface somehow. I couldn't add wlan0 to the bridge however, I still wonder why. I'll try further to bridge both wireless and ethernet interfaces.

----------

## Mad Merlin

 *VinzC wrote:*   

> Bridging vif0 with eth0 worked, so as I suspected there is a problem with my wireless interface somehow. I couldn't add wlan0 to the bridge however, I still wonder why. I'll try further to bridge both wireless and ethernet interfaces.

 

Many wireless interfaces don't allow more than one MAC address to be sourced through them, meaning they're effectively unusable for bridging. Routed networks can be an usable workaround though.

Also I'm surprised bonding worked between eth0 and wlan0, I've never heard of anyone try that before. Is that a purely failover bonding type rather than round-robin?

----------

## VinzC

 *VinzC wrote:*   

> Bridging vif0 with eth0 worked, so as I suspected there is a problem with my wireless interface somehow. I couldn't add wlan0 to the bridge however, I still wonder why. I'll try further to bridge both wireless and ethernet interfaces.

 

 *Mad Merlin wrote:*   

> Many wireless interfaces don't allow more than one MAC address to be sourced through them, meaning they're effectively unusable for bridging. Routed networks can be an usable workaround though.
> 
> Also I'm surprised bonding worked between eth0 and wlan0, I've never heard of anyone try that before. Is that a purely failover bonding type rather than round-robin?

 

So far I've set it up in fail-over mode. I haven't used it in round-robin mode yet.

I do need my virtual machines to be connected to the LAN however. I have Windows virtual machines, which I need to test against a Samba domain controller in the local network so routing is not a viable option there. Are there other workarounds?

----------

## AngelKnight

 *Mad Merlin wrote:*   

>  *VinzC wrote:*   Bridging vif0 with eth0 worked, so as I suspected there is a problem with my wireless interface somehow. I couldn't add wlan0 to the bridge however, I still wonder why. I'll try further to bridge both wireless and ethernet interfaces. 
> 
> Many wireless interfaces don't allow more than one MAC address to be sourced through them, meaning they're effectively unusable for bridging. Routed networks can be an usable workaround though.
> 
> Also I'm surprised bonding worked between eth0 and wlan0, I've never heard of anyone try that before. Is that a purely failover bonding type rather than round-robin?

 

Bridging wired ethernet and wireless together doesn't often work; it's usually the wireless hardware or firmware that gets in the way.  One interference is, as mentioned earlier, where the wireless firmware refuses to transmit frames with a "foreign" source MAC.

----------

## AngelKnight

 *VinzC wrote:*   

>  *AngelKnight wrote:*   To VinzC: not sure what you're aiming for, but why are eth0 and wlan0 bonded?  Could you not just get by with attaching eth0, wlan0 and vif0 as ports on the same bridge br1, then go from there? 
> 
> Yes I could. But bridging considerably slows down network starting time plus it doesn't offer redundancy like bonding. With bonding I can use either or both interfaces without being required to enable STP and the like. In general bonding is much more convenient than bridging. however I'll try bridging eth0 without wlan0 first since I suspect wireless firmwares to disallow such flexibility. I'll report the results.

 

From your diagram you're already using bridging...

If you don't want to use STP, use the following on a bridge (assume br0):

```
brctl stp br0 off

brctl setfd br0 1
```

And be certain through other means that you don't accidentally introduce loops.

With regard to ensuring that your virtual machines appear in the same broadcast domain with a domain controller (presumably hanging off of br1 or eth0), just put eth0 and vif0 both on br1.

----------

## VinzC

 *AngelKnight wrote:*   

> With regard to ensuring that your virtual machines appear in the same broadcast domain with a domain controller (presumably hanging off of br1 or eth0), just put eth0 and vif0 both on br1.

 

I have tried bridging only my Ehternet card with the virtual machine segment; it worked. I had also started another thread as I got an error message trying to bridge wlan0. In fact my wireless card can simply not be bridged, which is a shame as I always had Intel Wireless cards in the laptops I used and this is the very first time there is one I just cannot bridge  :Evil or Very Mad:  ! With IPW2200, IPW3945 I've never had any problem, ever. IWL5100AGN, piece of crap! I'm nearly finding this scandalous, really.

Currently I've kept my network configuration as drawn in my initial post. My virtual machines do contact the local network only when I plug the cable in the Ethernet socket. It's more than nothing and I guess I'll have to cope with it. I just want to keep bonding.

----------

