|
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:
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 |
[Prev in Thread] | Current Thread | [Next in Thread] |