Hey Bernard,

I am used to setup a virtual network with the following pattern:
LAN----hostOS----node1----------node2
- Virtual node 1 has two virtual nics, one to communicate with the physical 
machine (tap) and one to communicate with the virtual LAN (all my virtual 
machines are on this LAN)
- Virtual node 2 has only one virtual nic attached to virtual LAN

Before to start creating nodes, check that your /etc/qemu-ifup file is 
something like: 
/sbin/ifconfig $1 172.20.0.1 up

To launch my first virtual node, i use the following command:
qemu <image_node1> -net nic,macaddr=52:54:00:12:34:56 -net socket,listen=:1234 
-net nic -net tap
The first part of the command (-net nic,macaddr=52:54:00:12:34:56 -net 
socket,listen=:1234) create a virtual network interface which allows you to 
create a virtual LAN (listening for connections from other virtual nodes on 
the port 1234). The second part of the command will create a tap interface to 
communicate with the physical machine (the physical machine will have a tap0 
interface w/ the IP address 192.168.0.1).
To launch my second virtual node, i use the following command
qemu <image_node2> -net nic,macaddr=52:54:00:12:34:52 -net 
socket,connect=<address_virtual_node1>:1234
The virtual node will automatically join the virtual network created by the 
first node.

You have now the following network (just with two virtual nodes):
LAN----eth0:hostOS:tap0---- eth0:Node1:eth1----------eth0:node2 

So now if you want to put your first node on the global network (local LAN), 
you have to create a bridge between the ethernet card of the HostOS and the 
tap interface. For that, execute the following commands: 
brctl addbr br0
ifconfig eth0 promisc 0.0.0.0
ifconfig tap0 promisc 0.0.0.0
brctl addif br0 eth0
brctl addif br0 tap0
ifconfig br0 192.168.0.100
Then in your node 1, "ifconfig eth0 192.168.0.x". You should be able now to 
ping the bridge on the physical node from the node1, but also other machines 
on your LAN (do not forget to set up default routes if needed).

Most of the time, i just stop here but you should be able to add virtual 
machines on the LAN creating a bridge on the node 1 between the two virtual 
nics. For that just proceed like on the real machine: create the bridge, add 
the two interfaces. Then set a new IP address on your second node (address 
for your NAT) and it should work.

For information, a bridge is efficient and completely transparent because at 
the level 2 of the OSI network model.

BTW, if you are using Qemu on a x86_64 machine with a 64 bits distribution, 
forget it, it will not work, there are too much bugs in the current Qemu 
release. :-( But you can still use a 32 bits Linux distribution.

I wrote that based on my memory, i hope i did not say stupid stuff. If it is 
not working, let me know i can try to figure out making some real tests.

My 2 cents,

Le Mercredi 29 Mars 2006 00:43, Bernard Li a écrit :
> I'm trying to setup qemu such that its virtual network card can be on the
> same network as the host OS.  Eg. the system I'm running qemu's ip is
> 192.168.0.2, I'd like the virtual machine to be able to get an ip address
> of 192.168.0.3 - is that possible - if so any pointers on how to set it up?
>
> I've read that you're supposed to have an /etc/qemu-ifup but I see there
> are many different versions of it and most of them requires setting up ip
> masquerade.
>
> Thanks,
>
> Bernard

-- 
Geoffroy


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Oscar-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oscar-devel

Reply via email to