Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:guide-user:virtualization:virtualbox-vm [2018/12/21 19:38] – [VM setup] jeff | docs:guide-user:virtualization:virtualbox-vm [2023/10/20 01:46] (current) – [VM setup] atownlede | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== OpenWrt |
| - | This document describes how to run the x86-64 OpenWrt images in [[https:// | + | This document describes how to run the x86-64 OpenWrt images in < |
| ===== Prerequisites ===== | ===== Prerequisites ===== | ||
| * Download and install [[https:// | * Download and install [[https:// | ||
| - | * Download and install the Virtualbox | + | * Download and install the VirtualBox |
| - | * Download the // | + | |
| + | ==== Select an OpenWrt image ==== | ||
| + | You need a [[docs: | ||
| + | There is two versions of them: | ||
| + | |||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | In the guide we'll use // | ||
| + | |||
| + | * Download | ||
| + | * Uncompress the gziped img file. On Linux use the command '' | ||
| + | |||
| + | === Custom Images === | ||
| + | You can compile your own image (//Target System -> x86-64// and //Target Images -> Build VirtualBox | ||
| + | |||
| + | ==== Convert openwrt.img to VBox drive ==== | ||
| * Open a terminal and go in the folder where you have downloaded the file (sorry, the tool has only a command line interface) | * Open a terminal and go in the folder where you have downloaded the file (sorry, the tool has only a command line interface) | ||
| - | * Convert it to native | + | * Convert it to native |
| - | if you receive an error similar to\\ | + | === Error === |
| + | If you receive an error similar to\\ | ||
| < | < | ||
| VBoxManage: error: Error code VERR_VD_INVALID_SIZE at / | VBoxManage: error: Error code VERR_VD_INVALID_SIZE at / | ||
| VBoxManage: error: Cannot create the disk image " | VBoxManage: error: Cannot create the disk image " | ||
| - | you may need to pad the image with '' | + | you may need to pad the image with '' |
| - | + | ||
| - | Or you can compile your own image (//Target System -> x86-64// and //Target Images -> Build VirtualBox image files//). '' | + | |
| * Enlarge the image to a useful size (size is in MB) | * Enlarge the image to a useful size (size is in MB) | ||
| - | $ VboxManage | + | $ VBoxManage |
| 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% | ||
| - | |||
| - | |||
| ===== VM Setup in VirtualBox ===== | ===== VM Setup in VirtualBox ===== | ||
| - | |||
| ==== VM creation ==== | ==== VM creation ==== | ||
| - | :!: tutorial | + | :!: Tutorial |
| {{docs: | {{docs: | ||
| Line 35: | Line 47: | ||
| {{docs: | {{docs: | ||
| ---- | ---- | ||
| - | {{docs: | + | {{docs: |
| ---- | ---- | ||
| - | :!: It's recommended to place the disk image in a permanent place //before// linking it with VB. If you move it // | + | :!: It's recommended to place the disk image in a permanent place //before// linking it with VBox. If you move it // |
| ==== VM setup ==== | ==== VM setup ==== | ||
| + | |||
| + | {{section> | ||
| + | |||
| This part of the configuration will deal with setting up networking manually.\\ | This part of the configuration will deal with setting up networking manually.\\ | ||
| The configuration you will set up by following this tutorial is: | The configuration you will set up by following this tutorial is: | ||
| - | * **eth0** of the VM on **mng** (management) interface, fixed address 192.168.56.2, | + | * **eth0** of the VM on **mng** (management) interface, fixed address 192.168.56.2, |
| - | * **eth1** of the VM on **wan** interface, dynamic address, set in Virtualbox | + | * **eth1** of the VM on **wan** interface, dynamic address, set in VirtualBox |
| - | * // | + | * // |
| * //For a setup with 2 bridged physical network cards WAN/LAN Setup see [[# | * //For a setup with 2 bridged physical network cards WAN/LAN Setup see [[# | ||
| Line 53: | Line 67: | ||
| == Host-only network adapter == | == Host-only network adapter == | ||
| we first need to make sure there is a Host-only network adapter and that it has the right settings\\ | we first need to make sure there is a Host-only network adapter and that it has the right settings\\ | ||
| + | Note: this is found in VBox 6.0 (at least for Windows) under Tools, and is pre-configured. | ||
| ---- | ---- | ||
| - | {{docs: | + | {{docs: |
| On macOS, this setting may be found through File > Host Network Manager... | On macOS, this setting may be found through File > Host Network Manager... | ||
| ---- | ---- | ||
| - | {{docs: | + | {{docs: |
| Now select the **vboxnet0** entry, and click on the screwdriver icon on the right to open its settings.\\ | Now select the **vboxnet0** entry, and click on the screwdriver icon on the right to open its settings.\\ | ||
| ---- | ---- | ||
| Line 64: | Line 79: | ||
| {{docs: | {{docs: | ||
| ---- | ---- | ||
| - | press OK to save and close until you are back to Virtualbox | + | Press OK to save and close until you are back to VirtualBox |
| == Network Settings == | == Network Settings == | ||
| Line 84: | Line 99: | ||
| - //Click on **Advanced** and do the same you did for **Adapter 1**'s advanced options// | - //Click on **Advanced** and do the same you did for **Adapter 1**'s advanced options// | ||
| - | === VM Settings === | + | === Virtual Machine |
| - | :!: due to limitations, | + | :!: Due to limitations, |
| - | Also, due to the fact that what you see there is a bare machine terminal and not a smart thing like a ssh program (Putty/ | + | Also, due to the fact that what you see there is a bare machine terminal and not a smart thing like a SSH program (Putty/ |
| Don't worry, most of the setup will be done after you are connected with SSH (remote terminal) that does not have any of these issues.\\ | Don't worry, most of the setup will be done after you are connected with SSH (remote terminal) that does not have any of these issues.\\ | ||
| {{docs: | {{docs: | ||
| ---- | ---- | ||
| - | - Boot into your VM | + | - Boot into your Virtual Machine |
| - Wait 4 seconds for GRUB to boot automatically | - Wait 4 seconds for GRUB to boot automatically | ||
| - | - Press Enter to activate the console when the boot messages have finished | + | - Press Enter to activate the console when the boot messages have finished |
| - | - let's see the current network configuration\\ < | + | - Display |
| network.loopback=interface | network.loopback=interface | ||
| network.loopback.ifname=' | network.loopback.ifname=' | ||
| Line 115: | Line 130: | ||
| network.wan6.proto=' | network.wan6.proto=' | ||
| Note that the default LAN address of 192.168.1.1 is present on first boot. | Note that the default LAN address of 192.168.1.1 is present on first boot. | ||
| - | - edit the network configuration to allow SSH access by writing these commands and pressing enter: | + | - Edit the network configuration to allow SSH access by writing these commands and pressing enter: |
| - **uci set network.lan.ipaddr=' | - **uci set network.lan.ipaddr=' | ||
| - **uci commit** | - **uci commit** | ||
| - **reboot** | - **reboot** | ||
| - | - now your VM should be accessible from SSH, user **root** (no password) address **192.168.56.2** | + | - Now your VM should be accessible from SSH, user **root** (no password) address **192.168.56.2** |
| - | - after you have logged in successfully, | + | - After you have logged in successfully, |
| set network.mng=interface | set network.mng=interface | ||
| set network.mng.type=' | set network.mng.type=' | ||
| Line 131: | Line 146: | ||
| set network.wan=interface | set network.wan=interface | ||
| set network.wan.ifname=' | set network.wan.ifname=' | ||
| + | set network.wan.proto=' | ||
| + | EOF</ | ||
| + | set network.mng=interface | ||
| + | set network.mng.device=' | ||
| + | set network.mng.proto=' | ||
| + | set network.mng.ipaddr=' | ||
| + | set network.mng.netmask=' | ||
| + | set firewall.@zone[0].network=' | ||
| + | set firewall.@zone[0].name=' | ||
| + | delete network.lan | ||
| + | delete network.wan6 | ||
| + | set network.wan=interface | ||
| + | set network.wan.device=' | ||
| set network.wan.proto=' | set network.wan.proto=' | ||
| EOF</ | EOF</ | ||
| - | - now write **uci changes** to check if the setting configuration was loaded correctly. If you see the following (the **network.mng** entries MUST be the same as the ones shown here, the **network.wan** might be slightly different), everything went well\\ < | + | - now write **uci changes** to check if the setting configuration was loaded correctly. If you see the following |
| network.mng=' | network.mng=' | ||
| network.mng.type=' | network.mng.type=' | ||
| Line 142: | Line 170: | ||
| -network.lan | -network.lan | ||
| -network.wan6 | -network.wan6 | ||
| - | network.wan=' | + | network.wan=' |
| + | firewall.cfg02dc81.network=' | ||
| + | firewall.cfg02dc81.name=' | ||
| + | network.mng=' | ||
| + | network.mng.device=' | ||
| + | network.mng.proto=' | ||
| + | network.mng.ipaddr=' | ||
| + | network.mng.netmask=' | ||
| + | -network.lan | ||
| + | -network.wan6 | ||
| + | </ | ||
| - if all is well, save config with **uci commit && reboot**, if all is NOT well, write **reboot** to erase the temporary changes and find a way to set the above configuration manually. | - if all is well, save config with **uci commit && reboot**, if all is NOT well, write **reboot** to erase the temporary changes and find a way to set the above configuration manually. | ||
| - close and open again the SSH terminal when the VM has restarted, with same connection parameters (user **root** and **192.168.56.2**) | - close and open again the SSH terminal when the VM has restarted, with same connection parameters (user **root** and **192.168.56.2**) | ||
| - now you should have both internet access (try a **opkg update**) AND a management interface with a static address you can connect your SSH client program to even if your PC is disconnected from a local network. | - now you should have both internet access (try a **opkg update**) AND a management interface with a static address you can connect your SSH client program to even if your PC is disconnected from a local network. | ||
| - | - the optional **Bridged Adapter** on **Adapter 3** isn't crucial for basic functionality and is also specific for your own local network parameters. In my own network (and in most home networks) it will work fine if you write < | + | - the optional **Bridged Adapter** on **Adapter 3** isn't crucial for basic functionality and is also specific for your own local network parameters. In my own network (and in most home networks) it will work fine for 22.03 and earlier |
| set network.lan=interface | set network.lan=interface | ||
| set network.lan.ifname=' | set network.lan.ifname=' | ||
| set network.lan.proto=' | set network.lan.proto=' | ||
| EOF | EOF | ||
| - | uci commit</ | + | uci commit</ |
| + | set network.lan=interface | ||
| + | set network.lan.device=' | ||
| + | set network.lan.proto=' | ||
| + | EOF | ||
| + | uci commit | ||
| + | service network restart | ||
| + | </ | ||
| - you can now install packages to this images as normal, you will probably want to install luci, write **opkg update && opkg install luci**, then you can connect to the VM's luci by typing 192.168.56.2 in your browser address bar or [[http:// | - you can now install packages to this images as normal, you will probably want to install luci, write **opkg update && opkg install luci**, then you can connect to the VM's luci by typing 192.168.56.2 in your browser address bar or [[http:// | ||
| - | |||
| ===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
| * If you rebuild the disk image, and VirtualBox complains about invalid UUIDs for the disk | * If you rebuild the disk image, and VirtualBox complains about invalid UUIDs for the disk | ||
| - | * You need to remove the disk from **both** the VM **and also** from the //Virtual Media Manager// | + | * You need to remove the disk from **both** the //VM// **and** from the //Virtual Media Manager// |
| * Then add the disk image to the VM again | * Then add the disk image to the VM again | ||
| Line 169: | Line 213: | ||
| * **Allow All** if you want to connect your bridged virtual network to your physical network | * **Allow All** if you want to connect your bridged virtual network to your physical network | ||
| - | + | ===== Run with VirtualBox | |
| - | ===== Run with Virtual Box automatically on Start of Windows OS ===== | + | |
| * Ordered List ItemImport the following entry to your registry or add it manually: | * Ordered List ItemImport the following entry to your registry or add it manually: | ||
| - [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] | - [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] | ||
| - " | - " | ||
| - | * Alternative | + | * Alternatively |
| - " | - " | ||
| - Create a task in the Scheduler triggered by logon of any user as action the shortcut | - Create a task in the Scheduler triggered by logon of any user as action the shortcut | ||
| Line 187: | Line 229: | ||
| | | ||
| * Or use following: | * Or use following: | ||
| - | | + | |
| + | ===== See also ===== | ||
| + | * [[docs: | ||
| + | * [[docs: | ||