Skip to content

Instantly share code, notes, and snippets.

@zhehaowang
Last active August 11, 2022 18:59
Show Gist options
  • Save zhehaowang/628b26bceb80ed11b6b2 to your computer and use it in GitHub Desktop.
Save zhehaowang/628b26bceb80ed11b6b2 to your computer and use it in GitHub Desktop.
Creating and Configuring OpenWRT virtualbox
Creating and Configuring OpenWRT virtualbox
http://hoverbear.org/2014/11/23/openwrt-in-virtualbox/
Given the setup, accessing local openwrt via ssh
ssh root@localhost -p 2222
scp -P 2222 somefile root@localhost:
NAME="openwrt"
URL="https://downloads.openwrt.org/chaos_calmer/15.05/x86/generic/openwrt-15.05-x86-generic-combined-ext4.img.gz"
VDI="./openwrt.15.05.vdi"
VMNAME="openwrt"
SIZE='1024000000'
curl $URL \
| gunzip \
| VBoxManage convertfromraw --format VDI stdin $VDI $SIZE
VBoxManage createvm --name $VMNAME --register && \
VBoxManage modifyvm $VMNAME \
--description "A VM to build an OpenWRT Vagrant box." \
--ostype "Linux26" \
--memory "512" \
--cpus "1" \
--nic1 "intnet" \
--intnet1 "port1" \
--nic2 "intnet" \
--intnet2 "port2" \
--nic3 "intnet" \
--intnet3 "port3" \
--nic4 "nat" \
--natpf4 "ssh,tcp,,2222,,22" \
--natpf4 "luci,tcp,,8080,,80" \
--uart1 "0x3F8" "4" \
--uartmode1 "disconnected" && \
VBoxManage storagectl $VMNAME \
--name "SATA Controller" \
--add "sata" \
--portcount "4" \
--hostiocache "on" \
--bootable "on" && \
VBoxManage storageattach $VMNAME \
--storagectl "SATA Controller" \
--port "1" \
--type "hdd" \
--nonrotational "on" \
--medium $VDI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment