Route Server Configuration

Diarmuid O'Briain, diarmuid @ obriain.com
05/01/2018, version 1.0

GameCORE Research Centre, Institute of Technology, Carlow
netLabs!UG Research Centre, Makerere University

Last updated: 17-01-2018 10:10


LXC Container image installation

Install the LXD/LXC Software

On a Linux host install the LXD/LXC software. If you are not using Linux then a Virtual Machine will be required.

 Install LXD and the LXD Client.

  ubuntu@lxd:~$ sudo apt install lxd lxd-client
  
  ubuntu@lxd:~$ sudo sed 's/GRUB_CMDLINE_LINUX_DEFAULT=""/GRUB_CMDLINE_LINUX_DEFAULT="swapaccount=1"/' /etc/default/grub
  
  ubuntu@lxd:~$ lxc --version && lxd --version
  2.18
  2.18

  ubuntu@lxd:~$ systemctl status lxd-containers.service
     • lxd-containers.service - LXD - container startup/shutdown
     Loaded: loaded (/lib/systemd/system/lxd-containers.service; enabled; vendor p
     Active: active (exited) since Mon 2017-11-20 11:21:44 EAT; 10min ago
       Docs: man:lxd(1)
    Process: 890 ExecStart=/usr/bin/lxd activateifneeded (code=exited, status=0/SU
   Main PID: 890 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 4915)
     Memory: 0B
        CPU: 0
     CGroup: /system.slice/lxd-containers.service
  
  Nov 20 11:21:42 lxd1 systemd[1]: Starting LXD - container startup/shutdown...
  Nov 20 11:21:44 lxd1 systemd[1]: Started LXD - container startup/shutdown. 

Initialise LXD as root before creating any containers.

  alovelace@lxd:~$ sudo lxd init
  Do you want to configure a new storage pool (yes/no) [default=yes]? <CR>
  Name of the new storage pool [default=default]: <CR>
  Name of the storage backend to use (dir, btrfs, lvm) [default=btrfs]: <CR>
  Create a new BTRFS pool (yes/no) [default=yes]? <CR>
  Would you like to use an existing block device (yes/no) [default=no]? <CR>
  Size in GB of the new loop device (1GB minimum) [default=100GB]: <CR>
  Would you like LXD to be available over the network (yes/no) [default=no]? yes <CR>
  Address to bind LXD to (not including port) [default=all]: <CR>
  Port to bind LXD to [default=8443]: <CR>
  Trust password for new clients: alovelace <CR>
  Again: alovelace <CR>
  Would you like stale cached images to be updated automatically (yes/no) [default=yes]? <CR>
  Would you like to create a new network bridge (yes/no) [default=yes]? no <CR>
  LXD has been successfully configured.
  
  Would you like to create a new network bridge (yes/no) [default=yes]? <CR>
  What should the new bridge be called [default=lxdbr0]? <CR>
  What IPv4 address should be used (CIDR subnet notation, "auto" or "none") [default=auto]? <CR>
  What IPv6 address should be used (CIDR subnet notation, "auto" or "none") [default=auto]? <CR>
  LXD has been successfully configured.
  

On the new server (lxd)

Copy the file lxd-route-server.tgz to the lxd1 host.

Import the image from the archive.

  ubuntu@lxd:~$ lxc image import lxd_route_server.tgz --alias rs_img
  Image imported with fingerprint: 1e748bdfad82b2d0d7969dd3f8a9e59ed34ee7fec43d84416853a419c5441b73
  

Review the newly imported image.

  ubuntu@lxd:~$ lxc image list
  +----------+--------------+--------+----------------------------------+--------+----------+-----------------------------+
  |  ALIAS   | FINGERPRINT  | PUBLIC |           DESCRIPTION            |  ARCH  |   SIZE   |         UPLOAD DATE         |
  +----------+--------------+--------+----------------------------------+--------+----------+-----------------------------+
  | rs_img   | 1e748bdfad82 | no     | Ubuntu 17.10 server (20171115.1) | x86_64 | 257.10MB | Jan 3, 2018 at 2:00pm (UTC) |
  +----------+--------------+--------+----------------------------------+--------+----------+-----------------------------+
  

There is no image installed in LXC as yet.

  ubuntu@lxd:~$ lxc list
  +------+-------+------+------+------+-----------+
  | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
  +------+-------+------+------+------+-----------+
  

Launch the newly imported image.

  ubuntu@lxd:~$ lxc launch rs_img rs
  Creating rs
  Starting rs
  

Now that the image is installed as a container the imported image itself can be deleted.

  ubuntu@lxd:~$ lxc image delete rs_img
  
  ubuntu@lxd:~$ lxc list
  +------+---------+----------------------+-----------------------------------------------+------------+-----------+
  | NAME |  STATE  |         IPV4         |                     IPV6                      |    TYPE    | SNAPSHOTS |
  +------+---------+----------------------+-----------------------------------------------+------------+-----------+
  | rs   | RUNNING | 10.225.61.167 (eth0) | fd42:df0a:d7ab:f059:216:3eff:fef1:9283 (eth0) | PERSISTENT | 0         |
  +------+---------+----------------------+-----------------------------------------------+------------+-----------+
  

Connect to the new container.

  ubuntu@lxd:~$ lxc exec rs /bin/bash
  root@rs:~#