Installing OpenWRT in VirtualBox

First, let’s show you how to install OpenWRT in VirtualBox. OpenWRT is firmware that can be used on routers. Therefore, OpenWRT can replace the original firmware. We can check compatibility using the database.

Furthermore, OpenWRT is a Linux. So, we can make various configurations and modifications to the router’s operating system. Next, we’ll show you how to install and create a virtual environment in VirtualBox. There are several applicability from doing testing within the network to using OpenWRT as a shield or a layer of protection when you are surfing a public network. However, this additional protection is more interesting when there is no knowledge about network security. But this theme is for another video.

First step: Download OpenWRT:

First, we will download OpenWRT from downloads.openwrt.org. Then we select the latest version.

Choose the latest version do OpenWRT.
Choose the latest version.

Now let’s select the = “x86/” which is compatible with the VirtualBox machines . Later, we will choose the = “64/”.

So here you can opt for other images. However it is advisable to use image = “ext4”. Image = “ext4” allows further expansion of storage memory. In this way, using ext4 we will also be able to write and read. So, the first step is to simply click and download.

Second step, creating the OpenWRT machine:

So let’s create the virtual machine. In this virtual machine we will use the downloaded file = “.img.gz”. Then we can unzip this file.

To unzip, use the command below:

gzip -d openwrt-*x86-64-combined*.img.gz

After that, let’s transform the unzipped “.img” file to the “.vdi” extension. For this, we will use the command below:

VBoxManage convertfromraw --format VDI openwrt-*x86-64-combined*.img openwrt.vdi
VBoxManage convertfromraw
Command result

As a result, we will have a file called openwrt.vdi. And now we can open Virtualbox and continue the configuration steps.

In that sense, let’s add the name of the virtual machine in our case: openwrt_limpa. So, we select the operating system type. For OpenWRT we chose Linux. Afterwards, we select the version as = “2.6/3x/4x(64bit)”.

So now let’s select the amount of memory. For example, in a basic installation, = 128MB is enough. However, if you choose to use additional packages, we can increase the amount of memory.

First, we will choose an existing virtual disk. That is, in our case it is what we downloaded from the openWRT website.

Primarily, let’s choose the option to add the HD.

Afterwards, choose the unzipped file = “.vdi”

Now, just click on = “Choose”. Soon after, the machine will be displayed in VirtualBox.

Third step, creating OpenWRT networks in VirtualBox:

Next, let’s create a network of the unique type with host. This network will allow the real machine to access the LAN of the OpenWRT virtual machine.

First, let’s create a network of type = “Host-Only”.

Then the network must be in the range = “192.168.1.0/24”. Remembering that other network masks can be used. So, it is necessary to obey this limitation because the LAN IP in OpenWRT will be = “192.168.1.1”.

Note that IP = “192.168.1.1” was not used. The reason for this is that the IP = “192.168.1.1” will be used by the OpenWRT LAN interface.

Fourth step, selecting OpenWRT networks within VirtualBox:

Soon after, we’ll configure the interfaces in VirtualBox.

In “Adapter1” choose Host_only Adapter mode. As a result, let’s insert into Adapter1 the name of the network you created earlier. Our chosen network was vboxnet3.

Now let’s enable the second Adapter2 interface. In this interface we will use NAT mode. This will be the OpenWRT WAN interface.

Now let’s start the virtual machine.

The OpenWRT virtual machine has started up. Then press ENTER.

Final screen showing successful initialization.

Fifth step, logging into OpenWRT:

Next, let’s access OpenWRT. So, let’s open the browser and enter the LAN IP = “192.168.1.1”. Then we type the Login = “root” and no password.

Sixth step, testing OpenWRT:

Finally, let’s test the external connection. So, let’s go to the Network tab and then select Diagnostics.

Finally, let’s use the Ping tool to test connectivity to the site = openwrt.org.

Therefore, we verified that Ping was successful. That way, we complete our installation.

Professor Dalbert

We also have video installing OpenWRT on VirtualBox.

Video teaching how to install OpenWRT on Virtualbox.

References to OpenWRT in VritualBox:

https://downloads.openwrt.org/​
https://downloads.openwrt.org/releases/19.07.7/targets/x86/64/​
https://openwrt.org/docs/guide-user/virtualization/virtualbox-vm