qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Re: multiple virtual network with qemu


From: Sergey Bychkov
Subject: Re: [Qemu-devel] Re: multiple virtual network with qemu
Date: Fri, 7 Dec 2007 16:08:22 +0200

----- Original Message ----- From: "nik600" <address@hidden>
To: <address@hidden>
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




reply via email to

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