Service Management in Networks - Leischner

Practice sheet 6 - Vagrant with shell provisioning (1 Point)

Since we have massive problems with the IPv6 network in the Netlab (the tunnel is broken and cannot be restored quickly) the homelab unfortunately cannot be set up and operated "in the wild". The reason is that we don't have enough static IPv4 addresses for external access.

One solution is to transfer the homelab to an Ubuntu desktop environment (e.g. notebook). Fortunately, this is not too complicated and we can reuse most of the already created software. Since we have direct access in a desktop environment, some things become even easier. Cooperation within the working groups is possible without any problems via Git.

 

Task 1 - Transfer homelab to notebook

  1. Create an Ubuntu desktop environement homelab2 with ansible, virtualbox and vagrant installed. The environment homelab2 may be your regular Ubuntu notebook or a virtual environment running on your notebook. Also a desktop ubuntu on an netlab ESXi may be used.
    (The crucial point is: you must have dírectly routed traffic (without NAT) to at least one guest running on the host.)
  2. Inside your homelab2 create a GIT with the name vagrant and connect it to your remote GIT. We will use this GIT for our further experiments in homelab2.
  3. Create a key pair rsa_mgmt of management keys  to use for the management of the guests of homelab2.

 

Task 2 - Vagrant first test

  1. Go to the directory vagrant and initialize vagrant with vagrant init.
  2. Write a basic Vagrantfile that uses the vagrant box ubuntu/xenial64 . Start the Vagrantfile with the command vagrant up . You can use the command vagrant ssh to connect to the started machine ubuntu-xenial.
  3. Answer the following questions:
    • What is the name of the interface and where in ubuntu-xenial  is it defined?
    • What are the IP addresses of the machine ubuntu-xenial? To which address ranges do these IP addresses belong?
    • Use ping to check whether you can reach ubuntu-xenial from homelab2 or vice versa. Give a well-founded explanation of the observed behaviour.

 

Task 3 - Dockhost - Step 1

With this task we want to expand the file Vagrantfile step by step.

  1. Adjust the Vagrantfile so that the vagrant box is passed as a constant.
  2. Expand the Vagrantfile to configure the number of CPUs as well as the RAM memory of the guest.
  3. Expand the Vagrantfile to set the host name to dockhost.
  4. Expand the Vagrantfile to create a private network 172.16.0.0/24 and to create an additional interface 172.16.0.100 for the guest.
  5. What are the names of the two interfaces and where in dockhost  are they defined?
  6. Create a directory provision for the provisining code. We want to use the Vagrant Shell provisioner, because it is recommended for users new to Vagrant who want to get up and running quickly. (Of course, if you want to you can also use other provisioner like Ansible or Chef.)
    To start with shell provisioning place a shell script script01.sh (containing just echo "hello world") in the folder provision. Call this script from your Vagrantfile and test it with the command vagrant provision.
  7. Install the app htop via script01.sh. Check the installation of htop.
  8. Now we want to prepare our system such that we can access it via ssh and the key pair rsa_mgmt. To do this you have to copy the public key of rsa_mgmt into the guest dockhost. Use the script script01.sh to do this.
  9. Check your ssh connectivity via the command ssh dockhost.
  10. Use ping to check whether you can reach (via interface 172.16.0.100) ubuntu-xenial from homelab2 or vice versa. Give a well-founded explanation of the observed behaviour.

 

Please, submit (1) your answers of the questions as a PDF and (2) the git code vagrant.zip as a zip file to LEA - Lernen und Arbeiten online .

 

Impressum | Datenschutz | leischner.inf.h-brs.de, last modification: 10.06.2019-19.12