Thanks guys.
Kevin wrote:Well, you definitely need some network backend, otherwise your packets go to nowhere. The most powerful version is indeed using a tap device, but it's notoriously tricky to set up as you already noticed. In theory, it's easy: Set up a tap device that is owned by your user (with tunctl or ip), optionally include it in a bridge with your physical network card (brctl) and then give it to qemu.
I've finally been able to configure it
Here is the final qemu command I'm using:
Code: Select all
sudo qemu-system-x86_64 -enable-kvm -cpu host -serial file:virtual.log -netdev tap,helper=/usr/libexec/qemu-bridge-helper,id=thor_net0 -device rtl8139,netdev=thor_net0,id=thor_nic0 -vga std -hda hdd.img &
The network relevant part being:
Code: Select all
-netdev tap,helper=/usr/libexec/qemu-bridge-helper,id=thor_net0 -device rtl8139,netdev=thor_net0,id=thor_nic0
I've discovered the bridge helper from Qemu:
http://wiki.qemu.org/Features/HelperNetworking It does almost everything
The only thing necessary is to create the bridge:
To send a packet, I'm using
Now I have to find a tool to generate some packets for me on a specific interface.
Kevin wrote:Other options include "-net user", which emulates a virtual router that NATs you to the host network (by default, the router is 10.0.2.2). The disadvantage here is that you can't simply attach Wireshark to the device. However, with "-net dump" you can still capture the traffic in your virtual network. Maybe this is good enough for you.
I've checked documentation on "user networking" mode, but the problem is that it only supports TCP and UDP and I wanted to start with ICMP, but I'll maybe start to investigate this further.
iansjack wrote:Use the -net dump option to dump packets to a file.
My problem is more to send a packet to the VM right now, but thanks