You are not logged in.
Hello, I'm trying to lunch Qemu with host networking, so the VM's can talk to each other, what I did so far is creating the following bridges ( Actually virt-manager did that for me ):
br0, virbr0 -> virbr0-nic ( the interface )and have the following network interfaces:
br0, lo, virbr0, wlp1s0What I think I'm missing is something on the code... I'm lunching with:
qemu-system-x86 -kernel kernel -cpu host -m 2024 -hda image.imageI did review the following manuals
https://wiki.archlinux.org/index.php/QE … networking
https://wiki.archlinux.org/index.php/Network_bridge
I'm missing the right command, thanks.
Last edited by abdullah (2015-02-06 18:00:11)
Offline
Well, still trying, here is the code that I'm using right now:
./start.sh
#!/bin/bash
bridge=br0
tap=$(sudo tunctl -u $(whoami) -b)
sudo ip link set $tap up
sleep 1s
sudo brctl addif $bridge $tap
qemu-system ..... etc \
-net nic,vlan0,model=virtio,macaddr=00:16:35:AF:94:4B \
-net nic,vlan=0,ifname=$tap,script=no,downscript=no
sudo brctl delif $bridge $tap
sudo ip link set $tap down
sudo tunctl -d $tapwhich the reff was in https://activedoc.opensuse.org/book/ope … h-qemu-kvm
any help please?
Offline
The problem is solved, simply by using vde2,
anyone interested could read through this post, I'm not into posting commands ( copy&past).
http://permalink.gmane.org/gmane.comp.e … .user/1291
but try to include the parameter "-D" which is equivalent of --dhcp to the "slirpvde"
or, another method descried here on arch Linux forums,
https://bbs.archlinux.org/viewtopic.php?id=182320
( I had to kill the process that uses dnsmasq )
Offline
Well, still trying, here is the code that I'm using right now:
./start.sh#!/bin/bash bridge=br0 tap=$(sudo tunctl -u $(whoami) -b) sudo ip link set $tap up sleep 1s sudo brctl addif $bridge $tap qemu-system ..... etc \ -net nic,vlan0,model=virtio,macaddr=00:16:35:AF:94:4B \ -net nic,vlan=0,ifname=$tap,script=no,downscript=no sudo brctl delif $bridge $tap sudo ip link set $tap down sudo tunctl -d $tapwhich the reff was in https://activedoc.opensuse.org/book/ope … h-qemu-kvm
any help please?
Sorry if I am late to the party... but here's how I do this with bridged networking.
Let's assume that I have 2 guests, an ArchLinux and Window 7. These are the start scripts:
: cat start-arch.sh
#!/bin/bash
vm_dir="/export/scratch/VMs"
scripts_dir="${vm_dir}/scripts"
. ${scripts_dir}/macaddr-gen.sh
# Generate a random MAC address
gen_macaddr mac
# Start the emulator
qemu-system-x86_64 -enable-kvm -smp 2 \
-net bridge,br=br0 -net nic,macaddr=${mac},model=virtio \
-drive file="${vm_dir}/arch-x86_64-1",if=virtio -nographic
: cat start-win7.sh
#!/bin/bash
vm_dir="/export/scratch/VMs"
scripts_dir="${vm_dir}/scripts"
. ${scripts_dir}/macaddr-gen.sh
# Generate a random MAC address
gen_macaddr mac
# Start the emulator
qemu-system-x86_64 -enable-kvm -m 3G -smp 2 \
-net bridge,br=br0 -net nic,macaddr=${mac},model=virtio \
-drive file="${vm_dir}/win7-x86_64-1",if=virtio \
-usbdevice tablet -vga qxl -spice port=5930,disable-ticketing
: cat macaddr-gen.sh
#!/bin/bash
#
# Generate a random MAC address
#
gen_macaddr() {
local str i macaddr _mac=$1
str=$(cat /dev/random | tr -cd '[:xdigit:]' | head -c 12 | \
tr '[:upper:]' '[:lower:]')
i=0
macaddr=""
while [ $i -lt 6 ]; do
macaddr=${macaddr}${str:0:2}":"
str=${str:2}
let i=i+1
done
eval $_mac=\${macaddr%:}
}
: cat /etc/qemu/bridge.conf
allow br0Note, that the MAC addresses of virtualized NICs in the VMs must be different. If you now do
: ./start-arch.sh &
: ./start-win7.shAssuming that you have already set up a bridge br0, qemu will create several tap? interfaces and insert them into that bridge (using the qemu-bridge-helper suid binary), and you'll have a virtual LAN rooted at br0.
EDIT: Added a slightly faster random MAC generator and comments.
Last edited by Leonid.I (2015-02-09 20:13:50)
Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd
Offline
Thank you Leonid.I for the reply!,
I'm lunching Qemu with the following now:
cat server.sh
qemu-system-x86_64 -enable-kvm -m 1024 -cpu host \
-smp sockets=1,cores=2,threads=2 \
-hda /media/abdullah/vms_home/games_server_vm/server.img \
-netdev tap,id=t0,ifname=tap0,script=no,downscript=no \
-device e1000,netdev=t0,id=nic0,mac=52:54:00:08:12:23I need to create tap interfaces manually, but yea, I don't restart much.
Offline