CNT5605 — 2016 Summer
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 Debian 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 the IP number given to you on the sheet of paper you received last Friday; 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.101
        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', '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.11  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

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

Now pull in the Debian testing netinstall ISO:

$ wget http://cdimage.debian.org/cdimage/daily-builds/daily/current/amd64/iso-cd/debian-testing-amd64-netinst.iso

Now do an install of your new virtual server via QEMU in a new subdirectory "qemu-images":

$ mkdir qemu-images
$ cd qemu-images
$ qemu-img create debian0.img 10G
$ qemu-system-x86_64 -hda debian0.img -cdrom debian-testing-amd64-netinst.iso -boot d -m 512 -enable-kvm
And, finally, reboot without the cd image:
$ qemu-system-x86_64 -hda debian0.img -boot d -m 512 -enable-kvm

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 10G
$ qemu-system-x86_64 -hda nixos0.img -cdrom latest-iso-minimal-x86_64-linux -boot d -m 4096 -enable-kvm
And, finally, 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.


A journal is not due for this assignment.