# Project Setup
## Virtualbox setup
If you do not have Virtualbox already installed on your machine, grab the executable for your platform by visiting the link below:
[Virtualbox Installer](https://www.virtualbox.org/wiki/Downloads)
Instructions for how to install Virtualbox on different platforms can be found here:
[Virtualbox Installation Details](https://www.virtualbox.org/manual/ch02.html)
Finally, make sure you install the __Virtualbox Extension Pack__ which you can find on the same page where you obtained the Virtualbox Installer.
## Download appliances
You will need the following virtual appliances for this project. Details on how to use them are given in the next section.
- [centos_8_base.ova](https://bcit365-my.sharepoint.com/:u:/g/personal/yshema_bcit_ca/EfnIXdgn9t9Oh8ZfuIW3spsBT30fcYNOrkKFuVCZWG9NLw?e=mmRtFm)
- [instr_rtr](https://bcit365-my.sharepoint.com/:u:/g/personal/yshema_bcit_ca/EVZB4WTaW_5ItvRSXPzchhABX9I-2WAXX0yOfzHHT76KNQ?e=P2K3I0)
The instructor router (__`instr_rtr`__) provides some custom services which are needed for the project but cannot be configured directly on Virtualbox in-built NAT router
Centos 8 is Red Hat-compatible Linux distribution with the same networking capabilities provided by Red Hat Enterprise servers. The __`centos_8_base.ova`__ will be used as the base image for all other virtual devices that we will create for this project.
## Create your first network
### Your first network
In this activity, we are going to create two virtual machines, __r1__ and __r2__, and connect them to a network which they will share with the host, i.e they will be directly accessible from the host.
Later, we will configure these two VM's to perform a variety of functions of which routing will be the most important.
:::info
All the VM's in this project use the same login credentials:
Username: __admin__
Password: __P@ssw0rd__
:::
1. Launch Virtualbox
2. Create a host-only network (__Virtualbox Host-Only Ethernet Adapter #2__ on Windows or __vboxnet2__ if you are on Mac) with the following configuration:
- IP Address: 10.20.30.253
- Subnet Mask: 255.255.255.0
3. Import into Virtualbox the two appliances you downloaded earlier:
- __instr_rtr__:
- Name it __instr_rtr__
- Make sure its network adapters are configured as follows (this should already be the case except if you are on a Mac):
- __Adapter 1__: Attached to NAT, adapter type (Paravirtualized), promiscuous mode (Allow all)
- __Adapter 2__: Attached to __Virtualbox Host-Only Ethernet Adapter #2__ (__vboxnet2__ if you are on a Mac), adapter type (Paravirtualized), promiscuous mode (Allow all)
- __centos_8_base.ova__: No need to do anything. We will use it only to clone other VM's (see next step)
:::warning
:warning:
Never run this image directly. If you do it can potentially interfere with any running VM that was cloned based off it.
:::
4. Use the __centos_8_base.ova__ image to clone two virtual machines and configure them as follows:
- VM 1:
- Name: __r1__
- <ins>Adapter 1</ins>: Attached to __Virtualbox Host-Only Ethernet Adapter #2__, adapter type (Paravirtualized), promiscuous mode (Allow all), MAC address: 020000000001
- VM 2:
- Name: __r2__
- <ins>Adapter 1</ins>: Attached to __Virtualbox Host-Only Ethernet Adapter #2__, adapter type (Paravirtualized), promiscuous mode (Allow all), MAC address: 020000000002
Start the VM's, making sure to start __instr_rtr__ first. Once all VM's are running, log into each and change the hostname to match the VM's name:
```
sudo hostnamectl set-hostname [vm_name]
```
You should now be able to send ping probes between the VM's or between the VM's and the outside networks.
## SSH setup
SSH (Secure Shell) is a software utility that allows you to securely log into a running system remotely. By default, SSH will prompt you for the remote host's hostname (or IP address), username and password, but it is possible to enable password-less login using public key/private key pair.
The centos_8_base.ova is already configured with a public key, so all we need is a private key which you can download from here:
[acit_admin_id_rsa](https://bcit365-my.sharepoint.com/:u:/g/personal/yshema_bcit_ca/EV4oSICRu9FPrCKMKrdHoa4BAG_z8kFvz1SoYZzBuST8Qw?e=TFv7WA)
Next, complete the following steps:
1. Locate the __`.ssh`__ folder under your host's home directory and copy the key you just downloaded into this folder
1. Create a text file called __`config`__ inside this __`.ssh`__ folder and add content similar to the following:
```
host instr
Hostname 10.20.30.254
User admin
IdentityFile ~/.ssh/acit_admin_id_rsa
host r1
Hostname 10.20.30.100
User admin
IdentityFile ~/.ssh/acit_admin_id_rsa
host r2
Hostname 10.20.30.200
User admin
IdentityFile ~/.ssh/acit_admin_id_rsa
```
3. From your host's command-line interface (e.g. Powershell), try and access one of your VM's via SSH:
e.g. __`ssh r1`__