kleinric
May 24th, 2011, 10:22 PM
Howzit,
My wifi connection (wlan0) can't be added to a bridge. I read that this is common, but can't seem to find anyone who has the tap stuff working with Virt-manager.
I haven't completely solved the problem but I think I'm pretty close... I have managed to get a guest ubuntu, working perfectly on the network through my host (ubuntu) wireless card - bridged. Even DHCP works - with one catch.
I'm certainly no expert, these steps are a mixture of:
http://serverfault.com/questions/197156/set-tap0-using-virt-manager-for-bridged-wireless
http://savvyadmin.com/virtualbox-wireless-bridging-with-dhcp/
Banging my head against a wall
Install KVM/Virt-manager etc...
Install the networking tools:
sudo apt-get install uml-utilities parprouted bcrelay
Create a bridge:
sudo brctl addbr b0
Create the tap:
sudo tunctl -t tap0
Add tap0 to the bridge:
sudo brctl addif br0 tap0
Give the bridge an address. This address MUST be on a different subnet to your network - in fact I've found the address doesn't have to be close - my network at home is 10.0.0.0 and the code below still works for me:
sudo ip addr add 192.168.1.100/32 dev br0
sudo ip link set br0 up
Use parprouted to perform voodoo magic on the routing tables. If you drop the "-d" then it will run in the background.
sudo parprouted -d wlan0 br0
Finally, start bcrelay - this will make sure that broadcast traffic (like the dhcp stuff) gets pushed through the tap as well.
sudo bcrelay -i br0 -o wlan0
Then open virt manager, select your virtual machine, go to the details page. Click "Add Hardware" and go to "Network". Then set Host Device to "Specify Shared Device Name" and type in "br0" where it asks for the bridge name.
Starting the VM I find that it gets an address from the network DHCP (not the virt-manager one) without any problems.
For some reason, parprouted doesn't find this address so no other traffic makes it back to the VM. If you manually add the line to the routing table (defeating the object of the dhcp :/ ) then parprouted finds it and you end up with two lines in the routing table. If you remove the one, the other stays and it keeps working...
eg. If the VM was assigned 10.0.0.100 then:
sudo route add -host 10.0.0.100 dev br0
As with the line in the routing table, I find that networking works absolutely perfectly through virt-manager.
Question:
If anyone knows how to get parprouted to find that new address by itself, wireless bridging would be pretty much solved in virt-manager. :) Any ideas?
Richard
My wifi connection (wlan0) can't be added to a bridge. I read that this is common, but can't seem to find anyone who has the tap stuff working with Virt-manager.
I haven't completely solved the problem but I think I'm pretty close... I have managed to get a guest ubuntu, working perfectly on the network through my host (ubuntu) wireless card - bridged. Even DHCP works - with one catch.
I'm certainly no expert, these steps are a mixture of:
http://serverfault.com/questions/197156/set-tap0-using-virt-manager-for-bridged-wireless
http://savvyadmin.com/virtualbox-wireless-bridging-with-dhcp/
Banging my head against a wall
Install KVM/Virt-manager etc...
Install the networking tools:
sudo apt-get install uml-utilities parprouted bcrelay
Create a bridge:
sudo brctl addbr b0
Create the tap:
sudo tunctl -t tap0
Add tap0 to the bridge:
sudo brctl addif br0 tap0
Give the bridge an address. This address MUST be on a different subnet to your network - in fact I've found the address doesn't have to be close - my network at home is 10.0.0.0 and the code below still works for me:
sudo ip addr add 192.168.1.100/32 dev br0
sudo ip link set br0 up
Use parprouted to perform voodoo magic on the routing tables. If you drop the "-d" then it will run in the background.
sudo parprouted -d wlan0 br0
Finally, start bcrelay - this will make sure that broadcast traffic (like the dhcp stuff) gets pushed through the tap as well.
sudo bcrelay -i br0 -o wlan0
Then open virt manager, select your virtual machine, go to the details page. Click "Add Hardware" and go to "Network". Then set Host Device to "Specify Shared Device Name" and type in "br0" where it asks for the bridge name.
Starting the VM I find that it gets an address from the network DHCP (not the virt-manager one) without any problems.
For some reason, parprouted doesn't find this address so no other traffic makes it back to the VM. If you manually add the line to the routing table (defeating the object of the dhcp :/ ) then parprouted finds it and you end up with two lines in the routing table. If you remove the one, the other stays and it keeps working...
eg. If the VM was assigned 10.0.0.100 then:
sudo route add -host 10.0.0.100 dev br0
As with the line in the routing table, I find that networking works absolutely perfectly through virt-manager.
Question:
If anyone knows how to get parprouted to find that new address by itself, wireless bridging would be pretty much solved in virt-manager. :) Any ideas?
Richard