A tool to quickly setup KVM environments on NCL.
- A ns file for use with DETERLab and startup scripts for each physical node
- Installation script for KVM
- Image creation and compression scripts (currently only for Debian 8)
- KVM network configurations for each physical node
- VM installation script for easy deployment after the environment has been setup
This tool can be run on any machine with JDK 8 (tested with 8u121) installed.
First, clone this repository. Then run the following command:
For macOS/Linux:
$ ./gradlew start --console plain
For Windows:
> gradlew.bat start --console plain
$ ./gradlew start --console plain
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:start
Creating root output directory/cleaning it out
Setting KVM config
Please enter in number of physical nodes (1-100): 5
Number of physical nodes: 5
Please enter in number of virtual nodes per physical node (1-20): 5
Number of VMs per physical node: 5
Creating files
KVM
node0: 172.30.1.2
debvm-1 - debvm-5: 192.168.101.2 - 192.168.101.6
node1: 172.30.1.3
debvm-1 - debvm-5: 192.168.102.2 - 192.168.102.6
node2: 172.30.1.4
debvm-1 - debvm-5: 192.168.103.2 - 192.168.103.6
node3: 172.30.1.5
debvm-1 - debvm-5: 192.168.104.2 - 192.168.104.6
node4: 172.30.1.6
debvm-1 - debvm-5: 192.168.105.2 - 192.168.105.6
BUILD SUCCESSFUL
Total time: 5.138 secs
output
├── chmod.sh
└── kvm
├── 0-deterlab-ns-file
│ ├── 1-import-ns-file-into-deterlab-you-can-also-change-the-topology
│ ├── kvm.ns
│ ├── node0-nodeStartup.sh
│ ├── node1-nodeStartup.sh
│ ├── node2-nodeStartup.sh
│ ├── node3-nodeStartup.sh
│ └── node4-nodeStartup.sh
├── 1-install-kvm
│ └── KVM-install.sh
├── 2-create-image
│ ├── 1-run-create-image-script-first
│ ├── 2-then-run-compress-image-script
│ ├── compress-image.sh
│ └── create-image.sh
├── 3-create-network-and-routes
│ ├── 1-run-the-corresponding-script-on-each-physical-node
│ ├── node0-network.sh
│ ├── node1-network.sh
│ ├── node2-network.sh
│ ├── node3-network.sh
│ ├── node4-network.sh
│ ├── xml-node0-network.xml
│ ├── xml-node1-network.xml
│ ├── xml-node2-network.xml
│ ├── xml-node3-network.xml
│ └── xml-node4-network.xml
├── 4-install-vm
│ ├── 1-ensure-that-you-have-debvm-base.qcow2-in-this-folder
│ ├── 2-run-this-script-file-on-all-physical-nodes
│ └── VM-install.sh
└── network-ip.txt
- Edit the variables
KVM_IMAGE_NAMEandKVM_STARTUP_FILE_FOLDERin NSFile.java to use the correct image and user folder on NCL (this can be done with just a text editor).- If you do not yet have a KVM image on NCL, start with the Ubuntu Server 14.04 image and use the
KVM-install.shscript in theoutput/1-install-kvmfolder.
- If you do not yet have a KVM image on NCL, start with the Ubuntu Server 14.04 image and use the
- Run the tool using the instructions above.
- Upload the resulting output files to your NCL user folder, then run the
chmod.shscript to make all the files executable.- The resulting path of the
0-deterlab-ns-filefolder holds the startup scripts and should either be copied to where you defined theKVM_STARTUP_FILE_FOLDER, or the variable can just point to the0-deterlab-ns-filefolder itself.
- The resulting path of the
- If you need to create the base VM image (currently of Debian 8), use the
create-image.shscript in theoutput/2-create-imagefolder.- The script has been tested to run on an Ubuntu 14.04 machine (it can either be your own local machine or a node on NCL).
- The script requires internet access and working
apt-getsources. - If you want to customize the VM image, you can do so now.
- After installation is completed, run these commands in the VM:
$ dd if=/dev/zero of=/mytempfile $ rm -f /mytempfile $ shutdown now - After the VM has shutdown, run the
compress-image.shscript to create a compressed copy of the VM image. - The resulting compressed image can be found here:
/home/vms/deb/debvm-base.qcow2
- Create an experiment on NCL using the
kvm.nsfile found inoutput/0-deterlab-ns-file.- You can change the network topology here, but do not change the IP addresses of the physical nodes because they are tied to the network configurations for the virtual nodes.
- On each physical node, run the corresponding network script in
output/3-create-network-and-routes.- e.g. on
node0, run thenode0-network.shscript.
- e.g. on
- Before installing the VMs on each physical node, make sure that you have the base VM image
debvm-base.qcow2in the folderoutput/4-install-vm. - On each physical node, run the
VM-install.shscript inoutput/4-install-vm. - And that's it! You can find the IP addresses of each physical and virtual node in the
network-ip.txtfile in theoutputfolder.
- There is a limit of 300 physical nodes and 20 virtual nodes (per physical node) (this can of course be changed in the source code).