Below is a step-by-step guide to configure Netbird on Windows using NSSM (Non-Sucking Service Manager) and have two separate configurations and services.
C:\Windows\System32
.netbird service stop
netbird service uninstall
It's also posible to keep the original service from Netbird intact. If so you have to stop the service but do not run the second uninstall command. At the end you can start the service and the gui will keep working for this service.
Generate Two Accounts Configurations:
Create two configuration files home.json
and work.json
in C:\ProgramData\Netbird
:
netbird login --config "C:\ProgramData\Netbird\home.json" --log-file console --management-url https://<your selfhosted link> --setup-key ACCOUNT-A-AAA...
if connected:
netbird down
netbird login --config "C:\ProgramData\Netbird\work.json" --log-file console --management-url https://<your selfhosted link> --setup-key ACCOUNT-B-BBB...
if connected:
netbird down
Edit Configuration Files:
Open home.json
and work.json
in your favorite text editor and update the necessary sections:
home.json:
{
"WgIface": "home",
"WgPort": 50001,
"IFaceBlackList": [
"home"
],
...
}
work.json:
{
"WgIface": "work",
"WgPort": 50002,
"IFaceBlackList": [
"work"
],
...
}
Install NSSM and Create Services:
Open Command Prompt as Administrator and navigate to the directory where you extracted NSSM:
cd path\to\nssm\directory
Install Netbird service for the home.json
configuration:
nssm install NetbirdHome "C:\Program Files\Netbird\netbird.exe" service run --config "C:\ProgramData\Netbird\home.json" --log-level info --log-file "C:\ProgramData\Netbird\logs\home.log" --daemon-addr tcp://127.0.0.1:8081
nssm set NetbirdHome Start SERVICE_AUTO_START
Install Netbird service for the work.json
configuration:
nssm install NetbirdWork "C:\Program Files\Netbird\netbird.exe" service run --config "C:\ProgramData\Netbird\work.json" --log-level info --log-file "C:\ProgramData\Netbird\logs\work.log" --daemon-addr tcp://127.0.0.1:8082
nssm set NetbirdWork Start SERVICE_AUTO_START
Restart NSSM Services:
Run the following commands to start both services:
nssm start NetbirdHome
nssm start NetbirdWork
Verify Services:
Open services.msc
to ensure that both NetbirdHome
and NetbirdWork
services are running.
Note that DNS is not working with this solution. Even if the original netbird service is kept intact. It wil work again if one of the services is shut down and the other service is restarted.
If you want to upgrade Netbird, do not forget to stop both of the services
netbird up --management-url https://<url> --setup-key <key>