qemu-discuss
[Top][All Lists]
Advanced

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

Re: [Qemu-discuss] need help in setting up tap networking for using qemu


From: Chan Kim
Subject: Re: [Qemu-discuss] need help in setting up tap networking for using qemu virtual machine
Date: Mon, 22 Sep 2014 09:03:14 +0000


Hi, Jacob,
 
Thanks for replying.
I checked against your suggested 'possible cause' list.
 
> - The host is really running a firewall, which you have not turned
>   off
The host is not running firewall. 

> - Your physical ethernet switch is configured to only allow one MAC
>   address on the port that is connected to your machine, so it won't
>   allow traffic to the guest VM over the connection to your host.
>    Turning ON STP (which is turned off by your current script) may or
>   may not help on this possibility.
I tried turnning off and on the STP, didn't help.

> - The MAC address of your virtual machine conflicts with a real
>   machine somewhere, perhaps somebody else's VM, perhaps the
>   physical board where your code runs fine.  Note that some network
>   hardware doesn't allow MAC addresses to roam around between
>   different ethernet ports, at least not as fast as you can move it
>   with your setup.
As MAC address, the RTEMS code sets "00:11:22:33:44:55" and I've checked
it's really being set to the emulated NIC. So there won't be any conflict.(so 
special a value)
 
> - Ditto for the IP address of your guest (129.254.132.48).
This address is assigned to my by the network admin.

> > and my PC (not the host, or guest) is seen on br0. My PC should be
> > seen on eth0 I think and only the virtual machine should be see from
> > the br0.  Hope somebody could tell me what is going on here.
> After running your script, your PC is connected to br0, which is connected to
> eth0,so your PC should be seen from both sides and so should the VM.  The
> problem isthat somehow the VM isn't seen by (or cannot see) the DG.
 
By the way, the way I see it is below(correct me if I'm wrong).
 http://picpaste.com/virnet-cl7ocbRi.jpg
Inside the host, I cannot telnet into the guest. I don't know why.

Another question is : In my emulator, I have lan9118 NIC instantiated in the 
architecture. (I mean in default machine->init() function of vl.c)
In this case, do I have to use -net nic option? (The manual seems to say this 
option creates one for me)
Any suggestion/help deeply appreciated.
best regards,
 
Chan






보낸 사람 : "Jakob Bohm" <address@hidden>
보낸 날짜 : 2014-09-20 00:51:48 ( +09:00 )
받는 사람 : 김찬 <address@hidden>, address@hidden <address@hidden>
참조 : 
제목 : Re: [Qemu-discuss] need help in setting up tap networking for using qemu 
virtual machine

On 19/09/2014 04:07, 김찬 wrote:
>
>
> In this strainge state, when I type 'arp -an', I get
> address@hidden:/lib/modules/2.6.32-358.2.1.el6.x86_64 
> ] arp -an
> ? (129.254.132.1) at on eth0
> ? (129.254.132.39) at f4:6d:04:05:6a:c9 [ether] on br0
>
> This mean seen from the host, the router's mac address is 'incomplete' 
> (what's it mean?)
This means that when the Linux kernel inside your guest tried to
find the Ethernet MAC address for your default gateway (DG)
129.254.132.1, it did so by multicasting/broadcasting an ARP packet
on its (virtual) ethernet asking "whomever has the IP
129.254.132.1, please reply". On your host, this would be
broadcast on your br0, which you have already connected to the real
world. But either the query never reaches the gateway, or the
reply never reaches the guest. So the ARP search for 129.254.132.1
is incomplete.

Possible causes:

- The host is really running a firewall, which you have not turned
off
- Your physical ethernet switch is configured to only allow one MAC
address on the port that is connected to your machine, so it won't
allow traffic to the guest VM over the connection to your host.
Turning ON STP (which is turned off by your current script) may or
may not help on this possibility.
- The MAC address of your virtual machine conflicts with a real
machine somewhere, perhaps somebody else's VM, perhaps the
physical board where your code runs fine. Note that some network
hardware doesn't allow MAC addresses to roam around between
different ethernet ports, at least not as fast as you can move it
with your setup.
- Ditto for the IP address of your guest (129.254.132.48).
> and my PC (not the host, or guest) is seen on br0. My PC should be 
> seen on eth0 I think and only the virtual machine should be see from 
> the br0. Hope somebody could tell me what is going on here.
After running your script, your PC is connected to br0, which is
connected to eth0,so your PC should be seen from both sides and
so should the VM. The problem isthat somehow the VM isn't seen
by (or cannot see) the DG.
> Thanks!
> Chan
> ------------------------------------------------------------------------
> *보낸 사람 : *"김찬" 
> *보낸 날짜 : *2014-09-18 22:09:00 ( +09:00 )
> *받는 사람 : address@hidden 
> *참조 : *
> *제목 : *RE: need help in setting up tap networking for using qemu 
> virtual machine
>
>
> Forgot to mention that while qemu is running with RTEMS telnetd.exe, 
> (with ETH0IP set to 48)
> from the host I get ping response from 47 and 48. But I cannot ping to 
> google.com.
> and when I type in the password at telnet, I can get in to both.
> (but couple of times got 'connection close by foreign host.' I remember)
> Thanks a lot.
> Chan Kim
>
>
>
>
> 보낸 사람 : "김찬"
> 보낸 날짜 : 2014-09-18 22:00:32 ( +09:00 )
> 받는 사람 : address@hidden
> 참조 :
> 제목 : need help in setting up tap networking for using qemu virtual 
> machine
>
> Hello, everyone!
>
> It's good to have some people to ask this.. I really need a help from 
> you and this should be a basic question.
> I'm trying to run a virtual machine (using qemu-system-sparc, I added 
> lan9220 emulation model inside) on my CentOS 6.4 machine.
> I've read 
> [url]http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/centos-6-and-kvm-how-to-setup-bridged-networking-in-kvm-in-a-class-b-environment-4175433990/[/url]
>  
> but my case seems different and I am not sure if this previous post is 
> correct or not.
>
> My host ip is 129.254.132.47. and I want my virtual machine to be 
> 129.254.132.48. (it's class B network)
>
> I have /etc/qemu-ifup like this
>
> --------------------- start -------------------------
> #!/bin/sh
> #
> # script to bring up the tun device in QEMU in bridged mode
> # first parameter is name of tap device (e.g. tap0)
> #
> # some constants specific to the local host - change to suit your host
> #
> # guest 132.48 host 132.47 bridge 132.64
> set -x
> ETH0IP=129.254.132.47
> GATEWAY=129.254.132.1
> BROADCAST=129.254.255.255
> #
> # First take eth0 down, then bring it up with IP address 0.0.0.0
> #
> /sbin/ifdown eth0
> /sbin/ifconfig eth0 0.0.0.0 promisc up
> #
> # Bring up the tap device (name specified as first argument, by QEMU)
> #
> /usr/sbin/openvpn --mktun --dev $1 --user `id -un`
> /sbin/ifconfig $1 0.0.0.0 promisc up
> #
> # create the bridge between eth0 and the tap device
> #
> /usr/sbin/brctl addbr br0
> /usr/sbin/brctl addif br0 eth0
> /usr/sbin/brctl addif br0 $1
> #
> # only a single bridge so loops are not possible, turn off spanning 
> tree protocol
> #
> /usr/sbin/brctl stp br0 off
> #
> # Bring up the bridge with ETH0IP and add the default route
> #
> /sbin/ifconfig br0 $ETH0IP netmask 255.255.0.0 broadcast $BROADCAST
> /sbin/route add default gw $GATEWAY
> #
> # stop firewall - comment this out if you don't use Firestarter
> #
> #/sbin/service firestarter stop
> --------------------- end -------------------------
>
> and /etc/qemu-ifdown as
>
> ------------------- start --------------------------
> #!/bin/sh
> #
> # Script to bring down and delete bridge br0 when QEMU exits
> #
> # Bring down eth0 and br0
> #
> set -x
> /sbin/ifdown eth0
> /sbin/ifdown br0
> /sbin/ifconfig br0 down
> #
> # Delete the bridge
> #
> /usr/sbin/brctl delbr br0
> #
> # bring up eth0 in "normal" mode
> #
> /sbin/ifconfig eth0 -promisc
> /sbin/ifup eth0
> #
> # delete the tap device
> #
> /usr/sbin/openvpn --rmtun --dev $1
> #
> # start firewall again
> #
> #/sbin/service firestarter start
> -------------------- end --------------------------
>
> and I start my virtual machine with this command :
>
> qemu-system-sparc -M ALDEBARAN -serial stdio -kernel 
> telnetd/o-optimize/telnetd.exe -net nic -net tap,ifname=tap0
> (this makes /etc/qemu-ifup tap0 and /etc/qemu-ifdown tap0 run before 
> and after qemu run.)
>
> When I run above command, I can see the virtual machine's code is 
> running. (it's RTEMS network-demo program. telnetd.exe)
> From outside the host, I can ping to host and the guest. So I thought 
> everything is fine But I then I found something is wrong..
> When I telnet to 129.254.132.47, it is centOS as expected.
> But when I telnet to 129.254.132.48, it takes unusually long (like 10 
> seonds?) then I see the loging prompt coming from CentOS.(the host)
> I can log into it, and it's my host machine.
> (By the way, both telnetting looked hampered by something, like 
> interfering one another by wrong setting..)
>
> I can run the same telnetd program using actual board the qemu 
> emulator is emulating, and I can telnet to the board (and of course 
> it's RTEMS). Only, when using actual board, I use physical network 
> cable between my host and the board. (host 10.10.10.1 and the board 
> 10.10.10.11)
>
> I tried setting ETH0IP to 129.254.132.47 in qemu-ifup script but it 
> didn't work.
>
> Please anyone tell me what the problem is..
>
> Kind regards,
> Chan Kim


Enjoy

Jakob
-- 
Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com
Transformervej 29, 2860 Søborg, 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]