Chapter 2
Linux, Ubuntu and VirtualBox

 2.1 What is Ubuntu Linux?
  2.1.1 Why Not Microsoft Windows?
 2.2 Installing Ubuntu Linux
  2.2.1 Ubuntu Variants
  2.2.2 Installation Approaches
 2.3 Virtualisation and VirtualBox

File: nsl/linux.tex, r1670

This chapter gives a brief overview of Linux, including some reasons for using it as the operating system of choice throughout this book. You can safely skip this chapter if you already know about Linux, or not concerned with the motivation for its use.

2.1 What is Ubuntu Linux?

Linux is an operating system based on Unix, one of the earlier multi-user operating systems developed in the 1970’s and 1980’s. Unix was originally a single operating system, but over time several commercial variants were developed. These Unix operating systems were particularly popular in the 1980’s and 1990’s, especially within academic and technology organisations. Some of the Internet applications and protocols were first developed on Unix, and hence Unix-based computer systems have a strong link with computer networking.

Today Unix operating systems are still used, mainly in servers and high-end workstations. In the 1990’s Linux appeared, a free operating system with Unix-like functionality (or at least a kernel for an operating system). In the 2000’s, Linux also became popular in typical Unix domains of servers and workstations, and also has been growing in the desktop field (however, in quantity of installs, Linux still does not compare with Microsoft Windows). As with the original Unix, there are many variants, or distributions of Linux, differing in the applications and graphical environments they provide (e.g. Red Hat, Debian, Fedora, Ubuntu, Xandros). We will be using the Ubuntu Linux distribution.

Ubuntu Linux is a free, open-source Unix-based operating system, that has been developed mainly for desktop (and laptop) installations. The aim is to make a user-friendly Linux distribution. It is now one of the more popular Linux distributions.

2.1.1 Why Not Microsoft Windows?

Why use (Ubuntu) Linux, and not Microsoft Windows, especially since Windows is by far the most popular desktop operating system, and hence very popular with server systems? There are several reasons we will use be using Linux instead of Windows:

  1. Linux is well-suited for learning of networking concepts:

    1. Linux has simple, yet powerful, operations for many networking tasks such as: changing an IP address, creating routing tables, testing network connectivity, inspecting traffic received/sent, and so on.
    2. Implementing and compiling simple client/server applications is straightforward on Linux.
    3. A Linux PC can easily be configured as a router, and a network of Linux computers setup quickly and easily..
  2. A command-line only (no graphical user interface) install of Linux requires significantly less resources than Windows (e.g. 100’s of MB for RAM, 2 or 3 GB of disk space, minimal CPU utilisation). This is important when setting up a virtual network of 5 or 6 Linux virtual machines all running on a single computer.
  3. Experience in Unix-based operating systems is important: Although Windows is the most commonly used operating system for desktops, Unix-based operating systems (including Linux) are common for network servers, network devices and embedded systems. For example, many routers, switches and specialised computer devices use Linux.
  4. Ubuntu Linux is free, as are all the applications we use (and none of them are pirated!). Again, when having a virtual network of multiple virtual machines, the Windows license costs can be significant.

2.2 Installing Ubuntu Linux

2.2.1 Ubuntu Variants

In very simple terms, Ubuntu Linux includes:

Linux distributions typically use GNU/Linux, but differ in the set of end-user applications they include (and the version of the Linux kernel and GNU utilities). Ubuntu is one of many Linux distributions. While we will use Ubuntu throughout this book, almost all of the tasks we demonstrate will work equally as well on other Linux distributions. In fact a lot of the commands we cover can be used in Unix operating systems, Berkeley Software Distribution (BSD) variants, and Apple macOS. However we make no attempt to cover other distributions, or to point out the differences.

Ubuntu actually has it’s own variants, and multiple different versions. The two main variants are desktop and server. Both are based on the Linux kernel with GNU utilities, but differ in the set of end-user applications installed. An important difference is that the desktop variant includes a Graphical User Interface (GUI), whereas the server variant does not (it is command line only). In this book we use the server variant, as many of the network and security tasks are intended for servers or devices without monitors. Therefore we make no attempt to demonstrate the Ubuntu GUI or common desktop applications. However, if you already have Ubuntu desktop (or want to try it), you can do almost everything that we do on the server variant.

Ubuntu is updated on a regular basis, with the main schedule being:

In between the releases, security and bug fix updates are provided. So if you install version 18.10, that version will receive updates until April 2019. Beyond that you will either have to upgrade to 19.04, change to 18.04 LTS, or go without security fixes. However if you install 18.04 LTS, that version will receive updates until April 2023.

The instructions in this book have been developed over time, primarily on Ubuntu Server LTS versions. You are highly recommended to use an LTS version, and stick with that for at least 2 years. Don’t be afraid that newer versions are released in the meantime—the non-LTS interim releases are only really useful for testing the latest/greatest features, and due to the short support periods are not suitable for stable systems such as servers.

In summary, if you are getting started on Ubuntu now, use the most recent Ubuntu Server LTS version available.

2.2.2 Installation Approaches

We assume you have a Windows computer and want/need to run Ubuntu Server (without deleting Windows). You have several approaches available:

Dual boot
Useful if you want both operating systems (Windows and Linux) to have full access to the hardware, and you won’t be switching between them very often. The most difficult to setup, mainly due to partitioning, although most Linux installs successfully recognise and resize Windows partitions for you.
Virtual Machine
Run Ubuntu in virtualisation software, such as VirtualBox, VMWare or Parallels. This is a good option, as it has little impact on Windows and allows either Ubuntu Server or Ubuntu Desktop if needed.
Cygwin
Essentially a Linux-like terminal that runs as an application on Windows. It is not a real Linux operating system, but supports most common command line tools. Not suitable for many of the tasks in this book, but may be an option on older versions of Windows if you want quick access to a Linux command line.
Windows Subsystem for Linux
Software provided by Microsoft that allows a real Linux operating system to run directly in Windows. E.g. you install Ubuntu server and then can install any Ubuntu (command-line) application inside it. This is a good option if you want a Linux command line. However it only works on Windows 10, and will not support some of the networking tasks covered in this book.

If you want to complete all tasks in this book, the best approach is virtualisation, as it is easy to create a network of multiple Linux computers. However if you only need to perform tasks on a single Linux computer, WSL or dual boot are also acceptable (although virtualisation is preferred). The next section introduces the concepts of virtualisation and using Ubuntu Server in VirtualBox.

2.3 Virtualisation and VirtualBox

Virtualisation involves using software to emulate computer and network hardware so that other software can execute as if it is using that emulated hardware (not the real, physical hardware). A common example is with operating systems, where the host operating system is executing on the real computer, while virtualisation software executing on the host OS emulates computer hardware (CPU, disks, network interfaces, etc.). The virtualisation software makes the emulated or virtualised hardware available to another guest operating system. The result: running on OS inside another.

There are different types of virtualisation software, but common applications available to consumers include VMWare, Hyper-V, Parallels and VirtualBox. In this book we use VirtualBox.

Consider a common scenario. You have your own laptop with Microsoft Windows installed as the host operating system. You can only run application software compiled for Windows. You install VirtualBox (the version compiled to run on Windows), which creates a virtual computer within Windows. Now you can install one or more guest operating systems that will use the virtual computer (to be precise, you will have one virtual computer for each guest installed). You may install Ubuntu Linux, so you can now execute Linux applications within VirtualBox, which in turn is running on Windows on your laptop.

Virtualising computer hardware offers many benefits, including:

The main drawback of using virtualisation is performance: software emulation of CPUs, disks and network hardware is much slower than real hardware implementations, and when running multiple guests, that real hardware is shared amongst all (including the host). However with increasing hardware capabilities, virtualisation is a feasible solution for many tasks. You are recommended to use virtualisation for the tasks in this book so you can:

It is this last capability, virtual networking, that is especially beneficial for the tasks we want to perform. To allow you to focus on the tasks, rather than setting up operating systems, installing applications and configuring networks, specialised software, called virtnet, will be used. Chapter 3 describes how to setup and use virtnet.