qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] multiple virtual network with qemu
@ 2007-11-29  9:38 nik600
  2007-12-07  9:14 ` [Qemu-devel] " nik600
  0 siblings, 1 reply; 4+ messages in thread
From: nik600 @ 2007-11-29  9:38 UTC (permalink / raw)
  To: qemu-devel

Hi

i'm trying to set up some virtual network with qemu but i'm
experiencing some problems:

starting the hosted system with dhcp it gets the ip 10.0.2.15 and gw
10.0.2.2, if i activate the forwarding ip on the hosting system all
works fine.

But i'd like to do something like that:


- gw (192.168.1.1)
     | -> hosting machine (192.168.1.2)
            | -> virtual ip (192.168.1.3) -> NAT -> emulated system 1
(10.0.2.15)
            | -> virtual ip (192.168.1.4) -> NAT -> emulated system 2
(10.0.2.16)


Or if it possible


- gw (192.168.1.1)
     | -> hosting machine (192.168.1.2)
            | -> virtual ip (192.168.1.3) -> emulated system 1 (192.168.1.3)
            | -> virtual ip (192.168.1.4) -> emulated system 2 (192.168.1.4)


Can i do that?

Thanks
-- 
/*************/
nik600
https://sourceforge.net/projects/ccmanager
https://sourceforge.net/projects/reportmaker
https://sourceforge.net/projects/nikstresser

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] Re: multiple virtual network with qemu
  2007-11-29  9:38 [Qemu-devel] multiple virtual network with qemu nik600
@ 2007-12-07  9:14 ` nik600
  2007-12-07  9:27   ` Laurent Vivier
  2007-12-07 14:08   ` Sergey Bychkov
  0 siblings, 2 replies; 4+ messages in thread
From: nik600 @ 2007-12-07  9:14 UTC (permalink / raw)
  To: qemu-devel

any idea?

On Nov 29, 2007 10:38 AM, nik600 <nik600@gmail.com> wrote:
> Hi
>
> i'm trying to set up some virtual network with qemu but i'm
> experiencing some problems:
>
> starting the hosted system with dhcp it gets the ip 10.0.2.15 and gw
> 10.0.2.2, if i activate the forwarding ip on the hosting system all
> works fine.
>
> But i'd like to do something like that:
>
>
> - gw (192.168.1.1)
>      | -> hosting machine (192.168.1.2)
>             | -> virtual ip (192.168.1.3) -> NAT -> emulated system 1
> (10.0.2.15)
>             | -> virtual ip (192.168.1.4) -> NAT -> emulated system 2
> (10.0.2.16)
>
>
> Or if it possible
>
>
> - gw (192.168.1.1)
>      | -> hosting machine (192.168.1.2)
>             | -> virtual ip (192.168.1.3) -> emulated system 1 (192.168.1.3)
>             | -> virtual ip (192.168.1.4) -> emulated system 2 (192.168.1.4)
>
>
> Can i do that?
>
> Thanks
> --
> /*************/
> nik600
> https://sourceforge.net/projects/ccmanager
> https://sourceforge.net/projects/reportmaker
> https://sourceforge.net/projects/nikstresser
>



-- 
/*************/
nik600
https://sourceforge.net/projects/ccmanager
https://sourceforge.net/projects/reportmaker
https://sourceforge.net/projects/nikstresser

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Re: multiple virtual network with qemu
  2007-12-07  9:14 ` [Qemu-devel] " nik600
@ 2007-12-07  9:27   ` Laurent Vivier
  2007-12-07 14:08   ` Sergey Bychkov
  1 sibling, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2007-12-07  9:27 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2078 bytes --]

I don't know if it is what  you want, but I'm using this:

iptable-restore < my_iptable

where my_iptable is:

*filter
:INPUT ACCEPT [6242:8433725]
:FORWARD ACCEPT [8802:8139455]
:OUTPUT ACCEPT [4070:537046]
COMMIT
*nat
:PREROUTING ACCEPT [54:3534]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [1:60]
-A POSTROUTING -o eth0 -j MASQUERADE 
COMMIT

and /etc/qemu-ifup is:

#!/bin/sh
echo "Configuring $1"
sudo /usr/sbin/tunctl -t $1
sudo /sbin/ip link set $1 up
sudo /sbin/ifconfig $1 192.168.1.1 broadcast 192.168.1.255 netmask
255.255.255.0

And I configure the guest with IP 192.168.1.2 and gateway 192.168.1.1.

Laurent

Le vendredi 07 décembre 2007 à 10:14 +0100, nik600 a écrit :
> any idea?
> 
> On Nov 29, 2007 10:38 AM, nik600 <nik600@gmail.com> wrote:
> > Hi
> >
> > i'm trying to set up some virtual network with qemu but i'm
> > experiencing some problems:
> >
> > starting the hosted system with dhcp it gets the ip 10.0.2.15 and gw
> > 10.0.2.2, if i activate the forwarding ip on the hosting system all
> > works fine.
> >
> > But i'd like to do something like that:
> >
> >
> > - gw (192.168.1.1)
> >      | -> hosting machine (192.168.1.2)
> >             | -> virtual ip (192.168.1.3) -> NAT -> emulated system 1
> > (10.0.2.15)
> >             | -> virtual ip (192.168.1.4) -> NAT -> emulated system 2
> > (10.0.2.16)
> >
> >
> > Or if it possible
> >
> >
> > - gw (192.168.1.1)
> >      | -> hosting machine (192.168.1.2)
> >             | -> virtual ip (192.168.1.3) -> emulated system 1 (192.168.1.3)
> >             | -> virtual ip (192.168.1.4) -> emulated system 2 (192.168.1.4)
> >
> >
> > Can i do that?
> >
> > Thanks
> > --
> > /*************/
> > nik600
> > https://sourceforge.net/projects/ccmanager
> > https://sourceforge.net/projects/reportmaker
> > https://sourceforge.net/projects/nikstresser
> >
> 
> 
> 
-- 
------------- Laurent.Vivier@bull.net  --------------
       "Any sufficiently advanced technology is
  indistinguishable from magic." - Arthur C. Clarke

[-- Attachment #2: Ceci est une partie de message numériquement signée --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Re: multiple virtual network with qemu
  2007-12-07  9:14 ` [Qemu-devel] " nik600
  2007-12-07  9:27   ` Laurent Vivier
@ 2007-12-07 14:08   ` Sergey Bychkov
  1 sibling, 0 replies; 4+ messages in thread
From: Sergey Bychkov @ 2007-12-07 14:08 UTC (permalink / raw)
  To: qemu-devel

----- Original Message ----- 
From: "nik600" <nik600@gmail.com>
To: <qemu-devel@nongnu.org>
Sent: 7.12.2007 11:14
Subject: [Qemu-devel] Re: multiple virtual network with qemu


> any idea?
[skip]
>> Or if it possible
>>
>>
>> - gw (192.168.1.1)
>>      | -> hosting machine (192.168.1.2)
>>             | -> virtual ip (192.168.1.3) -> emulated system 1 
>> (192.168.1.3)
>>             | -> virtual ip (192.168.1.4) -> emulated system 2 
>> (192.168.1.4)
>>
>>
>> Can i do that?

Yes. First You should configure bridge interface
in Debian it looks like:
== start of /etc/entwork/interfaces ==
#auto eth0 - do not configure eth0
iface eth0 inet static
# The primary network interface - now in bridge mode
auto br0
iface br0 inet static
        bridge_ports eth0
        address 192.168.1.2
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
=== end of /etc/entwork/interfaces ===

Do not forget `apt-get install bridge-utils`

Then make qemu-ifup-br0 instead of standard qemu-ifup
== start of ./qemu-ifup-br0 ==
#!/bin/sh
# brctl addbr br0
echo Configuring virtual interface $1
if [ "$UID" -eq "0" ]
then
    ifconfig $1 0.0.0.0 up
    if brctl addif br0 $1
    then
        # bridge exists and could be configured
        echo $1 added to br0
        ifconfig $1 0.0.0.0 up
        echo $1 configured for bridge
    else
        # fallback - no bridge configured
        echo $1 not added to br0
        ifconfig $1 169.254.1.1 up
        echo $1 configured to autoip
    fi
else
    echo Will sudo $0
    exec sudo -p "Password for $0:" $0
fi
=== end of ./qemu-ifup-br0 ===

Then start every VM with options
QEMU=/usr/bin/qemu # or something else
sudo $QEMU -net nic,model=rtl8139,macaddr=52:54:00:80:80:0N -net 
tap,script={$path_to_qemu_ifup_br0} -localtime -hda imageN -m 384

Where N is (1,2,etc)

BTW, this script could be included in installation

Sergey Bychkow
ICQ: 21014758
FTN: 2:450/118.55 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-07 14:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-29  9:38 [Qemu-devel] multiple virtual network with qemu nik600
2007-12-07  9:14 ` [Qemu-devel] " nik600
2007-12-07  9:27   ` Laurent Vivier
2007-12-07 14:08   ` Sergey Bychkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).