qemu-discuss
[Top][All Lists]
Advanced

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

Re: [Qemu-discuss] How to communicate with qemu network interface?


From: Jakob Bohm
Subject: Re: [Qemu-discuss] How to communicate with qemu network interface?
Date: Mon, 07 Jan 2013 12:04:38 +0100
User-agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 1/6/2013 3:41 PM, Robert Schilling wrote:
I wrote a network driver for NE2000 for my OS. I use qemu for emulating. I 
create a tap device using the scripts /etc/qemu-ifup and /qemu/if-down. Here is 
my call to qemu:

sudo qemu-system-i386 -d int,cpu_reset -m 8M -cpu qemu32 -hda SWEB-flat.vmdk 
-debugcon /dev/stdout -net nic,model=ne2k_pci,vlan=0 -net tap,vlan=0,ifname=tap0


This generates me a tap device and a bridge. This is the output of ifconfig:

eth0      Link encap:Ethernet  HWaddr 00:0c:29:78:2b:72
           inet addr:192.168.31.167  Bcast:192.168.31.255  Mask:255.255.255.0
           inet6 addr: fe80::20c:29ff:fe78:2b72/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:9820 errors:0 dropped:0 overruns:0 frame:0
           TX packets:5948 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:3764099 (3.7 MB)  TX bytes:835663 (835.6 KB)

lo        Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:16436  Metric:1
           RX packets:7860 errors:0 dropped:0 overruns:0 frame:0
           TX packets:7860 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:875760 (875.7 KB)  TX bytes:875760 (875.7 KB)

tap0      Link encap:Ethernet  HWaddr 76:d0:54:51:d6:19
           inet addr:192.168.31.240  Bcast:192.168.31.255  Mask:255.255.255.0
           inet6 addr: fe80::74d0:54ff:fe51:d619/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:60 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:500
           RX bytes:0 (0.0 B)  TX bytes:10420 (10.4 KB)

virbr0    Link encap:Ethernet  HWaddr 76:d0:54:51:d6:19
           inet addr:192.168.31.5  Bcast:192.168.31.255  Mask:255.255.255.0
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:58 errors:0 dropped:0 overruns:0 frame:0
           TX packets:759 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:3668 (3.6 KB)  TX bytes:43185 (43.1 KB)


How do I communicate from my host system to the qemu guest system? My OS only 
receives packets from 192.168.31.240, the tap device. I proofed this with 
wireshark. I receive all packets when listening to the tap device.

If I do a ping to 192.168.31.10 (this is the IP configured in my guest OS) an 
ARP request is generated but this is not passed to qemu.

How do I do that?

1. Currently you have set up two disconnected networks which both use
  the address range 192.168.31.0/255.255.255.0, this makes it very hard
  for the host to access both networks.  You should either change the
  virtual network to something else (like 192.168.32.0/255.255.255.0)
  or bridge the two networks into one.

2. If you want to bridge the two networks into one, set up a non-virtual
  bridge (such as br0) in your host OS, with eth0 as its only (initial)
  member (On Debian/Ubuntu, this is done in /etc/network/interfaces),
  also move your main IP address settings from eth0 to the br0.
   Next, start qemu with options to add its tap device to br0. Now the
  guest OS should act like it is connected to the same network as eth0.

3. If you don't want to bridge the two networks, change the IP range for
  the virbr0 network so it does not conflict with your real network.
   Now the host should receive and send traffic from/to your guest OS on
  the hosts virbr0 "interface", which you can watch with Wireshark etc.
   Commands such as ping 192.168.32.10 should get routed to the virbr0
  device, and from there bridged onto the tap device, and from there into
  qemu.

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded




reply via email to

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