Setting up a Network Lab Router using Ubuntu Server on VirtualBox 7
In this article, we will guide you through the process of creating a router using Ubuntu Server on VirtualBox 7. With the deprecation of the Host-Only Adapter, we will explore the latest solution to set up a network lab router.
Prerequisites
- A host computer running a compatible operating system (Windows, macOS, or Linux)
- Oracle VirtualBox 7 installed on the host computer
- Ubuntu Server 20.04 LTS ISO image
Setting up Ubuntu Server on VirtualBox
First, we need to create a virtual machine for Ubuntu Server on VirtualBox. Here are the steps:
- Open VirtualBox and click on the "New" button.
- Enter a name for the virtual machine, such as "Ubuntu Server," and select "Linux" as the type and "Ubuntu (64-bit)" as the version.
- Allocate memory (RAM) to the virtual machine. A minimum of 2048 MB is recommended.
- Create a new virtual hard disk by clicking on the "Create" button. Choose "VDI (VirtualBox Disk Image)" as the file format and "Dynamically allocated" as the storage on physical hard disk.
- Name the virtual hard disk and specify the location and size (at least 20 GB).
- Click on the "Create" button to finish creating the virtual machine.
Next, we need to configure the virtual machine settings:
- Select the newly created virtual machine and click on the "Settings" button.
- In the "System" settings, ensure that the "Boot Order" is set to "Hard Disk" and that "Enable EFI (Special OSes only)" is checked.
- In the "Storage" settings, add the Ubuntu Server ISO image as the optical drive.
- In the "Network" settings, configure the adapter as follows:
- Adapter 1: Enable Network Adapter, attach to "NAT," and ensure that "Cable Connected" is checked.
- Adapter 2: Enable Network Adapter, attach to "Internal Network," and name the network "vboxnet0."
- Click "OK" to save the settings.
Now, start the virtual machine and install Ubuntu Server.
Configuring the Network
After installing Ubuntu Server, we need to configure the network interfaces:
- Log in to the Ubuntu Server using SSH or the console.
- Edit the network interfaces file by running:
- Modify the file to look like this:
- Save and exit the file. Then, apply the changes by running:
- Verify the network configuration by running:
sudo nano /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see the Netplan docs at
network:
version: 2
ethernets:
enp0s3:
dhcp4: no
addresses: [192.168.56.101/24]
routes:
- to: 0.0.0.0/0
via: 192.168.56.1
on-link: true
enp0s8:
dhcp4: no
addresses: [10.0.0.1/24]
sudo netplan apply
ip addr show
Installing and Configuring Routing Software
Now, we need to install and configure routing software, such as Quagga or Bird
Configure Quagga by editing the zebra and bgpd configuration files:
-
sudo nano /etc/quagga/zebra.conf```makefile ! hostname ubuntu-server password zebra enable password zebra ! interface enp0s3 ip address 192.168.56.101/24 no shutdown ! interface enp0s8 ip address 10.0.0.1/24 no shutdown ! line vty ! ``` -
sudo nano /etc/quagga/bgpd.conf```sql ! hostname ubuntu-server password bgpd enable password bgpd ! router bgp 65001 bgp router-id 192.168.56.101 neighbor 192.168.56.2 remote-as 65002 network 10.0.0.0/24 ! line vty ! ```
Start and enable Quagga by running:
sudo systemctl start quagga && sudo systemctl enable quaggaIn this article, we have covered the process of setting up a network lab router using Ubuntu Server on VirtualBox 7. We have explored the latest solution to the deprecation of the Host-Only Adapter and provided detailed instructions for configuring the network interfaces and routing software.
References
- Ubuntu Server Installation Guide:
- VirtualBox Networking Guide:
- Quagga Configuration Guide:
- Bird Configuration Guide: