CNT5605 — 2018 Fall
Assignment 3
No journal required.

Assignment: Virtualization with QEMU

Your objectives are to change the networking on your new server from DHCP to static, install QEMU, and then install both Arch and NixOS as virtual servers.

(If you haven't done an "apt-get update && apt-get upgrade", it would be a good idea to do so now before starting on the assignment.)

First, change your networking from DHCP to a static network configuration. Use an IP number derived by adding your seat number to 192.168.26.200; for instance, if your seat number is 23, your ip would be 192.168.26.223. the gateway is "192.168.26.1", the netmask is "255.255.255.0", and the broadcast address is "192.168.26.255". I recommend using the static method delineated at https://wiki.debian.org/NetworkConfiguration, but feel free to do something different if you prefer.

If you use the static method from above, it boils down to adding lines like

auto eth0
iface eth0 inet static
        address 192.168.26.223
        netmask 255.255.255.0
        gateway 192.168.26.1
to the end of the file /etc/network/interfaces (or creating a new file in /etc/network/interface.d/), and then verifying that "/etc/resolv.conf" has 192.168.26.253 as your DNS server. Please reboot after you make these changes to verify that you everything works. Use the commands 'ifconfig eth0' (or 'ip addr' if you don't have ifconfig installed), 'netstat -rn', and 'cat /etc/resolv.conf' to verify that the results look reasonable:
$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr d4:3d:7e:98:ad:78  
          inet addr:192.168.26.223  Bcast:192.168.26.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:734543 errors:0 dropped:0 overruns:0 frame:0
          TX packets:169551 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:583246892 (583.2 MB)  TX bytes:20797887 (20.7 MB)
$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.26.1    0.0.0.0         UG        0 0          0 eth0
192.168.26.0    0.0.0.0         255.255.250.0   U         0 0          0 eth0
$ cat /etc/resolv.conf
nameserver 192.168.26.253

(If you haven't installed a desktop environment yet, it would be a good time to do so. The easiest way to do this probably to use "apt-get install mate", which will give you a pretty full environment. It's probably easiest to reboot after you do this installation, though it's not necessary.)

Next, install QEMU; you can read about using QEMU in Debian at https://wiki.debian.org/QEMU, but the fundamental step is along the lines of

$ apt-get install qemu qemu-kvm qemu-system

Next, pull down an ISO of NixOS from here; I would suggest "latest-iso-graphical-x86_64-linux", but "latest-iso-minimal-x86_64-linux" is certainly viable, and is smaller.

Now use your image to install a QEMU server in the same subdirectory:

$ qemu-img create nixos0.img 20G
$ qemu-system-x86_64 -hda nixos0.img -cdrom latest-iso-minimal-x86_64-linux -boot d -m 4096 -enable-kvm

And, finally, after you have installed, then reboot without the cd image:

$ qemu-system-x86_64 -hda nixos0.img -boot d -m 4096 -enable-kvm

You might be amused to visit the "/nix/*" subdirectories.


Finally, it's time to do the same for Arch. First, download an Arch ISO. For example:

$ wget http://www.gtlib.gatech.edu/pub/archlinux/iso/2018.09.01/archlinux-2018.09.01-x86_64.iso
Now create a QEMU image file "arch0.img" with qemu-img, and then boot the ISO in much the same manner that you did for NixOS. Follow the installation instructions at Arch Installation Guide.

A journal is not due for this assignment.