Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-user:virtualization:virtualbox-vm [2021/01/25 05:42] – [OpenWrt on VirtualBox HowTo] optimize formatting vgaeteradocs:guide-user:virtualization:virtualbox-vm [2023/10/20 01:46] (current) – [VM setup] atownlede
Line 13: Line 13:
   * ''combined-ext4.img.gz'' This disk image uses a single read-write ext4 partition with no read-only squashfs root filesystem, which allows to enlarge the partition. Features like Failsafe Mode or Factory Reset won't be available as they need a read-only squashfs partition to function.   * ''combined-ext4.img.gz'' This disk image uses a single read-write ext4 partition with no read-only squashfs root filesystem, which allows to enlarge the partition. Features like Failsafe Mode or Factory Reset won't be available as they need a read-only squashfs partition to function.
  
-In the guide we'll use //openwrt-x86-64-combined-ext4.img.gz// because it has less limits.+In the guide we'll use //openwrt-x86-64-combined-ext4.img.gz// because it has fewer limitations.
  
-  * Download a stable release of the //openwrt-x86-64-combined-ext4.img.gz// image from [[https://downloads.openwrt.org/|targets/x86/64/ folder]] e.g. [[https://downloads.openwrt.org/releases/19.07.2/targets/x86/64/openwrt-19.07.2-x86-64-combined-ext4.img.gz|19.07.2]]. Or you can try the fresher but unstable [[https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-x86-64-combined-ext4.img.gz| snapshot]] image +  * Download a stable release of the //openwrt-x86-64-combined-ext4.img.gz// image from [[https://archive.openwrt.org/releases/|targets/x86/64/ folder]] e.g. [[https://archive.openwrt.org/releases/22.03.5/targets/x86/64/openwrt-22.03.5-x86-64-generic-ext4-combined.img.gz|22.03.5]]. Or you can try the fresher but unstable [[https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-x86-64-generic-ext4-combined.img.gz|snapshot]] image 
-  * Uncompress the gziped img file. On Linux use the command ''gzip -d openwrt-*x86-64-combined*.img.gz''. As a result you should get the raw ''openwrt-x86-64-combined-ext4.img'' image  file.+  * Uncompress the gziped img file. On Linux use the command ''gzip -d openwrt-*.img.gz''. As a result you should get the raw ''openwrt-x86-64-combined-ext4.img'' image  file.
  
 === Custom Images === === Custom Images ===
Line 23: Line 23:
 ==== Convert openwrt.img to VBox drive ==== ==== 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 VBox format by writing this in command line (the same for Windows, macOS and Linux. Sadly this tool does not have graphical user interface): ''VBoxManage convertfromraw %%--%%format VDI openwrt-*x86-64-combined*.img openwrt.vdi''. This will create the ''openwrt.vdi'' file which a virtual drive for VBox virtual machine.+  * Convert it to native VBox format by writing this in command line (the same for Windows, macOS and Linux. Sadly this tool does not have graphical user interface): ''VBoxManage convertfromraw %%--%%format VDI openwrt-*.img openwrt.vdi''. This will create the ''openwrt.vdi'' file which a virtual drive for VBox virtual machine.
  
 === Error === === Error ===
Line 52: Line 52:
  
 ==== VM setup ==== ==== VM setup ====
 +
 +{{section>meta:infobox:howto_links#config-network-device&noheader&nofooter&noeditbutton}}
 +
 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:
Line 132: Line 135:
     - **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, we can actually do the true configuration, please copy-paste the following block of code and press enter:\\ <code>uci batch <<EOF +  - After you have logged in successfully, we can actually do the true configuration. For 22.03 and earlier, copy-paste the following block of code and press enter:\\ <code>uci batch <<EOF 
 set network.mng=interface  set network.mng=interface 
 set network.mng.type='bridge'  set network.mng.type='bridge' 
Line 143: Line 146:
 set network.wan=interface set network.wan=interface
 set network.wan.ifname='eth1' set network.wan.ifname='eth1'
 +set network.wan.proto='dhcp'
 +EOF</code>  For 23.05 and later, copy-paste the following:\\ <code>uci batch <<EOF 
 +set network.mng=interface 
 +set network.mng.device='br-lan'  
 +set network.mng.proto='static'
 +set network.mng.ipaddr='192.168.56.2'  
 +set network.mng.netmask='255.255.255.0'
 +set firewall.@zone[0].network='mng'
 +set firewall.@zone[0].name='mng'
 +delete network.lan
 +delete network.wan6
 +set network.wan=interface
 +set network.wan.device='eth1'
 set network.wan.proto='dhcp' set network.wan.proto='dhcp'
 EOF</code> EOF</code>
-  - 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\\ <code>root@openwrt:~# uci changes+  - now write **uci changes** to check if the setting configuration was loaded correctly. If you see the following on 22.03 and earlier (the **network.mng** entries MUST be the same as the ones shown here, the **network.wan** might be slightly different), everything went well\\ <code>root@openwrt:~# uci changes
 network.mng='interface' network.mng='interface'
 network.mng.type='bridge' network.mng.type='bridge'
Line 154: Line 170:
 -network.lan -network.lan
 -network.wan6 -network.wan6
-network.wan='interface'</code>+network.wan='interface'</code> For 23.03 and later, you should see\\ <code>root@OpenWrt:~# uci changes 
 +firewall.cfg02dc81.network='mng' 
 +firewall.cfg02dc81.name='mng' 
 +network.mng='interface' 
 +network.mng.device='br-lan' 
 +network.mng.proto='static' 
 +network.mng.ipaddr='192.168.56.2' 
 +network.mng.netmask='255.255.255.0' 
 +-network.lan 
 +-network.wan6 
 +</code>
   - 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 <code>uci batch <<EOF +  - 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 if you write <code>uci batch <<EOF 
 set network.lan=interface set network.lan=interface
 set network.lan.ifname='eth2' set network.lan.ifname='eth2'
 set network.lan.proto='dhcp' set network.lan.proto='dhcp'
 EOF EOF
-uci commit</code>\\ If you have more complex requirements you will have to set that up on your own by reading the documentation, or through luci.+uci commit</code>and for 23.05 and later <code>uci batch <<EOF  
 +set network.lan=interface 
 +set network.lan.device='eth2' 
 +set network.lan.proto='dhcp' 
 +EOF 
 +uci commit 
 +service network restart 
 +</code>\\ If you have more complex requirements you will have to set that up on your own by reading the documentation, or through luci.
   - 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://192.168.56.2|click on this link]] to get there.   - 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://192.168.56.2|click on this link]] to get there.
  
  • Last modified: 2021/01/25 05:42
  • by vgaetera