GithubHelp home page GithubHelp logo

leewis101 / vagrant-openwrt-box Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vladimir-babichev/vagrant-openwrt-box

0.0 0.0 0.0 51 KB

Vagrant OpenWrt Box

Home Page: https://app.vagrantup.com/vladimir-babichev/

License: MIT License

Shell 24.03% Ruby 2.28% Makefile 34.07% HCL 39.62%

vagrant-openwrt-box's Introduction

vagrant-openwrt-box

This repository builds OpenWrt Vagrant box from the officially distributed disk images according to following instructions. Image has 3 preconfigured network interfaces:

  • mng set to eth0
  • wan set to eth1
  • lan set to eth2

Building

  • 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

Using

Simple use case

Vagrant.configure("2") do |config|
  config.vm.box = "vladimir-babichev/openwrt-22.03"
  config.vm.network "forwarded_port", guest: 80, host: 8080
end

Advanced use case

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 to NAT and discovered as eth0 (mng) interface
  • nic2 set to NAT and discovered as eth1 (wan) interface
  • nic3 set to bridge with en0 and discovered as eth2 (lan) interface

More information about Vagrant can be found here.

Synced folders

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

Network configuration

Vagrant does not support automatic network configuration for OpenWrt. As a result, network setup split into two stages:

  1. Attachment of network adapters to a virtual machine. See examples above.
  2. Network interface configuration from guest OS. See this and this.

By default, preconfigured network interfaces set to DHCP mode.

Provisioning

Inline Shell Scripts

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

Ansible Provisioner

Complete example of ansible provisioner can be found here.

Notes

Credentials

  • Username: root
  • Password: vagrant

Extra packages

  • rsync
  • sudo

vagrant-openwrt-box's People

Contributors

bjwschaap avatar renovate[bot] avatar vladimir-babichev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.