/home / fatec / admsorede / QEMU Setup --::--

ADM de Sistemas Operacionais de Rede

Prof. Rossano Pablo Pinto, MSc.



QEMU Networking Setup

#####################################################################
# UNICAST - TWO MACHINES ONLY
#####################################################################

# SCENARY:

         SERVER                                CLIENT
  +---------------------+             +----------------------+
  |     +------+        |             |     +------+         |
  |     | QEMU | LISTEN |             |     | QEMU |         |
  |     |      |  9999  |  CONNECT    |     |      |         |
  |     |      +--|<----+-------------+-----+      |         |
  |     | eth0 |        |             |     | eth0 |         |
  |     +--+---+        |             |     +--+---+         |
  |        | 10.10.8.3  |             |        | 10.10.8.4   |
  |        |            |             |        |             |
  | tap0---+            |             | tap0---+             |
  | 10.10.8.1           |             | 10.10.8.2            |
  |                     |             |                      |
  |  eth0               |             |  eth0                |
  +---+-----------------+             +---+------------------+
      | 192.168.202.22                    | 192.168.202.37
      |                                   |            
  ..--+-----------------------------------+-----....

# SERVER
sudo qemu -m 768 -hda linux.fs -boot c \
          -net nic,vlan=2 \
          -net tap,vlan=2,script=qemu-ifup \
          -net socket,vlan=2,listen=:9999

# CLIENT
sudo qemu -m 768 -hda linux.fs -boot c \
          -net nic,vlan=2 \
          -net tap,vlan=2,script=qemu-ifup \
          -net socket,vlan=2,connect=192.168.202.22:9999


#####################################################################
# Connecting several qemu instances at the same "bus" (use multicast)
#####################################################################

1-) @Machine A - 10.10.8.2 - TAP0: 10.10.8.1

rossano@studio:~$ sudo qemu -localtime -m 768 -hda discovirtual.fs -boot c \
                            -net nic,macaddr=52:54:00:12:34:56 \
                            -net socket,mcast=230.0.0.1:9999 \
                            -net tap,script=qemu-tap0

2-) @Machine B - GUEST: 10.10.8.4 - TAP0: 10.10.8.3 

rossano@movel:~$ sudo qemu -localtime -m 768 -hda discovirtual.fs -boot c \
                           -net nic,macaddr=52:54:00:12:34:57 \
                           -net socket,mcast=230.0.0.1:9999 \
                           -net tap,script=qemu-tap0

3-) @Machine C - GUEST: 10.10.8.6 - TAP0: 10.10.8.5

rossano@zion:~$ sudo qemu -localtime -m 768 -hda discovirtual.fs -boot c \
                          -net nic,macaddr=52:54:00:12:34:58 \
                          -net socket,mcast=230.0.0.1:9999 \
                          -net tap,script=qemu-tap0

#########################################
The contents of file qemu-tap0 must be:

#!/bin/sh
sudo /sbin/ifconfig $1 10.10.8.1 netmask 255.255.255.0

Change IP address accodingly !! RPP





Faculdade de Tecnologia de Americana :: Curso de Análise de Sistemas e Tecnologia da Informação
Rua Emílio de Menezes, s/n, Vila Amorim - Tel. +55 (19) 3406-5776 CEP: 13xxx-xxx / Americana / SP / Brasil
Copyleft 2007,2008,2009 Rossano Pablo Pinto