Giter Club home page Giter Club logo

netbox-docker-wsl2's Introduction

NetBox Docker on WSL 2

This is a How-To, to use NetBox with Docker on your local machine with WSL 2.

Requirements

You need to install WSL 2 on your Windows machine with your PowerShell with wsl --install or you can follow the instructions on how to set up a WSL development environment for your use specifications.

Make sure to follow the instructions, on how to use the WSL 2 based engine with Docker.

Setting up your NetBox Docker

Follow the instructions step by step with Getting Started with NetBox Docker on your WSL terminal, as if it was a normal Linux environment.

After making sure that you can connect to your NetBox instance with your localhost, internal or WSL IP, then you could redirect an external IP (in this case, IP of your machine) with the internal IP of your WSL. (In case you´re setting the NetBox instance with public access).

Port Forwarding

Create a PowerShell script with the following commands:

netsh interface portproxy delete v4tov4 listenport=[your_port] listenaddress=0.0.0.0
wsl -u [WSL_user] hostname -I | Set-Variable -Name "IP"
$IP=$IP.replace(" ","")
netsh interface portproxy add v4tov4 listenport=[your_port] listenaddress=0.0.0.0 connectport=[your_port] connectaddress=$IP

Make sure you run the script with admin privileges:

powershell.exe -File "[path_to_script]\[name_of_script].ps1"

In case you get the following error:

File cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.

Run the following command:

Set-ExecutionPolicy unrestricted

Run the script again.

Check your portproxy status with:

netsh interface portproxy show all

You should be able to see at least the following:

PS C:\> netsh interface portproxy show all

Listen on ipv4:      Connect to ipv4:

Address Port         Address  Port
------- -----------  -------- -----------
0.0.0.0 [your_port]  [WSL_IP] [your_port]

After that, make sure first that your NetBox Docker is running. You´ll be able to connect to your NetBox instance from a browser either with: localhost:[your_port], [internal_IP]:[your_port], [WSL_IP]:[your_port] or [external_IP]:[your_port].

Public Access

In case you´re the only one who can access the NetBox instance from your machine only and no other host can, then you´ll need to create a new Firewall Inbound Rule to give access to other hosts to connect to your NetBox by running the following command:

New-NetFirewallRule -DisplayName "[choose_name]" -Direction Inbound -Action Allow -Protocol TCP -LocalPort [your_port]

or manually:

Windows Menu -> Settings -> Update & Security -> Windows Security -> Open Windows Security -> Firewall & network protection -> Advanced settings -> Inbound Rules -> New Rule -> Port -> Give only wished port -> Allow the connection -> Apply on all network locations and domains -> Give a name -> Finish

Congratulations, now others (on the same Network) will be able to connect to your NetBox instance.

netbox-docker-wsl2's People

Contributors

babisgrizzly avatar

Watchers

 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.