Skip to content

Commit 63e01ad

Browse files
committed
feat: domain Resources troubleshooting section
1 parent e3f60a9 commit 63e01ad

2 files changed

Lines changed: 246 additions & 21 deletions

File tree

src/pages/how-to/networks.mdx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ In addition to routing IP addresses, NetBird also supports routing domain names.
5757
a domain name (eg: `example.com`) or a wildcard domain (eg: `*.example.com`) in place where you would normally
5858
put an IP address range. Then NetBird clients will start responding to and routing the given domain.
5959

60+
Please consult the
61+
[Debugging access to Domain Resources](/how-to/troubleshooting-client#debugging-access-to-domain-resources)
62+
documentation to troubleshoot common issues with this type of resources yourself.
63+
6064
<Note>
6165
Due to a mix of a bug and initial design choice clients running `0.59.0` & `0.59.1` might not be able to resolve
6266
domain Resources served by Routing Peers running versions `0.59.0` to `0.59.9` in case when all the Peers in the
@@ -71,18 +75,22 @@ On a technical level the feature works as follows:
7175
1. Initially (when NetBird connects) the operating system is instructed to use NetBird to resolve the requested
7276
domain(s). No routing rules are configured yet.
7377
2. An Application (could be a web browser) requests a domain `example.com` from the Operating System
74-
1. the Operating System requests a name from NetBird's Local Resolver, by default running on port `53` of:
78+
1. the Operating System requests a name from NetBird's Local DNS Forwarder, by default running on port `53` of:
7579
- for MacOS & Windows: the highest available IP address in your NetBird range, usually `100.xxx.255.254:53`
7680
- for other systems: local NetBird client's IP address, eg: `100.xxx.123.45`
77-
2. the Local Resolver forwards the query to Routing Peer's IP address and the following port:
81+
2. the Local DNS Forwarder forwards the query to Remote DNS Resolver running on Routing Peer's address
82+
and the following port:
7883
- `22054` for version `0.59.0` and newer
7984
- `5353` for versions below `0.58.x` and older
80-
3. the Routing Peer resolves the domain name using it's local configuration (often independent of NetBird) and returns
85+
3. the Routing Peer resolves the domain name using its local configuration (often independent of NetBird) and returns
8186
the result.
82-
4. the Local Resolver sets up routing rules for IP addresses returned from the query, before returning them to the Application
87+
4. the Local DNS Forwarder sets up routing rules for IP addresses returned from the query,
88+
before returning them to the Application
89+
- see [Trigger the Domain Resource](/how-to/troubleshooting-client#trigger-the-domain-resource)
90+
to observe this behaviour "in action".
8391
3. the Application receives the result "as usual", except for a slight delay before all of the above takes place the
8492
first time a domain name is requested,
85-
4. all subsequent requests to `example.com` will be served instantly from the Local Resolver's cache
93+
4. all subsequent requests to `example.com` will be served instantly from the Local DNS Forwarder's cache
8694

8795
<Note>
8896
NetBird tries its best to automatically open up DNS forwarder ports on Routing Peer's firewalls, but might fail on

src/pages/how-to/troubleshooting-client.mdx

Lines changed: 233 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ a [github issue](https://github.com/netbirdio/netbird/issues/new/choose) and att
9999
A debug archive containing the recent logs and the status at the time of execution can be generated with the following
100100
command.
101101

102-
Adding the `--anonymize (-A)` flag will anonymize the logs, removing sensitive information such as public IP addresses and domain
102+
Adding the `--anonymize (-A)` flag will anonymize the logs, removing sensitive information such as public IP addresses
103+
and domain
103104
names. In case you have tunneling issues, omitting the `--anonymize` flag might help our analysis.
104105
Adding the `--system-info (-S)` flag will add system information like network routes and interfaces
105106

@@ -119,6 +120,7 @@ the specified time has elapsed.
119120
```shell
120121
netbird debug for 5m --system-info
121122
```
123+
122124
<Note>
123125
The flag `--anonymize (-A)` can be used to anonymize IP addresses and non-netbird.io domains in logs and status output when needed.
124126
</Note>
@@ -127,17 +129,22 @@ To capture any issues arising during the `up` and `down` processes, this will se
127129
netbird `up` and `down` up to a few times.
128130
After 5 minutes the netbird status will be restored to the previous state and the debug bundle will be generated.
129131

130-
131132
### Debug bundle uploads
132-
Since version `0.43.1`, you can share debug bundle with the NetBird development team without local administrative privileges
133+
134+
Since version `0.43.1`, you can share debug bundle with the NetBird development team without local administrative
135+
privileges
133136
by using the `--upload-bundle (-U)` flag.
134-
It will securely generate and upload the debug bundle to our servers for access by the NetBird development team. See examples below:
137+
It will securely generate and upload the debug bundle to our servers for access by the NetBird development team. See
138+
examples below:
135139

136140
Run debug for a specific time and upload the bundle:
141+
137142
```shell
138143
netbird debug for 1m --system-info --upload-bundle
139144
```
145+
140146
To generate a bundle without restarting the client and then uploading:
147+
141148
```shell
142149
netbird debug bundle --system-info --upload-bundle
143150
```
@@ -152,13 +159,15 @@ Local file:
152159
Upload file key:
153160
1234567890ab27fb37c88b3b4be7011e22aa2e5ca6f38ffa9c4481884941f726/12345678-90ab-cdef-1234-567890abcdef
154161
```
162+
155163
<Note>
156164
The flag `--anonymize` can be used to anonymize IP addresses and non-netbird.io domains in logs and status output when needed.
157165
</Note>
158166
### Debug bundle uploads with GUI
159167
Since version `0.43.2` users can upload their debug bundle via the GUI client.
160168

161-
To generate a bundle via GUI, you can access the application then go to `Settings` > `Create Debug Bundle` and follow the wizard to upload the bundle:
169+
To generate a bundle via GUI, you can access the application then go to `Settings` > `Create Debug Bundle` and follow
170+
the wizard to upload the bundle:
162171

163172
<p>
164173
<img src="/docs-static/img/troubleshooting-client/ui-settings.png" alt="service-user-overview" className="imagewrapper-big"/>
@@ -171,7 +180,8 @@ To generate a bundle via GUI, you can access the application then go to `Setting
171180
</p>
172181
By default running with trace log enable before generating the bundle is selected. This will restart the client connections and provide a `disconnect to connected` information for our engineers.
173182

174-
If you uncheck this option, a bundle will be generated without running this step. Which is very useful when you have an issue that recovers when restarting the client.
183+
If you uncheck this option, a bundle will be generated without running this step. Which is very useful when you have an
184+
issue that recovers when restarting the client.
175185
<p>
176186
<img src="/docs-static/img/troubleshooting-client/ui-bundle-success.png" alt="service-user-overview" className="imagewrapper-big"/>
177187
</p>
@@ -353,9 +363,11 @@ The most notable examples of encountering the issue are:
353363
- the user makes a mistake and selects
354364
- the user uses different browser/profile or selects the wrong account during SSO login at the start of the workday,
355365

356-
If you know the exact previous Peer which was logged in, you can just delete it from Dashboard without doing anything else and attempt login again.
366+
If you know the exact previous Peer which was logged in, you can just delete it from Dashboard without doing anything
367+
else and attempt login again.
357368

358-
Otherwise, to resolve the issue, you will need to remove the file manually to use the machine as a different user/Setup Key while the NetBird client daemon is stopped:
369+
Otherwise, to resolve the issue, you will need to remove the file manually to use the machine as a different user/Setup
370+
Key while the NetBird client daemon is stopped:
359371

360372
1. `netbird service stop`
361373
2. `sudo rm /var/lib/netbird/default.json` (*nix) or `rm C:\ProgramData\netbird\config.json` (Windows)
@@ -384,14 +396,14 @@ and following Netbird network resources:
384396

385397
- `peer-a`: end user's device running Netbird Client,
386398
- `peer-b`: a linux server inside the internal network running Netbird Client,
387-
- it has direct access to the whole `int-net1` IP range,
399+
- it has direct access to the whole `int-net1` IP range,
388400
- `users:employees`: a Netbird Group containing `peer-a`,
389401
- `routers:int-net1`: a Netbird Group containing `peer-b`,
390402
- `access:srv-c`: a Netbird Groups used as a target of ACL rules for `srv-c` only,
391403
- `access:int-net1`: a Netbird Groups used as a target of ACL rules for the whole subnet,
392404
- `net-a`: a Netbird Network
393-
- `net-a:srv-c`: a Network Resource handling traffic to `10.123.45.17/32` (`srv-c`),
394-
- `net-a:int-net1`: a Network Resource handling traffic to `10.123.45.0/24` (`int-net1`),
405+
- `net-a:srv-c`: a Network Resource handling traffic to `10.123.45.17/32` (`srv-c`),
406+
- `net-a:int-net1`: a Network Resource handling traffic to `10.123.45.0/24` (`int-net1`),
395407
- `route:int-net1`: a Netbird Network Route handling traffic to `10.123.45.0/24` (`int-net1`),
396408
- `route:srv-c`: a Netbird Network Route handling traffic to `10.123.45.17/32` (`srv-c`),
397409
@@ -454,8 +466,8 @@ For Netbird network routing resources configurations you can use either (new) _N
454466
A Network `net-a` should have at minimum:
455467

456468
- _Network Resource_: `net-a:srv-c` with either of:
457-
- an _Address_ set to `10.123.45.17/32` to configure route to `srv-c` exclusively and nothing else,
458-
- _Assigned Groups_ set to `access:srv-c`
469+
- an _Address_ set to `10.123.45.17/32` to configure route to `srv-c` exclusively and nothing else,
470+
- _Assigned Groups_ set to `access:srv-c`
459471
- _Routing Peer Group_ assigned to `routers:int-net1`
460472

461473
A _Network Route_ `route:srv-c` should have at least:
@@ -501,9 +513,9 @@ Just like with the previous section you can loosen the above example by:
501513
- allowing `ALL` protocol, _Ports_ will become greyed out because all traffic will be allowed,
502514
- creating a bidirectional rule (both arrows should be green), always true for the protocol `ALL`,
503515
- selecting a different source group from the pool assigned to `peer-a`,
504-
- it could be built-in `All` group, but it is discouraged,
516+
- it could be built-in `All` group, but it is discouraged,
505517
- selecting a different destination group from the pool assigned to `peer-b`,
506-
- it could be built-in `All` group, but it is discouraged,
518+
- it could be built-in `All` group, but it is discouraged,
507519

508520
#### Is `peer-a`'s operating system configured to use the route?
509521

@@ -752,7 +764,7 @@ You can validate whether this is the issue in your setup by performing following
752764
3. resolve the domain, eg: `dscacheutil -q host -a name <domain>`
753765
4. `netbird up` / `Connect`
754766
5. check whether `dscacheutil -q host -a name <domain>` works
755-
- if it doesn't flush the cache and retry
767+
- if it doesn't flush the cache and retry
756768

757769
#### Verifying the nameservers are properly registered in Linux operating system
758770

@@ -795,3 +807,208 @@ To configure `int-dns2`, while following _Access from `peer-a` to `srv-c`_ secti
795807
address range,
796808

797809
To test the configuration in practice please refer to previous section _Public nameservers_.
810+
811+
## Debugging access to Domain Resources
812+
813+
While we strive to make them "just work", there still are and will be cases of domain-based Resources not behaving
814+
correctly. It can happen for myriad of reason starting with local device management or firewall software, through
815+
Routing Peer issues and ending with
816+
817+
For in-depth overview of the mechanism please read [Domain Resources](/how-to/networks#domain-resources) section.
818+
819+
Analyzing those issues will take a "backwards" approach (based on the most common issues), where we will first confirm
820+
that Routing Peer itself is working as expected and will check the client's operating system configuration as one of the
821+
last steps.
822+
823+
For the remainder of the section let's assume:
824+
825+
- there is a `*.nb.test` Network Resource configured,
826+
- we are trying to access a `srv.nb.test` domain,
827+
- a `zxc.nb.test` domain does not exist, it's used to demonstrate errors,
828+
- the Routing Peer's NetBird address is `100.83.136.209`
829+
- it's named `brys-vm-nbt-ubuntu-isolated-02`, when referred in the outputs
830+
- the client is named `brys-vm-nbt-ubuntu-01`, when referred in the outputs
831+
- the client is running Ubuntu, but a lot of commands used are working uniformly across all platforms,
832+
- it's IP address is `100.83.73.97`,
833+
- on MacOS & Windows you would use `100.83.255.254` to access the local DNS forwarder instead,
834+
- the Resource is running on `brys-vm-nbt-ubuntu-isolated-01`, when referred to in the outputs
835+
- we will only check the new port `22054`, but steps might need repeating for port `5353` for legacy clients,
836+
837+
<Note>
838+
Be aware that the port `5353` is a well known Multicast DNS port (aka Avahi aka Bonjour,
839+
used for: printer sharing, Chromecast etc.) and therefore it might be occupied by another software
840+
running on the machine. As a result (old) Routing Peers might be prevented from routing Domain Resources.
841+
842+
While not an issue in the regular server operations, it might come as a surprise to find that the port `5353`
843+
is occupied by a Chrome (and it's derivatives) Web Browser on your remotely accessible Windows Server machine.
844+
845+
This is the primary reason we have switched to the new port `22054`. We strongly advise you to update your fleet
846+
to the latest version (no older than `0.59.10`) to address this issue.
847+
</Note>
848+
849+
### Is Routing Peer correctly resolving queries?
850+
851+
While in practice it almost never the issue, it is always good to double-check whether the Routing Peer itself is able
852+
to resolve the requested domain as-is and whether it can access the target resource.
853+
854+
Please refer
855+
to [Verifying the DNS names resolve properly in practice](#verifying-the-dns-names-resolve-properly-in-practice)
856+
section for operating-system specific commands while adjusting domain for `srv.nb.test`.
857+
858+
It also would not hurt to check whether the Routing Peer has an actual network access to the routed resource with:
859+
860+
For TCP services you should see something like this:
861+
862+
```shell
863+
kdn@brys-vm-nbt-ubuntu-01:~$ nc -vz -w 1 srv.nb.test 80
864+
Connection to srv.nb.test (192.168.100.10) 80 port [tcp/http] succeeded!
865+
kdn@brys-vm-nbt-ubuntu-01:~$ nc -vz -w 1 srv.nb.test 12345
866+
nc: connect to srv.nb.test (192.168.100.10) port 12345 (tcp) failed: Connection refused
867+
```
868+
869+
For UDP you can use:
870+
871+
```shell
872+
kdn@brys-vm-nbt-ubuntu-01:~$ nc -vz -w 1 -u srv.nb.test 12345 ; echo $?
873+
Connection to srv.nb.test (192.168.100.10) 12345 port [udp/*] succeeded!
874+
0
875+
kdn@brys-vm-nbt-ubuntu-01:~$ nc -vz -w 1 -u srv.nb.test 12347 ; echo $?
876+
1
877+
```
878+
879+
### Is the remote DNS resolver accessible to the client?
880+
881+
We want to confirm that a client Peer can reach and use the Routing Peer's DNS resolver, this step will rule out any
882+
firewall-related issues with the Routing Peer. If the following command fails you will need to open up a port `22054`
883+
in the Routing Peer's firewall software.
884+
885+
```shell
886+
kdn@brys-vm-nbt-ubuntu-01:~$ nslookup -timeout=1 -port=22054 srv.nb.test 100.83.136.209
887+
Server: 100.83.136.209
888+
Address: 100.83.136.209#22054
889+
890+
Non-authoritative answer:
891+
Name: srv.nb.test
892+
Address: 192.168.100.10
893+
894+
kdn@brys-vm-nbt-ubuntu-01:~$ nslookup -timeout=1 -port=22054 zxc.nb.test 100.83.136.209
895+
Server: 100.83.136.209
896+
Address: 100.83.136.209#22054
897+
898+
** server can't find zxc.nb.test: NXDOMAIN
899+
900+
```
901+
902+
### Trigger the Domain Resource
903+
904+
I have yet to see a local DNS forwarder fail, but using it is a good way of forcing the NetBird client to set up
905+
routing for the domain (see the [Domain Resources](/how-to/networks#domain-resources) for explanation).
906+
907+
<Note>
908+
On MacOS & Windows the IP address would always be `100.83.255.254` instead of `100.83.73.97`.
909+
</Note>
910+
911+
Take a note of the IP addresses being initially missing from the routing table (`ip route show` on Linux), but
912+
get added after resolving the domain for the first time using the local DNS Forwarder.
913+
914+
```shell
915+
kdn@brys-vm-nbt-ubuntu-01:~$ netbird networks ls
916+
Available Networks:
917+
918+
- ID: *.nb.test
919+
Domains: *.nb.test
920+
Status: Selected
921+
Resolved IPs: -
922+
kdn@brys-vm-nbt-ubuntu-01:~$ ip route show table all | grep 192.168.100
923+
kdn@brys-vm-nbt-ubuntu-01:~$ nslookup -timeout=1 srv.nb.test 100.83.73.97
924+
Server: 100.83.73.97
925+
Address: 100.83.73.97#53
926+
927+
Non-authoritative answer:
928+
Name: srv.nb.test
929+
Address: 192.168.100.10
930+
kdn@brys-vm-nbt-ubuntu-01:~$ ip route show table all | grep 192.168.100
931+
192.168.100.10 dev wt0 table 7120
932+
kdn@brys-vm-nbt-ubuntu-01:~$ netbird networks ls
933+
Available Networks:
934+
935+
- ID: *.nb.test
936+
Domains: *.nb.test
937+
Status: Selected
938+
Resolved IPs:
939+
[srv.nb.test.]: 192.168.100.10
940+
```
941+
942+
### Verifying the Domain Resource registration with the Operating System
943+
944+
After we have confirmed **everything** is working within NetBird's scope of operation, let's restart NetBird and
945+
check whether the Operating System's default DNS resolver is resolving the Domain Resource correctly.
946+
947+
<Note>
948+
See [Debugging access to network resources > Public nameservers](#public-nameservers) for the equivalent
949+
MacOS and Windows debugging steps.
950+
</Note>
951+
952+
<Note>
953+
You might be surprised by a simple `netbird down` followed by `netbird up` not clearing the `Resolved IPs`:
954+
955+
```shell
956+
kdn@brys-vm-nbt-ubuntu-01:~$ sudo netbird down
957+
Disconnected
958+
kdn@brys-vm-nbt-ubuntu-01:~$ sudo netbird up
959+
Connected
960+
kdn@brys-vm-nbt-ubuntu-01:~$ netbird networks ls
961+
Available Networks:
962+
963+
- ID: *.nb.test
964+
Domains: *.nb.test
965+
Status: Selected
966+
Resolved IPs:
967+
[srv.nb.test.]: 192.168.100.10
968+
```
969+
970+
Don't be alarmed, this is working as expected (the results are simply stored within the client daemon's
971+
in-memory cache), but routing rules are still properly cleared:
972+
```shell
973+
kdn@brys-vm-nbt-ubuntu-01:~$ ip route show table all | grep 192.168.100
974+
kdn@brys-vm-nbt-ubuntu-01:~$
975+
```
976+
</Note>
977+
978+
We will start "from scratch", by restarting the whole NetBird service to purge all caches and proceed with the tests:
979+
980+
```shell
981+
kdn@brys-vm-nbt-ubuntu-01:~$ sudo netbird service restart
982+
NetBird service has been restarted
983+
kdn@brys-vm-nbt-ubuntu-01:~$ netbird networks ls
984+
Available Networks:
985+
986+
- ID: *.nb.test
987+
Domains: *.nb.test
988+
Status: Selected
989+
Resolved IPs: -
990+
kdn@brys-vm-nbt-ubuntu-01:~$ ip route show table all | grep 192.168.100
991+
kdn@brys-vm-nbt-ubuntu-01:~$ resolvectl query srv.nb.test
992+
srv.nb.test: 192.168.100.10 -- link: wt0
993+
994+
-- Information acquired via protocol DNS in 8.1ms.
995+
-- Data is authenticated: no; Data was acquired via local or encrypted transport: no
996+
-- Data from: network
997+
kdn@brys-vm-nbt-ubuntu-01:~$ ip route show table all | grep 192.168.100
998+
192.168.100.10 dev wt0 table 7120
999+
kdn@brys-vm-nbt-ubuntu-01:~$ netbird networks ls
1000+
Available Networks:
1001+
1002+
- ID: *.nb.test
1003+
Domains: *.nb.test
1004+
Status: Selected
1005+
Resolved IPs:
1006+
[srv.nb.test.]: 192.168.100.10
1007+
```
1008+
1009+
<Note>
1010+
Be aware that operating system resolver might not be the only source of domains, but querying through it is
1011+
a hard requirement for getting Domain Resources to start working.
1012+
1013+
Most notable
1014+
</Note>

0 commit comments

Comments
 (0)