This repository builds OpenWrt Vagrant box from the officially distributed disk images according to following instructions. Image has 3 preconfigured network interfaces:
mng
set toeth0
wan
set toeth1
lan
set toeth2
- To build all boxes simply run
make all
. Created Vagrant artifact will be stored in the.output
folder. - To build a specific OpenWrt version run
VERSION=22.03.4 make all
- To build the Virtualbox box only run:
make build-vb
- To build the Libvirt box only run:
make build-lv
Vagrant.configure("2") do |config|
config.vm.box = "vladimir-babichev/openwrt-22.03"
config.vm.network "forwarded_port", guest: 80, host: 8080
end
Vagrant.configure("2") do |config|
config.vm.box = "vladimir-babichev/openwrt-22.03"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--nic2", "nat"]
v.customize ["modifyvm", :id, "--nic3", "bridged", "--bridgeadapter3", "en0"]
end
end
Provisioned VM will have 3 network adapters:
nic1
set toNAT
and discovered aseth0
(mng
) interfacenic2
set toNAT
and discovered aseth1
(wan
) interfacenic3
set tobridge
withen0
and discovered aseth2
(lan
) interface
More information about Vagrant can be found here.
Since version 2.2.15 Vagrant supports rsync synced folders for OpenWrt. By default, the content of the current folder synced into /root
in the guest OS. To disable synchronization add the following snippet to your Vagrantfile:
config.vm.synced_folder ".", "/root", disabled: true
Vagrant does not support automatic network configuration
for OpenWrt. As a result, network setup split into two stages:
- Attachment of network adapters to a virtual machine. See examples above.
- Network interface configuration from guest OS. See this and this.
By default, preconfigured network interfaces set to DHCP mode.
Vagrant.configure("2") do |config|
config.vm.box = "vladimir-babichev/openwrt-22.03"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.provision "shell", inline: <<-SHELL
opkg update
opkg remove wpad-mini
opkg install wpad
SHELL
end
Complete example of ansible provisioner can be found here.
- Username:
root
- Password:
vagrant
rsync
sudo