mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-13 19:52:13 -04:00
Unable to configure local resolver address and port using NB_DNS_RESOLVER_ADDRESS environment variable #1213
Closed
opened 2025-11-20 05:26:05 -05:00 by saavagebueno
·
13 comments
No Branch/Tag Specified
main
fix/rosenpass
feat/status-short-flags
fix/byop-selfhost
ui-refactor-ui
ui-refactor
proxy-ipv6-bracket-and-debug-bundle
e2e-windows-dns-combined
mgmt-proxy-peer-ipv6
refactor-combined
wasm-websocket-dial
drop-dns-probes
feature/affected-peers
dependabot/go_modules/github.com/Azure/go-ntlmssp-0.1.1
debug-logs
reduce-embed-wg-pool
windows-dns-firewall
dependabot/go_modules/github.com/jackc/pgx/v5-5.9.2
fix/login-cmd-root-flags
feat/reseller-openapi-spec
github-issue-resolver
add-steamos-support
fix-darwin-uninstaller
flutter-test
dependabot/npm_and_yarn/proxy/web/postcss-8.5.12
ci/freebsd-pkg-bootstrap
cached-serial-check-on-sync
fix-mgmt-cache-bypass-overlay
revert-easyjson-5938
revert-ice-5820
revert-firewalld-5928
refactor/permissions-manager
wasm-js-func-release
revert-dns-5935-systemd-resolved
revert-dns-5935-5945
revert-dns-5945-mgmt-cache
feature/log-most-busy-peers
prototype/ui-wails
vnc-server
coderabbitai/utg/8ae8f20
feature/use-peer-fqdn-on-https
dependabot/go_modules/golang.org/x/image-0.38.0
feature/metrics-push-management-control
release/0.68.3
dependabot/go_modules/github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream-1.7.8
dependabot/go_modules/github.com/aws/aws-sdk-go-v2/service/s3-1.97.3
add-slack-channel
claude/rdp-token-passthrough-eNcqW
transparent-proxy
fix/macos-stale-route-eexist
crowdsec-selfhosted
fix/remove-otel-units
entire/checkpoints/v1
dependabot/go_modules/github.com/go-jose/go-jose/v4-4.1.4
fix/getting-started
feat/static-connectors-combined-server
feature/use-local-keys-embedded
feature/fleetdm
set-env-only-if-not-fork
feature/expose-has-channel
fix/connection-status-race
fix/filter-cgnat-cni-ice-candidates
feature/check-cert-locker-before-acme
test/proxy-fixes
test/proxy-mtu
prototype/ui-tauri
test/proxy-speed
fix-reused-ports
feat/migrate-to-embedded-idp
feature/add-serial-to-proxy-merged
deploy/proxy-serial
test/connection
feature/disable-legacy-port
feature/flag-to-disable-legacy-port
test/perftest
dependabot/go_modules/github.com/pion/dtls/v3-3.0.11
fix/http-redirect
poc-token-command
dn-reverse-proxy
prototype/reverse-proxy-rename
prototype/reverse-proxy-logs-pagination
feature/client-metrics
prototype/reverse-proxy-clusters
debug-dns-route
fix/win-dns-batch
add-extra-route-logs
job-stream-notify-disconnection-eof
deploy/secrets-manager
trigger-proxy-update
bug/update-ios-client-code-build-tags
sync-client-netmap-serial
log/conn-disconn
nmap/compaction-deploy
ci-win-test
feature/disk-encryption-check
wasm-debug
swap-dns-prio
fix/dex-config
feature/migrate-auto-groups-to-table
dependabot/go_modules/github.com/quic-go/quic-go-0.57.0
nmap/compaction
dex-nocgo-stub
feature/exclude-terraform-from-rate-limiting
test-freebsd
retries-refactor
coderabbitai/docstrings/b7e98ac
feat/integrate-zitadel
bug/ios-hanging-reconection
zitadel-idp
feat/network-map-serial
refactor/get-account-no-users
feat/auto-upgrade
feature/report-high-pat-id
feature/temporary-access-for-resource
fix/nmap-fwrules
dont-restart-dns
prototype/ui
update-gomobile
go-dns-for-ice
wasm-ldflags
test-ldflags
wasmbuild-test
feature/networks-s2s
vk/compare-nmaps
dbg/bothmaps
feature/changeset
reorder-dns-shutdown
fix/relay-reconnection-race
fix/nmap-exitnodes
vk/debug/nmap-both
move-licensed-code
feat/better-daemon-connection-lost-message
feat/auto-update-2
test/timings
refactor/getaccount-raw
tests/nmap-getaccount
refactor/nmap
refactor/nmap-limit-buffer
feature/detect-mac-wakeup
feature/extract-modules
quick-setings
feat/sync-limiter
feature/store-cache-impl
fix-install-version
feature/store-metrics
feature/metrics-on-store
feature/use-gorm-cache
loadtest-signal
unsymmetrical-squash
refactor/reducate-signaling
test/update-reduce
feature/store-cache
feature/remote-debug
cli-ws-proxy-backend-addr
feat/mgmt-map-serial
snyk-fix-d9d0081a4c7f9137bdb59d0d50a141a2
snyk-fix-7415cea5a11acd66753540ca2c598c63
job-yml-update
feature/android-allow-selecting-routes
fix/up-sequence
fix/dns-hash-update
snyk-fix-967adae9863f17f108ce8948d9117b8d
log/getaccount-by-peer
signal-suppressor
dns-exit-node
feature/auto-updates
feature/cache-srv-key
merged-fixes
fix/missed-offers-and-debug
debug-and-fixes
poc-wasm-clean-backend-s2s
test/remote-debug
debug-api
dependabot/go_modules/github.com/docker/docker-28.0.0incompatible
fix/remove-gpo-if-empty
fix/test-freebsd
fix/mysql-setup
fix/remove-logout-btn
handle-existing-domain-user
chore/unify-domain-validation
snyk-fix-c5fafc8a50ce1f29046e25a1fc346185
feat/profile-edit-btn
snyk-fix-a54966211e18d4cf67e5a2757cc006d1
log-short-id
feat/logout-ephemeral
log-checks
batch-wg-ops
nb-interface-default
feat/aws-integration
add/race-test
feature/relay-feature-versioning
fix/systemd-service-logs
poc/preprocessed-map
add-account-onboarding
bind-ipv6
fix/merge-main
logs/peerlogs-addpeer
feature/net-297-network-migration
feature/support-skip-auto-apply-exit-node-routes
set-cmd
set-command-with-cursor
feature/limit-update-channel
stop-using-locking-share
feature/poc-lazy-detection
feature/net-248-removal-of-sync-mutex-locks
test/multiple-peer-logging
preresolve
add-ns-punnycode-support
apply-routes-early
windows-search-domains
fix/connecting-route-filter
feature/management/rest-client/impersonate
debug-local-records
resource-fields-snake-case
test/grpc-rate-limit
traffic-correlation-policy
feature/rest-client-options
feat/events-metrics
feature/buf-cli
test/add-ratelimiter
test/remove-write-lock-on-add-peer
fix/add-peer-semaphore
feature/users-roles-endpoint
mlsmaycon-patch-1
debug-user-role
chore/primary-key-on-networks
feature/update-account-peers-buffer-startup
remove-ubuntu2004-runners
refactor/permissions-no-pat-allowed
ref/logrus-factory
use-conntrack-zone
deploy/permissions-account
feature/lazy-connection-idle
ref/improve-test-cov
restore-pr-3440
test/increase-grpc-timeouts
feat/buffer-account-peers-update
test/networkmapgeneration-changes
feature/base-manager
feature/flow-receiver
chore/benchmark-with-large-runner
refactor/handshake-initiator
client/ui-update-systray-icons
userspace-router
wgwatcher-test
output-if-key-already-exists
fix/relay-reconnection
feature/port-forwarding-client-codecleaning
detached2
test/callbacks-nil-iceconninfo
refactor/optimize-peer-expiration
enable-udp-port-for-docker-template
fix/relay-update
feature/apply-posture-netmap
fix/group-update-existing-resource
conntrack-stats
upgrade-okta-sdk
multi-price
test/conn-stat
set-min-parallel-tests-for-management
dns-interceptor
debug-dns
router-dns
add-static-system-info
debug-0.29.4
debug-0.33.0
account-refactoring
relay/2800_quic
route-get-account-refactoring
test/seed-random-routes
feature/get-account-refactoring
test/reconnect-race-condition
refactor/get-account-usage
feature/add-session-id-to-update-channel
improve-ipv4conn
fix/async-pion-event-handling
debug
add-offload
feature/validate-group-association-debug
fix/limit-conn-for-sqlite
test/engine-iface
test/transaction-for-jwt-sync
fix/engine-stop-in-foreground
feature/add-mysql-support
test-migration
refactor/header-size-values
relay/eliminate-gob
test/signal-dispatcher-with-relay
relay/debug
validate-icon
feature/ipv6-support
use-pre-expanded-peers-map
feature/use-signal-dispatcher
validate/peer-status
add-read-write-times
fix/sync-peer-race
feature/relay-status
netmap
evaluate/network-map-hash
fix/lower-dns-resolve-interval-on-fail
feature/relay
fix/go-mod-version
upgrade-nftables
synology-userspace-mode
fix/use-ip-for-default-routes-on-darwin
fix/proxy_close
enable-release-workflow-on-pr
deploy/peer-performance
feature/permanent-turn
feature/permanent-turn-proxy
deploy/posture-check-sqlite
feature/optimize_sqlite_save
debug-ios-behavior
fix/delete-route-only-after-adding
tshoot/windows-logger
remove-new-routing
refactor/eliminate-repo-dependency
add-arm-to-ci
refactor-demo-account-object
test/abc2
test/abc
send-ssh-rosenpass-config-meta
refactor-demo
ensure-schedule-never-runs-non-positive
feature/peer-validator-groupmgm
feature/peer-validator-fix
fix/include-active-dashboard-users
fix/handle-canceling-schedule
fix/geo-download
debug-google-workspace
yury/resolve-ip-to-location
feature/extend-sysinfo
sqlite-async-peer-status
yury/add-postgresql-store
fix/route
test-build
posture-checks-poc
debug-keycloak-idp
poc/netstack
for-pascal-tmp
peer-logout-management
manual-peer-logout
detached
chore/refactor-management
test/dns-bind
fix/enforce-acl-for-containers
yury/use-sync-map-in-updatechannel
fix/events-key-handling
filter-cache-on-load-account
fix/user-expiration
handle-user-context-cancellation
nb-client-k8s-statefulset
fake-addr
fix/iptables_in_docker
ebpf-debug
update-getting-started-flow-use-postgres
fix/peer_list_notification
feature/device-authentication-with-client-secret
feature/keep_alive
feat-groups-from-jwt
separate_proxy_from_wgconfig
fix/wg_conn
wg_conn_fix
wg_bind_parallel_processing
fix-rollback-get-acls
proxy_cfg_cleanup
performance-improvement-rego
update-lock-log-level
feat-client-side-acl
refactor/move_grpcserver_logic_to_account_manager
feature/event-storage
feature/update-idp-redeeming-invite
feature/api-peer-info
return-groupminimum-setupkey
feature/interface-bind
documentation_enhancement
fix-peer-registration
ssh
users_cache
pass-client-caller
client_caller_type
revert-283-feat-fix-windows-installer
periodic-peer-updates
ebpf
braginini/wasm
v0.70.5
v0.70.4
v0.70.3
v0.70.2
v0.70.1
v0.70.0
v0.69.0
v0.68.3
v0.68.2
v0.68.1
v0.68.0
v0.67.4
v0.67.3
v0.67.2
v0.67.1
v0.67.0
v0.66.4
v0.66.3
v0.66.2
v0.66.1
v0.66.0
v0.65.3
v0.65.2
v0.65.1
v0.65.0
v0.64.6
v0.64.5
v0.64.4
v0.64.3
v0.64.2
v0.64.1
v0.64.0
v0.63.0
v0.62.3
v0.62.2
v0.62.1
v0.62.0
v0.61.2
v0.61.1
v0.61.0
v0.60.9
v0.60.8
v0.60.7
v0.60.6
v0.60.5
v0.60.4
v0.60.3
v0.60.2
v0.60.1
v0.60.0
v0.59.13
v0.59.12
v0.59.11
v0.59.10
v0.59.9
v0.59.8
v0.59.7
v0.59.6
v0.59.5
v0.59.4
v0.59.3
v0.59.2
v0.59.1
v0.59.0
v0.58.2
v0.58.1
v0.58.0
v0.57.1
v0.57.0
v0.56.1
v0.56.0
v0.55.1
v0.55.0
v0.54.2
v0.54.1
v0.54.0
v0.53.0
v0.52.2
v0.52.1
v0.52.0
v0.51.2
v0.51.1
v0.51.0
v0.50.3
v0.50.2
v0.50.1
v0.50.0
v0.49.0
v0.48.0-dev2
v0.48.0
v0.47.2
v0.47.1
v0.47.0
v0.46.0
v0.45.3
v0.45.2
v0.45.1
v0.45.0
v0.44.0
v0.43.3
v0.43.2
v0.43.1
v0.43.0
v0.42.0
v0.41.3
v0.41.2
v0.41.1
v0.41.0
v0.40.1
v0.40.0
v0.39.2
v0.39.1
v0.39.0
v0.38.2
v0.38.1
v0.38.0
v0.37.2
v0.37.1
v0.37.0
v0.36.7
v0.36.6
v0.36.5
v0.36.4
v0.36.3
v0.36.2
v0.36.1
v0.36.0
v0.35.2
v0.35.1
v0.35.0
v0.34.1
v0.34.0
v0.33.0
v0.32.0
v0.31.1
v0.31.0
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.4
v0.29.3
0.29.3
v0.29.2
v0.29.1
v0.29.0
v0.28.9
v0.28.8
v0.28.7
v0.28.6
v0.28.5
v0.28.4
v0.28.3
v0.28.2
v0.28.1
v0.28.0
v0.27.10
v0.27.9
v0.27.8
v0.27.7
v0.27.6
v0.27.5
v0.27.4
v0.27.3
v0.27.2
v0.27.1
v0.27.0
v0.26.7
v0.26.6
v0.26.5
v0.26.4
v0.26.3
v0.26.2
v0.26.1
v0.26.0
v0.25.9
v0.25.8
v0.25.7
v0.25.6
v0.25.5
v0.25.4
v0.25.3
v0.25.2
v0.25.1
v0.25.0
v0.24.4
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.9
v0.23.8
v0.23.7
v0.23.6
v0.23.5
v0.23.4
v0.23.3
v0.23.2
v0.23.1
v0.23.0
v0.22.7
v0.22.6
v0.22.5
v0.22.4
v0.22.3
v0.22.2
v0.22.1
v0.22.0
v0.21.11
v0.21.10
v0.21.9
v0.21.8
v0.21.7
v0.21.6
v0.21.5
v0.21.4
v0.21.3
v0.21.2
v0.21.1
v0.21.0
v0.20.8
v0.20.7
v0.20.6
v0.20.5
v0.20.4
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.0
v0.18.1
v0.18.0
v0.17.0
v0.16.0
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.6
v0.14.5
v0.14.4
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.0
v0.12.0
v0.11.6
v0.11.5
v0.11.4
v0.11.3
v0.11.2
v0.11.1
v0.11.0
v0.10.10
v0.10.9
v0.10.8
v0.10.7
v0.10.6
v0.10.5
v0.10.4
v0.10.3
v0.10.2
v0.10.1
v0.10.0
v0.9.8
v0.9.7
v0.9.6
v0.9.5
v0.9.4
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.12
v0.8.11
v0.8.10
v0.8.9
v0.8.8
v0.8.7
v0.8.6
v0.8.5
v0.8.4
v0.8.3
v0.8.2
v0.8.1
v0.8.0
v0.7.1
v0.7.0
v0.6.4
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.11
v0.5.10
v0.5.1
v0.5.0
v0.4.0
v0.3.5
v0.3.4
v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.3
v0.2.2-beta.1
v0.2.1-beta.5
v0.2.0-beta.5
v0.2.0-beta.4
v0.2.0-beta.3
v0.2.0-beta.2
v0.2.0-beta.1
v0.1.0-beta.3
v0.1.0-beta.2
v0.1.0-beta.1
v0.1.0-rc.2
v0.1.0-rc-1
v0.0.8-hotfix-1
v0.0.8
v0.0.7
v0.0.6
v0.0.5
v0.0.4
v0.0.3
v0.0.2
v0.0.1
v0.0.0
Labels
Clear labels
2021 Q4
2022 Q1
2022 Q1
accessibility
acl
agent
agent
Android
Android
api
authentik
automation
azure
battery-usage
bug
cache
client
client-ui
cloud
cloud-only
cloudflare
community
compatibility
config-idp
config-issue
connection
contribution
coturn
cross-vpn
dashboard
data-usage
distribution
dns
docker
documentation
duplicate
enhancement
enhancement
event-stream
feature-request
freebsd
getting-started
go
good first issue
gui
help wanted
home-assistant
idp
inconsistency
integration
integrations
ios
ipv6
jwt
k8s
keycloak
linux
login
macos
management-service
missing-docs
mobile
moved-internal
needs-review
netbird-ui
networking
new-platform
nginx
notification
okta
openwrt
packaging
peer-management
peer-management
peer-management
performance
postgres
posture-checks
psk
pull-request
question
refactor
relay
release
rfc
routes
security
security-related
self-hosting
server
signal
sleep-issue
ssh
ssl
status
store
synology
system-compatibility-issue
test-suite
third-party-integration
triage
triage-needed
troubleshooting
UX
waiting-feedback
windows
wontfix
zitadel
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
saavagebueno
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: SVI/netbird#1213
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @gene1wood on GitHub (Sep 3, 2024).
Describe the problem
I'd like to be able to run the pihole DNS server and Netbird on the same computer. I'm figuring that the best way to do this is to
505353This way netbird addresses resolve correctly, and all other addresses get sent onto Pihole.
My Netbird installation works and can set up the local netbird resolver on port 53 of the CGNAT IP.
My Ubuntu 22.04 server uses
systemd. Netbird 0.28.9 launches viasystemdand consumes environment variables out of/etc/sysconfig/netbird.I've created an
/etc/sysconfig/netbirdfile with the contents ofI've done this to try to get netbird's local resolver to listen not on port
53but instead5053. I'm figuring this would work as the--dns-resolver-addresscommand line flag for theupcommand says that itI've confirmed that the
/etc/sysconfig/netbirdfile is working because when I add theNB_LOG_LEVEL=debugline, the/var/log/netbird/client.logfile begins logging debug information.Netbird however continues to follow it's native logic for determining the local resolver address and port.
I know it's not following the
NB_DNS_RESOLVER_ADDRESSenvironment variable because the logs show thisAnd when I run
lsof -i :53it shows that netbird continues to listen on port53What am I overlooking that's preventing me from being able to override the DNS resolver address using the
NB_DNS_RESOLVER_ADDRESSenvironment variable?To Reproduce
Steps to reproduce the behavior:
/etc/sysconfig/netbirdfile as described above to set the local resolver address and port to127.0.0.1:5053systemctl restart netbird.serviceExpected behavior
The logs should show that netbird's local resolver is listening on
127.0.0.1:5053and when checking what ports the process has open, it should show5053Are you using NetBird Cloud?
Yes
NetBird version
0.28.9NetBird status -dA output:
This is included in the output below from
netbird debug for 1m -ASDo you face any (non-mobile) client issues?
Please provide the file created by
netbird debug for 1m -AS.netbird.debug.3677564285.zip
@gene1wood commented on GitHub (Sep 4, 2024):
A tangential question : While I'm unable to get Netbird's local resolver to listen on a different port, is there a way to just disable the local resolver feature? I'm not using it and just disabling it would be fine.
I've looked through the CLI help options but have been unable to find something to tell Netbird to just not spawn a DNS local resolver.
It looks like my tangential question may relate to #2495
@gene1wood commented on GitHub (Sep 15, 2024):
@lixmal Is there something obvious I'm doing wrong with the
NB_DNS_RESOLVER_ADDRESSenvironment variable?@gokuldas commented on GitHub (Dec 6, 2024):
@gene1wood I don't know if this issue is still relevant to you, but I think I know the problem and the solution.
According to the docs, the environment variables are just replacements for CLI flags. However, one thing is clear. The netbird client command fails if you give it a wrong flag. On the other hand if you give netbird a wrong environment variable, it just neglects it and proceeds with its default behavior without warning or alerting you in any manner.
Now have a look at the netbird systemd service file. The following lines are of special interest:
The environment file was
/etc/sysconfig/netbirdon my system instead of/etc/default/netbirdhere. Either way, the file is read (if present, as indicated by the hyphen prefix) and the environment is set for the command given byExecStart. Therefore, those environment variables apply to the commandnetbird service run.Trying
netbird help service rungives me:There is no
--dns-resolver-addressflag for this command. In fact, there is no option at all in this command to set the DNS resolver address. But the--config /etc/netbird/config.jsonis a possible candidate for what you need. Infact, this was found in my/etc/netbird/config.jsonfile:But I couldn't find any documentation on what it is or how to set it. Anyway, as you already noted, the
--dns-resolver-addressflag is part of thenetbird upcommand. This can be confirmed by runningnetbird help up. So, what happens if you do this?:The netbird client service does in fact start listening on that specific interface (loopback) and port. Further, the line from
/etc/netbird/config.jsonchanges to this:So this is where the DNS resolver setting is stored. I also confirmed that this value is persisted. The resolver starts consistently on the same interface until you use that flag again. You really don't need the environment variable at all. All you need to do is to stop netbird once and start it again, specifying your preferred interface.
There are some caveats though. The first is that you have to specify both the IP and the port. Neither can be omitted.
The other is that when netbird populates the
/etc/resolv.conffile, it adds the linenameserver 127.0.0.1at the top. Note that the port is not mentioned. I checked and confirmed that the other applications can't find the resolver on a non-standard port. It's better to stick with the standard port 53, whatever the interface may be. I wanted the port 53 on the wireguard interface to be free. This worked perfectly when I shifted the resolver to127.0.0.1:53.Finally,
This feature is not present in the CLI as far as I can tell. It's in the DNS page of the server administration console. There is a rather obscure tab that leads to a box where you can add the client groups on which you don't want the resolver to start. This is explained in a comment from the issue you linked above. Interestingly, I had the opposite problem as you did. The resolver wouldn't start on certain clients. After failing to identify the reason from hours of online research, I accidentally stumbled on this page.
Hope this helps!
@nazarewk commented on GitHub (Apr 28, 2025):
Hello @gene1wood,
We're currently reviewing our open issues and would like to verify if this problem still exists in the latest NetBird version.
Could you please confirm if the issue is still there?
We may close this issue temporarily if we don't hear back from you within 2 weeks, but feel free to reopen it with updated information.
Thanks for your contribution to improving the project!
@mlsmaycon commented on GitHub (Jun 1, 2025):
closing issue due to no recent feedback. Feel free to open a new one if the issue persist or reopen if this was a feature request.
@mr-karan commented on GitHub (Oct 8, 2025):
I encountered the same issue on Arch Linux with Netbird installed via AUR. The problem was that my
netbird@.servicesystemd unit file was missing the--config /etc/netbird/%i.jsonflag in theExecStartline.Without the config flag, Netbird wasn't reading or persisting settings to
/etc/netbird/config.json, so the--dns-resolver-addressflag had no effect.Solution:
The setting now persists in
/etc/netbird/config.jsonas:And Netbird's DNS resolver correctly listens on the specified port instead of the default port 53.
Hope this helps anyone else stuck with same issue
@OTheNonE commented on GitHub (Nov 2, 2025):
I am having an issue with this. I am using docker compose and running the commands:
command: ["up", "--dns-resolver-address", "127.0.0.1:5053"]When running
ss -tulnp, i see that the netbird instance100.XXX.YYY.ZZZis taking the port 53, eventhough i run the above command.@timowevel1 commented on GitHub (Nov 3, 2025):
The issue is still open.
@lixmal commented on GitHub (Nov 3, 2025):
The container needs
NB_DNS_RESOLVER_ADDRESS, non-containers need the up command. This issue is convoluted, can you please state what the issue is for each one of you?@gokuldas commented on GitHub (Nov 6, 2025):
@lixmal I don't have anymore issues here, but I noticed something in the Dockerfile and its entry point.
I can see why. Here is the relevant line from the Dockerfile:
Note that the CMD directive is not defined in it. Meanwhile, here are the relevant lines from the
netbird-entrypointscript:The last line invokes the
mainfunction with the script's entire argument. However, those arguments are not used anywhere inside the main function. This means that @OTheNonE 's compose linecommand: ["up", "--dns-resolver-address", "127.0.0.1:5053"]doesn't go anywhere and doesn't have any effect whatsoever.I don't know what the original intentions behind the script were - if it was to use those CLI args, but forgot to do so, or if it was to not use the args, but passed them during the function call by mistake. Either way, it's inconsistent and very confusing. Even setting the
NB_DNS_RESOLVER_ADDRESSenvironment variable in docker-cli/compose-file probably won't have any effect, because thenetbird upcommand will never be called. It will always be thenetbird service runcommand that's executed.I can suggest a solution if you're looking for one. This solution will have the following properties:
commandin docker-cli/compose-file will work as expected, including the correct sub-command and the CLI flags that the admin specifies.NB_DNS_RESOLVER_ADDRESSwill work if the admin is running thenetbird upcommand--dns-resolver-address=<interface:port>flag will also work for thenetbird upcommandSo here is the modified code:
This way, the admin can replace the entire subcommand (eg:
service runwithup --dns-resolver-address 127.0.0.1:5053as in @OTheNonE 's solution) using thecommandspec in the docker-cli/compose-file. This is probably the solution that's will spring the least surprise on the admin.Note that should you choose to implement this, you'll probably need to modify the rest of the
mainfunction in the bash script. The admin may not be trying to start the service at all. So adding the PID to the PID list wont make any sense.@nazarewk commented on GitHub (Nov 7, 2025):
@gokuldas the main problem is there are 2 commands to run taking a different set of input, which one should take the arguments passed down?
netbird upactually does most of the meaningful configuration in practice, but there are also some configuration tweaks that can only be passed to a daemon (service run).As a bit of background, every single CLI flag can be passed down as an Environment Variable, so there should never be any need to customize the argument-less
netbird service runnornetbird up.@nazarewk commented on GitHub (Nov 7, 2025):
maybe adding a "no arguments passed" verification to the entry point and useful error message would help with it
@gokuldas commented on GitHub (Nov 7, 2025):
@nazarewk
I feel that you misunderstood my suggestion. I will clarify that a bit further down. But first:
Could you confirm this? Our observation was exactly the opposite of this (ref-1, ref-2). The
netbird service runcommand wasn't respecting theNB_DNS_RESOLVER_ADDRESSenvironment variable at all. On the other hand, thenetbird updid. The documentation also indicates that thenetbird upcommand has the--dns-resolver-addressflag, but thenetbird service upcommand doesn't.I haven't checked the client code (not a Go programmer), but when I did a few trials, I reached the conclusion that the commands take the environment variables only if they're applicable to it and entered correctly. Mistakes like non-applicable or misspelled envvars don't throw any errors - so you'd be none the wiser. This is why the
upcommand was respecting theNB_DNS_RESOLVER_ADDRESSvariable, while theservice runcommand was ignoring it silently.The problem with this approach is that you leave no way for the admin to run any sub-command other than
service run. And as I explained above, this command doesn't allow you to set the DNS resolver address, even with the envvar. And I don't see the envvars being used in thenetbird-entrypoint.shscript in any other way either. (There is actually a way to do this. I will explain and add a reference below.). So if the admin has issues with the default resolver address like many here do, they won't be able to use this image (they can of course exec arbitrary netbird subcommands inside the container, or build an image themselves).So, here's the possible confusion. I set up the image entrypoint (the docker command layer) and the default command (another docker command layer) in such a way that the admin can override both the subcommand and the CLI args together. There would be no question of which subcommand would receive which CLI args. By default, the image would run
netbird service run. But if the admin wanted to runnetbird up --dns-resolver-address 127.0.0.1:5053, they would have to do just one of these:docker command:
or docker-compose:
The only problem left is that the admin can now run any netbird subcommand with the appropriate CLI args of their choice. But inside the
mainfunction of thenetbird-entrypoint.shbash script, you do the following extra stuff, including adding the PID of the netbird process to a bash array:I believe that you meant these only for the server process, not for other short-life subcommands. So you'll have to skip these steps if the CLI args (
$1and$2) aren't"server"and"run". This way, thenetbird-entrypoint.shscript will give you the full power of the netbird client without imposing any sort of limitation.Alternative Approach
The entire solution above assumes that you're okay with letting the admin configure the container manually using arbitrary netbird subcommands. But you probably are looking for ways to use environment variables exclusively for container configuration. That's the only option that makes sense in environments like compose and kubernetes.
If that's the case, please remember that your image is most likely ignoring most of the
NB_*configuration variables. There is another way to make this work. But you'll have to write the values from the variables directly into config files (like/etc/netbird/config.json) from the script, instead of depending on the client (or else you need to reprogram the client).This is done by pre-preparing the config files like templates and then filling in the values at setup time using the
envsubstbash command. This is actually very easy. It's not as complicated as jinja or handlebars templates. Theenvsubstcommand is also available on alpine as a tiny gnu package. Here are some documentation that directly addresses this use-case: