hi all, Test it again, I have confirmed that the problem is the firewall in the host. The guest can get ip from dhcp after the iptables be stoped. On the contrary, when I restart iptables, the guest cannot get the ip just now. Thanks a lot for all of you! !
Best Regards, wuyu On 2011-04-15,at 14:18:38, wuyu8242 wrote: >发送日期:2011-04-15 14:18:38 >收件人:Lucas Meneghel Rodrigues; Amos Kong; Qingtang Zhou >抄送:autotest >主题:Re: Re: [Autotest] About the mac addr and ip addr //pass >> >hi all, > >Good news, thanks firstly! My guest get the ip from my dhcp via the bridge >mode. Thank all of you very much! > >wuyu >>On 2011-04-15,at 12:00:13, wuyu8242 wrote: > >>发送日期:2011-04-15 12:00:13 >>收件人:Amos Kong; autotest >>抄送: >>主题:Re: [Autotest] About the mac addr and ip addr >>> >>On 2011-04-15,at 11:27:26, Amos Kong wrote: >> >>>发送日期:2011-04-15 11:27:26 >>>收件人:wuyu8242; autotest >>>抄送: >>>主题:Re: Re: Re: [Autotest] About the mac addr and ip addr >>>> >>>2011/4/15 wuyu8242 <wuyu8...@163.com>: >>>> On 2011-04-15,at 11:10:25, Amos Kong wrote: >>>> >>>>>发送日期:2011-04-15 11:10:25 >>>>>收件人:wuyu8242; autotest >>>>>抄送: >>>>>主题:Re: Re: [Autotest] About the mac addr and ip addr >>>>>> >>>>>>>2011/4/13 wuyu8242 <wuyu8...@163.com>: >>>>>>>> hi Lucas, Amos, >>>>>>>> >>>>>>>> Disturbing you!There are some issues about network test. About the mac >>>>>>>> addr >>>>>>>> and ip addr, the result of ifconfig include eth0 and eth1, the eth0 >>>>>>>> has no >>>>>>>> ip address, the eth1 has a ip: 10.0.2.25, but the conf file of eth1 is >>>>>>>> not >>>>>>> >>>>>>>What's your qemu commandline ? '10.0.2.25 always be assigned when we >>>>>>>use userspace network(NAT mode). >>>>>>>qemu-kvm -net user .... >>>>> >>>>>> my command line as following: >>>>>> [33m 92 04/15 05:48:34 INFO | kvm_vm:0987| Running qemu command: >>>>>> /usr/bin/qemu-kvm -name 'vm1' -monitor >>>>>> unix:'/tmp/monitor-humanmonitor1-20110411-062101-hWQJ',server,nowait >>>>>> -serial unix:'/tmp/serial-20110411-062101-hWQJ',server,nowait -drive >>>>>> file='/tmp/kvm_autotest_root/images/f11-64.qcow2',index=0,if=ide,cache=none >>>>>> -net nic,vlan=0,model=rtl8139,macaddr='9a:a3:23:b0:e0:d0',id='idsLxMpu' >>>>>> -net user,vlan=0 -m 512 -smp 2 -redir tcp:5000::22 -vnc :0 >>>>>> >>>>>> if the network is the NAT mode, why not connect other ip? and the >>>>>> 10.0.2.25 is fixed. >>>>> >>>>>qemu-kvm has two network modes >>>>> >>>>>1. NAT mode >>>>># qemu-kvm -net nic,... -net user,... >>>> yes, I used this mode, and this mode is default mode in code,too, so this >>>> mode should be connected to other host ip, but failed. >>> >>>guest)# ssh 10.0.2.2 (login host) >>>And I connect other host . >>>guest)# ping www.google.com (successfully ..) >>> >>o? but my host ip is 192.168.x.x not 10.0.x.x, only the guest ip is 10.0.x.x, >>that is say, the guest ip and host ip is not the same network segment, >>so i ping google failed. >> >>>>>2. bridge mode >>>>># qemu-kvm -net nic,.. -net tap,script=/etc/qemu-ifup >>> >>>You should try this, it's more popular. Libvirt uses this mode by default. >>> >>ok, I try it right now. O, I have a wrong understanding. :) >>thanks Amos:) >>>>># cat /etc/qemu-ifup >>>>>#!/bin/sh >>>>>switch=switch >>>>>/sbin/ifconfig $1 0.0.0.0 up >>>>>/usr/sbin/brctl addif ${switch} $1 >>>>>/usr/sbin/brctl setfd ${switch} 0 >>>>>/usr/sbin/brctl stp ${switch} off >>>>> >>>>>switch is a bridge device in the host, you can reference the following >>>>>document. >>>>>http://www.linux-kvm.org/page/KVM-Autotest/Client_Install#More_about_machine_setup_-_Bridges >>>>> >>>>>MORE detail for KVM network: http://www.linux-kvm.org/page/Networking >>>>> >>>> Okay, I will try it, thank you Amos :) >>> >> >> >>------------------ >>wuyu8242 >>2011-04-15 >>_______________________________________________ >>Autotest mailing list >>Autotest@test.kernel.org >>http://test.kernel.org/cgi-bin/mailman/listinfo/autotest >> > > >------------------ >wuyu8242 >2011-04-15 > ------------------ wuyu8242 2011-04-21 _______________________________________________ Autotest mailing list Autotest@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest