Virtual Machine

OpenStack

For any labs requiring a Linux-based OS, you may use the university's private cloud service (OpenStack).

Using this, you may create / administer your own Virtual Machines (using a Web-based UI). Note that you require some extra permissions on your student account before-hand (all course participants should have received them).

Since the VMs have private IPs (not usable from the Internet), you will also need special care when connecting (ssh–ing in) to them. That is, use a special frontend machine as proxy / intermmediary: fep.grid.pub.ro. You can do this either by ssh–ing into fep and, from there, ssh-ing to your virtual machine's private IP address (written in OpenStack's UI when creating the VM), OR (the preferred method) by using an advanced ssh' feature: jump hosts!

Here are the rough steps:

1. First time setup (only need to to this once, unless you lose your key!):

  • On your personal PC / laptop (in a bash-like or cmd shell), generate a public/private SSH keypair (if you haven't already):
    # first, check if a keypair already exists
    you@yourlaptop:~# ls -l ~/.ssh/
    # if the files `id_ed25519` and `id_ed25519.pub` already exist, SKIP this next step:
    you@yourlaptop:~# ssh-keygen -t ed25519  # use elliptic curves, better + shorter keys!
    # answer the defaults (aka just press enter multiple times)
    you@yourlaptop:~# ls -l ~/.ssh/
    -rw------- 1 root root 2602 Oct 15 12:59 id_ed25519     # <-- THE PRIVATE KEY, keep secret!
    -rw-r--r-- 1 root root  571 Oct 15 12:59 id_ed25519.pub # <-- your PUBLIC key to give away!
    # print and copy the private key (including the 'ssh-ed25519' prefix!):
    you@yourlaptop:~# cat ~/.ssh/id_ed25519.pub
    ssh-ed25519 AAAAB3NzaC...  # a very long line containing the public key number
  • Now, connect to the university's frontend processor machine (FEP):
    # first, login into fep using your Moodle account
    you@yourlaptop:~# ssh moodle.username@fep.grid.pub.ro
    # the first time, you'll need to authenticate using a browser, READ THE INSTRUCTIONS CAREFULLY!
    # we want to avoid this the next times we ssh into FEP, so we will do the following:
    [moodle.username@fep8 ~]$ mkdir -p ~/.ssh/
    [moodle.username@fep8 ~]$ nano ~/.ssh/authorized_keys
    # paste your public key, INCLUDING THE ssh-ed25519 prefix!
    # save, then exit!
  • In a separate terminal, try to login again into fep.grid.pub.ro. It should NOT ask for two-factor authentication anymore!
  • DO NOT LOSE (or share) THE PRIVATE KEY ON YOUR PC! It can be used to authenticate on your behalf on FEP (and possibly more servers you setup the key with)!
  • Now it's time to use OpenStack's Web UI! Open it in your browser, authenticate using login.upb.ro, then:
  • Compute → Key Pairs → Import Public Key, give it a suggestive name (e.g., “My Laptop”), set Key Type to SSH and paste your public key (contents of id_ed25519.pub). Note: you only need to do this once per your device's lifetime (redo only if you lose and re-generate the key!).
  • One-time setup is over! Proceed to create a new Virtual Machine and connect to it using ssh (read the following steps).

2. Create a new Virtual Machine on the UPB's OpenStack private cloud platform:

  • Go to https://cloud.grid.pub.ro/. Click Compute → Instances → Launch Instance button!
    • Fill the Instance Name (use your name + lab number for law & order);
    • Go to the Source page, search the Available section for ISC 2023 then click the up arrow icon to select it;
    • From Flavor, choose m1.small (1GB RAM, 10GB disk should be enough);
    • From Networks, choose vlan9 (click the up arrow icon);
    • Finally, click Launch Instance!
  • Unfortunately, you must now wait a couple of minutes (~5 min in the worst case) until the VM is provisioned and booted!
  • Wait until OpenStack allocates an IP address to your VM; it should begin with 10.9…; be careful: only search for the VM with your given name (don't worry, you will not be able to connect to other students' VMs without their private keys :P)!
  • Periodically, try to connect to it with SSH on your PC (using FEP as jump target):
    # note: -J receives your FEP URL; your VM has the `student` + your pubkey as credentials!
    you@yourlaptop:~# ssh -J moodle.username@fep.grid.pub.ro student@10.9.X.Y
    # when the VM is ready, authentication should proceed withut asking for any passwords!

Our institution provides some rather limited resources at our disposal (mainly, a limit of 40 VMs).
Please delete the instance after you're done with your lab / assignment to allow others to use the infrastructure without any hurdles!

isc/info/virtualmachine.txt · Last modified: 2023/11/17 14:06 by florin.stancu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0