![]() |
qemu-kvm bridge connectivity similar to virtual box
Hello I am dropping Virtual Box for qemu-kvm.
My main activity is to mount servers and services. So I would like o know how can I have bridge connectivity similar to Virtual Box. I already tried bridge-utils and it was rather complex. I am now trying vde, using the vde2 slackbuild and alien bob tutorial, here. My guest debian boots without problem and has a eth0. However the interface do not get any IP. Can some one help me with this? |
If you are running Slackware 14 you can setup a bridge in /etc/rc.d/rc.inet1.conf ; here is an example of what my KVM server has configured for a bridge with eth0 in it:
Code:
# Config information for eth0:Then, what you need to do is connect the VM's to that bridge. If you are using my vde package, then that is very easy: copy the rc.vdenetwork script to /etc/rc.d/ , make it executable and start it from /etc/rc.d/rc.local : Code:
# Start the VDE network layer:Code:
NETWORKTYPE="bridge"If you start a virtual machine, you need to have the following parameters in your KVM commandline so that the VM connects to the vde_switch: Code:
qemu-system-x86_64 -net vde,sock=/var/run/kvm0.ctl,vlan=0 -net nic,model=e1000,vlan=0When you do it like this, your virtual machines will be bridged and will be able to get their network configuration from the DHCP server in your LAN. Eric |
Thanks Eric, I will try this in the weekend.
the script that com with vde is the following: Quote:
By the way, after reading it i think my problem was the lack of bridge interface. I thought that vde take cared of that. This bridge will be visible in my local network? Similar to bridge in virtual box? Is there any problem if my network devices are controlled through Network Manger? |
Networkmanager and bridges do not play well together from what I hear. But you can attempt the following hybrid solution.
I did not try this, but the flow of rc.inet1 should allow for it: - Define a bridge in rc.inet1.conf , using eth0 as one of the bridge's interfaces, but do not assign an IP address to it. - Configure NetworkManager to use the bridge interface (br0 if you used that name in rc.inet1) and let NM handle it from there on. - Let rc.vdenetwork add the tap interface to the bridge - Virtual machines should be able to use the bridge and act as if they were actual computers on your LAN. Please note that bridges do not like DHCP very much. Having a static IP address for a bridge is very recommended. Bridges and wireless interfaces will probably be an even bigger challenge. Eric |
If you only want to setup networking when you use a VM, then running this little script as root works for me.
Code:
#!/bin/shCode:
-net tap,ifname=tap0,script=no,downscript=no -net nic,model=virtioTo bring the bridge down after using the VM I use Code:
#!/bin/sh |
Hi allend I tried to combine you solution with alien bob.
I added a bridge interface in rc.inet1.conf and set the NetworkManager to only manage my wlan0 interface. After that I tried to use your scripts to set up a bridge connection. My script is this Quote:
It is necessary to add some rule to iptables? I saw several websites that mention forwarding rules. Am i doing something wrong? |
I do have these lines in my /etc/rc.d/rc.firewall_br0 so that the VM can get an IP address from my modem/router.
Code:
# DHCP uses UDP from server port 67 to port 68 - Needed for qemu virtual machine |
Quote:
I advise you to think twice if running qemu as root is really something you want to do... Eric |
Quote:
I saw in the slackbuilds a file with udev rules to put in the /ect/udev/rules.d but still asked for root. Did i make a mistake? |
Quote:
Code:
# groupadd kvmEric |
Quote:
I am using the slackbuild provided by slackbuild.org Finally my bridge start to work, the problem was iptables. The default rule for forward was drop :) Another questions, before marking the post as solved. Can the host discover the IP address of the guest virtual machine? I mainly work with server so I do not need graphics just connect to the machine using ssh. |
Quote:
Eric |
Quote:
I have edited my post #7 to show the forward chain. Glad you have got it working! |
Quote:
|
It is the bridge interface
Code:
EXTIF="br0" |
| All times are GMT -5. The time now is 02:00 AM. |