# Install OpenWRT in VirtualBox VM

1. Download OpenWRT x86 Image Download
2. Extract the OpenWRT image
3. Convert OpenWRT Image to VDI
   cd %programfiles%/Oracle/Virtualbox
   vboxmanage.exe convertdd "%userprofile%\downloads\openwrt-19.07.6-x86-64-combined-ext4.img" "%userprofile%\downloads\openwrt.vdi"
4. Resize the VDI File
   vboxmanage.exe modifyhd --resize 512 "%userprofile%\downloads\openwrt.vdi"
5. Launch Virtualbox
6. Create a New VM by selecting Machine > New

   Name: OpenWRT
   Machine Folder: C:\VMs
   Type: Linux
   Version: 2.6 / 3.x / 4.x (64-bit)
   Memory Size: 128 MB
   Hard disk: Do not add a virtual hard disk

7. Click Create
8. Move the openwrt.vdi file from downloads into C:\VMs\OpenWRT
9. Select the VM and Click Settings
10. Select Storage
11. Click Add Storage Attachment > Add Hard Disk > Choose existing disk
12. Click Add and browse to C:\VMs\OpenWRT\openwrt.vdi
13. Click OK
14. Select Network
15. Set Adapter 1 Attached to: Bridged
16. Click the Adapter 2 tab
17. Check the Enable Network Adapter box
18. Set Adapter 2 Attached to: Bridged
19. Click OK
20. Make sure the OpenWRT VM is selected and click Start > Normal
21. Wait for the text to stop scrolling and press Enter
22. Run the following command to change/set the root password
    passwd
23. Type a new root password twice to set it
24. Continue the configuration by running the following commands
    # set the lan ip address
    uci set network.lan.ipaddr='192.168.0.251'
    # restart network services
    service network restart
    # update openwrt packages
    opkg update
    # install the luci web ui
    opkg install luci
25. Open a web browser and navigate to http://IPofVM, http://192.168.0.251 in the example
26. At the login screen, enter the username root and the password set above > Click the Login button
27. Enjoy OpenWRT running in VirtualBox

Further reading https://openwrt.org/docs/guide-user/virtualization/virtualbox-vm