User Tools

Site Tools


qemunet:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

qemunet:index [2016/09/06 13:23] orelqemunet:index [2024/03/18 15:06] (current) – external edit 127.0.0.1
Line 3: Line 3:
 //QemuNet is a light shell script based on QEMU and VDE to enable easy virtual networking.// //QemuNet is a light shell script based on QEMU and VDE to enable easy virtual networking.//
  
-[[qemunet:misc|Misc]] 
  
-==== Download & Install ====+  * QemuNet: https://github.com/orel33/qemunet 
 +  * QemuNet images: http://aurelien.esnard.emi.u-bordeaux.fr/qemunet/
  
-//QemuNet// is a free software distributed under the terms of the GNU General Public License (GPL) and it is available for download at [[ https://gforge.inria.fr/projects/qemunet | Inria GForge ]].  +=== How to use my own image in QemuNet?==
- +
-First of all, //QemuNet// requires to fulfill the following dependencies:  +
- +
-  $ sudo apt-get install qemu vde2 libattr1 libvirt0 socat +
-   +
-Moreover, one requires //Bash// version greater than or equal to 4. +
- +
-//QemuNet// requires QEMU (qemu-system-x86_64) with VDE and KVM supports enabled and with a **version greater than or equal to 2.1**. Check it: +
- +
-  $ qemu-system-x86_64 --version   +
- +
-Once all your dependencies are satisfied on your system, download it from SVN repository with anonymous access: +
- +
-  $ svn checkout https://scm.gforge.inria.fr/anonscm/svn/qemunet/trunk qemunet +
-   +
-If the runtime commands required by //QemuNet// (qemu-system-x86_64, qemu-img and vde_switch) are not available in standard directory, you will need to edit the main script //qemunet.sh//+
- +
-Then you can launch a __simple test__  based on a Linux TinyCore system. See README file for further details. +
- +
-  $ ./qemunet.sh -t tinycore/lan4.topo +
- +
-Then, you can start to play...  +
- +
-==== Examples ==== +
- +
-You will find several examples in the **demo** subdirectory. But, let's start with a basic LAN topology. +
- +
-First, you need to prepare a virtual topology file, as for example //demo/lan4.topo//. It describes a LAN with 4 //debian8// Virtual Machines (VM), named //host1// to //host4// and one Virtual Switch (VS) names //s1//. The //debian8// system must refer to a valid system in the QemuNet configuration file //qemunet.cfg//+
- +
-<code bash lan4.topo> +
-# SWICTH switchname +
-SWITCH s1 +
-# HOST sysname hostname switchname0 switchname1 ... +
-HOST debian8 host1 s1 +
-HOST debian8 host2 s1 +
-HOST debian8 host3 s1 +
-HOST debian8 host4 s1 +
-</code> +
- +
-Here is an example of the QemuNet configuration file //qemunet.cfg//. It requires to provide a valid Debian image for QEMU. Optionnaly, you will need to extract the kernel files (initrd & vmlinuz) from this image, as explained later. See below to know how to build his own debian image for QEMU. +
- +
-<code bash qemunet.cfg> +
-if [ -z "$IMGDIR" ] ; then IMGDIR="$(dirname $(realpath $0))" ; fi +
-# debian8 +
-SYS[debian8]="linux"                              # system type (linux|windows|...) +
-FS[debian8]="$IMGDIR/images/debian8/debian.img"   # absolute path to raw system image for QEMU +
-QEMUOPT[debian8]="-localtime -m 512"              # qemu extra options +
-KERNEL[debian8]="$IMGDIR/images/debian8/vmlinuz"  # absolute path to system kernel (optionnal, only for linux) +
-INITRD[debian8]="$IMGDIR/images/debian8/initrd"   # absolute path to system initrd (optionnal, only for linux) +
-</code> +
- +
-Following, you can launch your Virtual Network (VN). All the current session files are provided in the //session// directory, that is linked to a unique directory in /tmp.  +
- +
-<code> +
-./qemunet.sh -t demo/lan4.topo +
-</code> +
- +
-Once you have finish your work, halt all machines properly with "poweroff" command. Thus, you are sure that all VM disks are up-to-date.  +
- +
-If you want to restore your session from the current session directory, you can simply type: +
-<code> +
-./qemunet.sh -S session  +
-</code> +
- +
-In order to save your session, you need to save all session files in a tgz archive.  +
- +
-<code> +
-cd session ; tar cvzf lan4.tgz * ; cd .. +
-</code> +
- +
-So, you will be able to restore your session later as follow: +
- +
-<code> +
-./qemunet.sh -s lan4.tgz +
-</code> +
-   +
-For instance, if you modify the system files of the VM //host1//, those modifications will not modify directly the raw system image //debian.img// (provided in //qemunet.cfg//), but it will store it the file //session/host1.qcow2//. By removing this file, you will restart the next session with the initial raw system image.   +
- +
-In addition, we use a "/etc/rc.local" script to load a user-defined script "/mnt/host/start.sh", that is stored in the external session directory. It is a flexible way to setup each VM without modifying the raw system image or using the qcow2 files. +
- +
-==== Manual ==== +
- +
-QemuNet is based on a single bash script //qemunet.sh//. Here are detailed available options: +
- +
-<code> +
-Start/restore a session: +
-  qemunet.sh -t topology [-a images.tgz] [...] +
-  qemunet.sh -s session.tgz [...] +
-  qemunet.sh -S session/directory [...] +
-Options: +
-    -t <topology>: network topology file +
-    -s <session.tgz>: session archive +
-    -S <session directory>: session directory +
-    -h: print this help message +
-Advanced Options: +
-    -a <images.tgz>: load a qcow2 image archive for all VMs +
-    -c <config>: load system config file (default is qemunet.cfg) +
-    -x: launch VM in xterm terminal instead of SDL native window (only for linux system) +
-    -y: launch VDE switch management console in xterm terminal +
-    -i: enable Slirp interface for Internet access (ping not allowed) +
-    -m: mount shared directory in /mnt/host (default for linux system) +
-    -q: ignore and remove qcow2 images for the running session +
-    -M: disable mount +
-    -v: enable VLAN support +
-    -k: enable KVM full virtualization support (default) +
-    -K: disable KVM full virtualization support (not recommanded) +
-    -l <sysname>: launch a VM in standalone mode to update its raw disk image +
-</code> +
- +
-   +
-==== Configuration of QemuNet ==== +
- +
-Once you have download QemuNet, you need first to set the runtime commands for QEMU and VDE in //qemunet.sh//, if they don't use the default directory. +
-  +
-<code> +
-QEMU="/usr/bin/qemu-system-x86_64" +
-QEMUIMG="/usr/bin/qemu-img"     +
-VDESWITCH="/usr/bin/vde_switch" +
-</code> +
- +
-Then, you have to provide a configuration file that define several virtual systems and its parameters (name, type, disk image file, ...). The default configuration file is //qemunet.cfg//. it is a bash script that uses associative arrays (bash 4 or greater required). For instance, the following file defines two //linux// systems called "debian8", and one //windows// system called "winxp".  +
- +
-<code bash qemunet.cfg> +
-# template +
-# SYS[sysname]="linux|windows|..." +
-# FS[sysname]="/absolute/path/to/raw/system/image" +
-# QEMUOPT[sysname]="qemu extra options" +
-# KERNEL[sysname]="/absolute/path/to/system/kernel"  # optional, but useful for -x option +
-# INITRD[sysname]="/absolute/path/to/system/initrd"  # optional, but useful for -x option +
- +
-# IMGDIR="/absolute/path/to/raw/system/images"  +
-if [ -z "$IMGDIR" ] ; then IMGDIR="$(dirname $(realpath $0))" ; fi +
- +
- +
-# tinycore  +
-SYS[tinycore]="linux" +
-FS[tinycore]="$IMGDIR/images/tinycore/linux-tinycore-linux-6.4-2.img" +
-QEMUOPT[tinycore]="-localtime -m 512" +
- +
-# debian8 +
-SYS[debian8]="linux" +
-FS[debian8]="$IMGDIR/images/debian8/debian.img" +
-QEMUOPT[debian8]="-localtime -m 512" +
-KERNEL[debian8]="$IMGDIR/images/debian8/vmlinuz"  # optional, but useful for -x option +
-INITRD[debian8]="$IMGDIR/images/debian8/initrd"   # optional, but useful for -x option +
- +
-# winxp +
-SYS[winxp]="windows" +
-FS[winxp]="$IMGDIR/images/windows/winxp.img" +
-QEMUOPT[winxp]="-localtime -m 1G -usbdevice tablet" +
- +
-# win10 +
-SYS[win10]="windows" +
-FS[win10]="$IMGDIR/images/windows/win10.img" +
-QEMUOPT[win10]="-localtime -m 1G -usbdevice tablet" +
-</code> +
- +
-The SYS and FS arrays are required for each system. They respectively define the system type (linux, windows, ...) and the QEMU disk image file (in raw format). QEMUOPT can be used to pass additional options to QEMU when launching the VM, as for instance cpu type or max memory. See QEMU documentation for detailed options. Both KERNEL and INITRD are optional for linux system, but required if you want to launch the VMs in xterm (option -x). +
- +
-==== How to Install my Own System for QEMU and QemuNet ====+
  
 Here are some testing QEMU images: Here are some testing QEMU images:
Line 173: Line 13:
   * http://wiki.qemu.org/Testing   * http://wiki.qemu.org/Testing
  
-Follow the next tutorial to install your own Linux system for QemuNet...+Follow the next tutorial to install your own image of Linux system in QemuNet
 + 
 +  * [[qemunet:install::debian|Debian]] 
 +  * [[qemunet:install::tinycore|TinyCore]] 
 +  * [[qemunet:install::deboostrap|Debootstrap]] 
 +  * [[qemunet:install::alpine|Alpine]]
  
-  * [[qemunet:debian|How to install a Debian Linux System for QemuNet?]] 
-  * [[qemunet:tinycore|How to install a TinyCore Linux System for QemuNet?]] 
  
-==== Documentation ====+=== Misc ===
  
-  * QEMUhttp://wiki.qemu.org +  * [[qemunet:misc | misc ]]
-  * QEMU Networking: http://wiki.qemu.org/Documentation/Networking +
-  * VDE: http://vde.sourceforge.net/ +
-  * VDE Manual : http://wiki.virtualsquare.org/wiki/index.php?title=VDE +
-  * Tutorial VDE : http://wiki.virtualsquare.org/wiki/index.php?title=VDE_Basic_Networking +
-==== Other Solutions ====+
  
-  * NEmu : http://nemu.valab.net/  
-  * MarionNet : http://www.marionnet.org/EN/ 
-  * User Mode Linux: http://user-mode-linux.sourceforge.net 
-  * GNS3: https://www.gns3.com 
  
  
qemunet/index.1473168203.txt.gz · Last modified: 2024/03/18 15:05 (external edit)