qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] how to use qemu net option


From: Mike Lovell
Subject: Re: [Qemu-discuss] how to use qemu net option
Date: Wed, 11 Jan 2012 14:14:21 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Lightning/1.0b2 Thunderbird/3.1.16

On 01/11/2012 06:01 AM, dykelin wrote:

All. I am new to qemu, and I want use qemu to launch an guest linux with two virtual network interfaces (host os is linux too), and open an IPC shared memory on qemu, when I receive packets from the guest linux(through any one of the two interface), save them in the shared memory ,get other pactets from the shared memory to send back to guest linux. The packets in the shared memory will read and wrote by another process run on the host linux. How can I to make it come ture? May I use tap? Break down the brige in the (tap_send())after read packets from the tap interface(tap_read_packet()) and before it write out to the vlan(qemu_send_packet_async()), save this packet to the shared memory ,and get the packet from the shared memory to write. Can this come true???

Thanks for any suggestions from you !!!



i can't speak to how this could be done by modifying the qemu source code because i have little knowledge of the inner workings of the code. i'm also a little confused by what you are trying to accomplish but have a few suggestions for things you could try that don't modify the code.

are you wanting to just be able to see all of the packets that are passed to and from the guest? if so, this could probably be done by using the 'dump' network type. for example adding '-net nic,vlan=1 -net user,vlan=1 -net dump,vlan=1,file=/tmp/dump.pcap' would create a single nic in the guest, set up the user networking target to provide NAT-like access to the network, and also dump all traffic to the file /tmp/dump.pcap. you then could read the dump.pcap file to examine the network traffic. this wouldn't let you inject traffic though.

if you are wanting to also be able to inject arbitrary traffic to the guest, it might be possible to accomplish that by using the socket network types with qemu. with the socket network types, the qemu process will establish a connection to another process and then the qemu process will send and receive the raw ethernet frames from the client over this socket. for example '-net nic,vlan=1 -net socket,vlan=1,connect=127.0.0.1:10240' would tell qemu to connect to a socket on localhost port 10240 and pass traffic across that connection. you could write a program that started listening on a socket and the start reading ethernet frames coming from the guest or start writing ethernet frames to get passed to the guest. if you also want the network traffic to be passed to a tap device, you could open the tap device as well and write to it any thing you receive from the guest socket and vice versa.

just a few thoughts.

mike

reply via email to

[Prev in Thread] Current Thread [Next in Thread]