The official doc seems too complicated OpenWrt on VirtualBox HowTo
- Download and install VirtualBox. On Windows add to PATH envs
C:\Program Files\Oracle\VirtualBox - Get an OpenWrt image
openwrt-x86-64-combined-ext4.img.gzfrom targets/x86/64/ folder. Direct snapshot download - Uncompress the image:
gunzip openwrt.img.gz - Convert it to native VirtualBox format:
VBoxManage convertfromraw --format VDI openwrt.img openwrt.vdi
Now start VBox and create a Linux 2.6 machine and attach the drive to it. Network set to Bridge mode.
After start press Enter and you'll get to a console.
You must set a password with passwd command.
Then you need to change network settigns so that OpenWrt will take it's IP from DHCP gateway on the network.
Edit vi /etc/config/network and change proto to dhcp and remove ipaddr, netmask, ip6assign:
config interface 'lan'
option device 'br-lan'
option proto 'dhcp'
Or use uci:
uci set network.lan.proto=dhcp
uci delete network.lan.ipaddr
uci delete network.lan.netmask
uci delete network.lan.ip6assign
uci commit
Restart network service network restart.
Then see an ip address with ifconfig.
Then you can open Luci admin in browser by the IP.
- You can compile your own image (Target System → x86 and Target Images → Build VirtualBox image files). ext4 needs to be enabled first.
- Another script https://gist.github.com/zhehaowang/628b26bceb80ed11b6b2
- https://openwrt.org/docs/guide-user/virtualization/virtualbox-advanced
- https://habr.com/post/195592/
- https://bits.mdminhazulhaque.io/openwrt/openwrt-on-virtualbox-with-internet-connectivity-from-host-machine.html
Only error I could find was this command
service restart network.Should be 'service network restart'
Everything else worked without a hitch. Great tutorial!