Chapter 4: Installing OpenWrt Router Virtual Machine
This chapter explains how to install a router virtual machine using VMWare on a Windows system. Many students have likely installed Ubuntu or Windows on VMWare before.
Why Install a Virtual Machine
-
• Convenient for students without router hardware to test code
-
• The router virtual machine provides a debugging environment, giving developers an additional option
-
• Compared to hardware devices, it is easy to obtain and does not require powering on hardware or serial connections
-
• Disadvantage: Cannot provide hardware-related testing feedback
Obtaining the Virtual Machine Installation Package
We cannot directly use the firmware package obtained in Chapter 1 to install the virtual machine. Why? Because our Windows system is x86 platform, while the firmware package from Chapter 1 is for the rampis platform. Steps to operate:
-
• Execute “make menuconfig” in the root directory of the source code
-
• Select “Target System” as X86
-
• Select “Target Image” as “Build VMware image files (VMDK)”
-
• Select “<Save>” to save the modified configuration to the .config file in the root directory
-
• Execute “make -j $(nproc) download world V=s” in the root directory
-
• After compilation, we can obtain the following upgrade package in the bin directory. For the upgrade, select “openwrt-x86-generic-combined-ext4.vmdk”
Executing the Virtual Machine Installation
If you are familiar with the installation of virtual machines, you can install it on your own. Here’s a reminder: during the “virtual machine disk conversion” step, you need to select “keep existing format”
Here’s a video tutorial:
Open the virtual machine
When you see the display below, congratulations, your router has been successfully installed
Setting Up Communication Between the Virtual Machine and Windows Host
-
• Check the IP address information of the Windows host
-
• Modify /etc/config/network in the virtual machine so that the virtual machine and Windows host are on the same subnet
• Execute “/etc/init.d/network restart” in the virtual machine to restart the network
• Execute ssh in the Windows host