nextdns / diag

Network diagnostic tool
MIT License
94 stars 17 forks source link

Add compatibility for Android #13

Open ghost opened 2 years ago

ghost commented 2 years ago

Could Android compatibility be added for this tool?

For the sake of curiosity, I ran this under an Android 11 environment via Termux and was given the following output:

$ sh -c 'sh -c "$(curl -s https://nextdns.io/diag)"'

Welcome to NextDNS network diagnostic tool.

This tool will download a small binary to capture latency and routing information
regarding the connectivity of your network with NextDNS. In order to perform a
traceroute, root permission is required. You may therefore be asked to provide
your password for sudo.

The source code of this tool is available at https://github.com/nextdns/diag

Do you want to continue? (press enter to accept)
sh: 26: cannot create /tmp/nextdns-diag-4822: Directory nonexistent
$
rs commented 2 years ago

Please test again.

ghost commented 2 years ago

Please test again.

$ sh -c 'sh -c "$(curl -s https://nextdns.io/diag)"'

Welcome to NextDNS network diagnostic tool.

This tool will download a small binary to capture latency and routing information
regarding the connectivity of your network with NextDNS. In order to perform a
traceroute, root permission is required. You may therefore be asked to provide
your password for sudo.

The source code of this tool is available at https://github.com/nextdns/diag

Do you want to continue? (press enter to accept)
mktemp: too few X's in template ‘nextdns-diag’
$
rs commented 2 years ago

Please try again

ghost commented 2 years ago

Please try again

This was performed without any filtering between the android device, and router (which is using NextDNS DoT).

$ sh -c 'sh -c "$(curl -s https://nextdns.io/diag)"'

Welcome to NextDNS network diagnostic tool.

This tool will download a small binary to capture latency and routing information
regarding the connectivity of your network with NextDNS. In order to perform a
traceroute, root permission is required. You may therefore be asked to provide
your password for sudo.

The source code of this tool is available at https://github.com/nextdns/diag

Do you want to continue? (press enter to accept)
Root required
Testing IPv6 connectivity
  available: true
Fetching https://test.nextdns.io
  Fetch error: Get "https://test.nextdns.io": dial tcp: lookup test.nextdns.io on [::1]:53: read udp [::1]:37434->[::1]:53: read: connection refused
Fetching PoP name for ultra low latency primary IPv4 (ipv4.dns1.nextdns.io)
Fetch error: Get "https://dns.nextdns.io/info": dial tcp: lookup ipv4.dns1.nextdns.io on [::1]:53: read udp [::1]:37803->[::1]:53: read: connection refused
Fetching PoP name for ultra low latency secondary IPv4 (ipv4.dns2.nextdns.io)
Fetch error: Get "https://dns.nextdns.io/info": dial tcp: lookup ipv4.dns2.nextdns.io on [::1]:53: read udp [::1]:46908->[::1]:53: read: connection refused
Fetching PoP name for anycast primary IPv4 (45.90.28.0)
  gsl-bne: 8.551ms
Fetching PoP name for anycast secondary IPv4 (45.90.30.0)
  zetta-per: 81.815ms
Fetching PoP name for ultra low latency primary IPv6 (ipv6.dns1.nextdns.io)
Fetch error: Get "https://dns.nextdns.io/info": dial tcp: lookup ipv6.dns1.nextdns.io on [::1]:53: read udp [::1]:45328->[::1]:53: read: connection refused
Fetching PoP name for ultra low latency secondary IPv6 (ipv6.dns2.nextdns.io)
Fetch error: Get "https://dns.nextdns.io/info": dial tcp: lookup ipv6.dns2.nextdns.io on [::1]:53: read udp [::1]:45326->[::1]:53: read: connection refused
Fetching PoP name for anycast primary IPv6 (2a07:a8c0::)
  gsl-mel: 36.342ms
Fetching PoP name for anycast secondary IPv6 (2a07:a8c1::)
  zetta-syd: 148.983ms
Pinging PoPs
  error: Get "https://router.nextdns.io/?limit=10&stack=dual": dial tcp: lookup router.nextdns.io on [::1]:53: read udp [::1]:48987->[::1]:53: read: connection refused
  Traceroute error: lookup ipv4.dns1.nextdns.io on [::1]:53: read udp [::1]:38482->[::1]:53: read: connection refused
  Traceroute error: lookup ipv4.dns2.nextdns.io on [::1]:53: read udp [::1]:39979->[::1]:53: read: connection refused
Traceroute for anycast primary IPv4 (45.90.28.0)
    1  192.168.178.1    1ms   1ms   1ms
    2    100.66.72.1    8ms   8ms   8ms
    3  87.121.75.253    8ms   8ms   7ms
    4  218.100.76.95    8ms   8ms   7ms
    5  103.137.13.16    8ms   8ms   8ms
    6     45.90.28.0    9ms   8ms   7ms
Traceroute for anycast secondary IPv4 (45.90.30.0)
    1  192.168.178.1    4ms   1ms   1ms
    2    100.66.72.1    8ms   7ms   7ms
    3  87.121.75.253    7ms   7ms  44ms
    4  218.100.76.32   13ms   9ms   8ms
    5 103.200.13.109   66ms  66ms  67ms
    6  103.200.13.66   67ms  68ms  67ms
    7 103.200.13.153   66ms  66ms  76ms
    8  27.122.123.21   66ms  66ms  66ms
    9   203.34.30.67   67ms  70ms  71ms
   10     45.90.30.0   66ms  67ms  69ms
  Traceroute error: lookup ipv6.dns1.nextdns.io on [::1]:53: read udp [::1]:49330->[::1]:53: read: connection refused
  Traceroute error: lookup ipv6.dns2.nextdns.io on [::1]:53: read udp [::1]:42122->[::1]:53: read: connection refused
Traceroute for anycast primary IPv6 (2a07:a8c0::)
    1 2404:e80:82f2:0:3631:c4ff:fe4f:aad2    5ms  12ms   1ms
    2 2404:e80:8002:653::    8ms  10ms   9ms
    3 2404:e80:8000::253    7ms   7ms   8ms
    4 2404:e80:8009::4   39ms  20ms  20ms
    5 2404:e80:4002:620::101   20ms  20ms  20ms
    6 2404:e80:6000:239::82   30ms  30ms  31ms
    7 2001:7fa:11:1:0:18c1:0:1   30ms  29ms  30ms
    8 2401:3cc0::4:3b   32ms  30ms  29ms
    9 2401:3cc0:200:7050::1   30ms  29ms  32ms
   10    2a07:a8c0::   31ms  29ms  29ms
Traceroute for anycast secondary IPv6 (2a07:a8c1::)
    1 2404:e80:82f2:0:3631:c4ff:fe4f:aad2    1ms   1ms   1ms
    2 2404:e80:8002:653::    9ms   8ms   8ms
    3 2404:e80:8000::253    8ms   7ms   8ms
    4 2001:7fa:11:2:0:9533:0:1    *     *    22ms
    5                   *     *     *
    6 2401:d000:10:100::2e2    *    40ms  20ms
    7 2401:d000:3401::c2  155ms 152ms 154ms
    8 2403:3400:7604:603::13  150ms 153ms 154ms
    9    2a07:a8c1::  150ms 153ms 150ms
Do you want to send this report? [Y/n]: y
Optional email in case we need additional info:
Post unsuccessful: Post "https://api.nextdns.io/diagnostic": dial tcp: lookup api.nextdns.io on [::1]:53: read udp [::1]:45352->[::1]:53: read: connection refused
Please report this issue on https://github.com/nextdns/diag
~ $

And again, over mobile connection with NextDNS DoH filtering via AdGuard for Android.



Welcome to NextDNS network diagnostic tool.

This tool will download a small binary to capture latency and routing information
regarding the connectivity of your network with NextDNS. In order to perform a
traceroute, root permission is required. You may therefore be asked to provide
your password for sudo.

The source code of this tool is available at https://github.com/nextdns/diag

Do you want to continue? (press enter to accept)
Root required
Testing IPv6 connectivity
  available: false
Fetching https://test.nextdns.io
  Fetch error: Get "https://test.nextdns.io": dial tcp: lookup test.nextdns.io on [::1]:53: read udp [::1]:41411->[::1]:53: read: connection refused
Fetching PoP name for ultra low latency primary IPv4 (ipv4.dns1.nextdns.io)
Fetch error: Get "https://dns.nextdns.io/info": dial tcp: lookup ipv4.dns1.nextdns.io on [::1]:53: read udp [::1]:48701->[::1]:53: read: connection refused
Fetching PoP name for ultra low latency secondary IPv4 (ipv4.dns2.nextdns.io)
Fetch error: Get "https://dns.nextdns.io/info": dial tcp: lookup ipv4.dns2.nextdns.io on [::1]:53: read udp [::1]:48885->[::1]:53: read: connection refused
Fetching PoP name for anycast primary IPv4 (45.90.28.0)
  gsl-syd: 50.062ms
Fetching PoP name for anycast secondary IPv4 (45.90.30.0)
  anexia-fra: 316.085ms
Pinging PoPs
  error: Get "https://router.nextdns.io/?limit=10&stack=dual": dial tcp: lookup router.nextdns.io on [::1]:53: read udp [::1]:49796->[::1]:53: read: connection refused
  Traceroute error: lookup ipv4.dns1.nextdns.io on [::1]:53: read udp [::1]:49395->[::1]:53: read: connection refused
  Traceroute error: lookup ipv4.dns2.nextdns.io on [::1]:53: read udp [::1]:39041->[::1]:53: read: connection refused
Traceroute for anycast primary IPv4 (45.90.28.0)
    1                   *     *     *
    2                   *     *     *
    3                   *     *     *
    4                   *     *     *
    5                   *     *     *
    6                   *     *     *
    7                   *     *     *
    8                   *     *     *
    9                   *     *     *
   10                   *     *     *
   11                   *     *     *
   12                   *     *     *
   13                   *     *     *
   14                   *     *     *
   15                   *     *     *
   16                   *     *     *
   17                   *     *     *
   18                   *     *     *
   19                   *     *     *
   20                   *     *     *
Traceroute for anycast secondary IPv4 (45.90.30.0)
    1                   *     *     *
    2                   *     *     *
    3                   *     *     *
    4                   *     *     *
    5                   *     *     *
    6                   *     *     *
    7                   *     *     *
    8                   *     *     *
    9                   *     *     *
   10                   *     *     *
   11                   *     *     *
   12                   *     *     *
   13                   *     *     *
   14                   *     *     *
   15                   *     *     *
   16                   *     *     *
   17                   *     *     *
   18                   *     *     *
   19                   *     *     *
   20                   *     *     *
Do you want to send this report? [Y/n]: Optional email in case we need additional info: y
Post unsuccessful: Post "https://api.nextdns.io/diagnostic": dial tcp: lookup api.nextdns.io on [::1]:53: read udp [::1]:45093->[::1]:53: read: connection refused
Please report this issue on https://github.com/nextdns/diag
~ $```
rs commented 2 years ago

Are you running nextdns or another form of local dns proxy? Please try again without if any.

ghost commented 2 years ago

Are you running nextdns or another form of local dns proxy? Please try again without if any.

AdGuard was not running as a local DNS proxy, it was running as a local VPN. I turned off AdGuard and ran the rest using native DoT with NextDNS as the endpoint on a mobile connection, and got this result.

To clarify, there is no changes to the default Mobile network settings other than setting native Android DNS to the NextDNS endpoint (DoT).



Welcome to NextDNS network diagnostic tool.

This tool will download a small binary to capture latency and routing information
regarding the connectivity of your network with NextDNS. In order to perform a
traceroute, root permission is required. You may therefore be asked to provide
your password for sudo.

The source code of this tool is available at https://github.com/nextdns/diag

Do you want to continue? (press enter to accept)
Root required
Testing IPv6 connectivity
  available: false
Fetching https://test.nextdns.io
  Fetch error: Get "https://test.nextdns.io": dial tcp: lookup test.nextdns.io on [::1]:53: read udp [::1]:42822->[::1]:53: read: connection refused
Fetching PoP name for ultra low latency primary IPv4 (ipv4.dns1.nextdns.io)
Fetch error: Get "https://dns.nextdns.io/info": dial tcp: lookup ipv4.dns1.nextdns.io on [::1]:53: read udp [::1]:41248->[::1]:53: read: connection refused
Fetching PoP name for ultra low latency secondary IPv4 (ipv4.dns2.nextdns.io)
Fetch error: Get "https://dns.nextdns.io/info": dial tcp: lookup ipv4.dns2.nextdns.io on [::1]:53: read udp [::1]:38569->[::1]:53: read: connection refused
Fetching PoP name for anycast primary IPv4 (45.90.28.0)
  gsl-syd: 42.083ms
Fetching PoP name for anycast secondary IPv4 (45.90.30.0)
  anexia-fra: 338.06ms
Pinging PoPs
  error: Get "https://router.nextdns.io/?limit=10&stack=dual": dial tcp: lookup router.nextdns.io on [::1]:53: read udp [::1]:46827->[::1]:53: read: connection refused
  Traceroute error: lookup ipv4.dns1.nextdns.io on [::1]:53: read udp [::1]:45939->[::1]:53: read: connection refused
  Traceroute error: lookup ipv4.dns2.nextdns.io on [::1]:53: read udp [::1]:37428->[::1]:53: read: connection refused
Traceroute for anycast primary IPv4 (45.90.28.0)
    1                   *     *     *
    2                   *     *     *
    3 139.130.167.117   67ms  26ms  23ms
    4  203.50.11.240   24ms  28ms  29ms
    5  203.50.11.143   28ms  18ms  30ms
    6  165.228.23.18   26ms  26ms  28ms
    7   202.10.14.38   34ms  36ms  39ms
    8  202.10.12.145   55ms 222ms 239ms
    9   202.10.12.21   33ms  43ms  46ms
   10   202.10.10.69   40ms  42ms  38ms
   11    202.10.12.8   40ms  37ms  45ms
   12    202.10.12.9   38ms  46ms  49ms
   13  203.131.60.89   40ms  36ms  35ms
   14    210.87.35.6   49ms  38ms  45ms
   15  31.217.251.95   48ms  38ms  40ms
   16  31.217.251.91   34ms  40ms  39ms
   17 31.217.251.102   39ms  38ms  42ms
   18 103.137.13.225   51ms  38ms  38ms
   19                   *     *     *
   20     45.90.28.0   59ms  39ms  40ms
Traceroute for anycast secondary IPv4 (45.90.30.0)
    1                   *     *     *
    2                   *     *     *
    3 139.130.167.117   29ms  17ms  21ms
    4  203.50.11.240   22ms  27ms  21ms
    5  203.50.11.178   33ms  49ms  48ms
    6    203.50.6.61   41ms  40ms  40ms
    7   203.50.13.90   50ms  37ms  41ms
    8   203.50.13.90  181ms 246ms 234ms
    9  202.84.141.25  240ms 244ms 235ms
   10  202.84.141.25  237ms 249ms 235ms
   11  202.40.148.98  246ms 255ms 301ms
   12 202.84.249.173  312ms 320ms 319ms
   13  202.84.178.54  320ms 319ms 320ms
   14                   *     *     *
   15 144.208.208.143  426ms 327ms 396ms
   16     45.90.30.0  315ms 407ms 399ms
Do you want to send this report? [Y/n]: y
Optional email in case we need additional info:
Post unsuccessful: Post "https://api.nextdns.io/diagnostic": dial tcp: lookup api.nextdns.io on [::1]:53: read udp [::1]:48645->[::1]:53: read: connection refused
Please report this issue on https://github.com/nextdns/diag```
rs commented 2 years ago

An without DoT or any other non basic DNS settings? Seems like go think your resolver is localhost but nothing answers in port 53. Could be a behavior triggered by dns encryption or dns software or vpn.

ghost commented 2 years ago

An without DoT or any other non basic DNS settings? Seems like go think your resolver is localhost but nothing answers in port 53. Could be a behavior triggered by dns encryption or dns software or vpn.

Absolutely everything has been turned off, the device is now running on a raw mobile connection. For clarity, all tests seem to have had the same result for the Android device.



Welcome to NextDNS network diagnostic tool.

This tool will download a small binary to capture latency and routing information
regarding the connectivity of your network with NextDNS. In order to perform a
traceroute, root permission is required. You may therefore be asked to provide
your password for sudo.

The source code of this tool is available at https://github.com/nextdns/diag

Do you want to continue? (press enter to accept)
Root required
Testing IPv6 connectivity
  available: false
Fetching https://test.nextdns.io
  Fetch error: Get "https://test.nextdns.io": dial tcp: lookup test.nextdns.io on [::1]:53: read udp [::1]:43694->[::1]:53: read: connection refused
Fetching PoP name for ultra low latency primary IPv4 (ipv4.dns1.nextdns.io)
Fetch error: Get "https://dns.nextdns.io/info": dial tcp: lookup ipv4.dns1.nextdns.io on [::1]:53: read udp [::1]:37872->[::1]:53: read: connection refused
Fetching PoP name for ultra low latency secondary IPv4 (ipv4.dns2.nextdns.io)
Fetch error: Get "https://dns.nextdns.io/info": dial tcp: lookup ipv4.dns2.nextdns.io on [::1]:53: read udp [::1]:49540->[::1]:53: read: connection refused
Fetching PoP name for anycast primary IPv4 (45.90.28.0)
  gsl-syd: 61.641ms
Fetching PoP name for anycast secondary IPv4 (45.90.30.0)
  anexia-fra: 392.164ms
Pinging PoPs
  error: Get "https://router.nextdns.io/?limit=10&stack=dual": dial tcp: lookup router.nextdns.io on [::1]:53: read udp [::1]:40885->[::1]:53: read: connection refused
  Traceroute error: lookup ipv4.dns1.nextdns.io on [::1]:53: read udp [::1]:39047->[::1]:53: read: connection refused
  Traceroute error: lookup ipv4.dns2.nextdns.io on [::1]:53: read udp [::1]:47433->[::1]:53: read: connection refused
Traceroute for anycast primary IPv4 (45.90.28.0)
    1                   *     *     *
    2                   *     *     *
    3 139.130.167.117   39ms  46ms  32ms
    4  203.50.11.240   30ms  33ms  45ms
    5  203.50.11.143   39ms  53ms  47ms
    6  165.228.23.18   30ms  32ms  18ms
    7   202.10.14.40   41ms  38ms  56ms
    8   202.10.12.21   61ms  66ms  37ms
    9   202.10.10.69   48ms  52ms  46ms
   10    202.10.12.2   50ms  40ms  40ms
   11    202.10.12.3   40ms  47ms  50ms
   12  203.131.60.89   50ms  36ms  49ms
   13    210.87.35.6   62ms  41ms  40ms
   14  31.217.251.95   52ms  54ms  63ms
   15  31.217.251.91   47ms  40ms  48ms
   16 31.217.251.102   48ms  53ms  41ms
   17 103.137.13.225   49ms  62ms  56ms
   18                   *     *     *
   19     45.90.28.0   86ms  39ms  47ms
Traceroute for anycast secondary IPv4 (45.90.30.0)
    1                   *     *     *
    2                   *     *     *
    3 139.130.167.117   57ms  42ms  38ms
    4  203.50.11.240   37ms  44ms  31ms
    5  203.50.11.178   50ms  51ms  54ms
    6    203.50.6.61   53ms  54ms  53ms
    7   203.50.13.90   42ms  46ms  49ms
    8   203.50.13.90  257ms 236ms 241ms
    9  202.84.141.25  247ms 232ms 238ms
   10  202.84.141.25  252ms 306ms 250ms
   11  202.40.148.98  238ms 321ms 309ms
   12 202.84.249.173  323ms 323ms 317ms
   13  202.84.178.54  331ms 310ms 328ms
   14                   *     *     *
   15 144.208.208.156  346ms 383ms 399ms
   16     45.90.30.0  329ms 396ms 394ms
Do you want to send this report? [Y/n]: y
Optional email in case we need additional info:
Post unsuccessful: Post "https://api.nextdns.io/diagnostic": dial tcp: lookup api.nextdns.io on [::1]:53: read udp [::1]:49909->[::1]:53: read: connection refused
Please report this issue on https://github.com/nextdns/diag
~ $```
ghost commented 2 years ago

This may very well have something to do with it.

https://stackoverflow.com/questions/38959067/dns-lookup-issue-when-running-my-go-app-in-termux

rs commented 2 years ago

Yes it is, but then there is no automated way to run this diag, as forcing 8.8.8.8 will give a false picture as it is probably not the name server used by the OS.

marcineq commented 2 years ago

It seems that your recent change introducing mktemp call in run.sh caused a regression on Edge routers: `Welcome to NextDNS network diagnostic tool.

This tool will download a small binary to capture latency and routing information regarding the connectivity of your network with NextDNS. In order to perform a traceroute, root permission is required. You may therefore be asked to provide your password for sudo.

The source code of this tool is available at https://github.com/nextdns/diag

Do you want to continue? (press enter to accept) mktemp: Invalid argument`

On Edgerouter OS mktemp argument must have following form: TEMPLATE must end with XXXXXX

rs commented 2 years ago

Thanks for the heads up, please check again.

marcineq commented 2 years ago

Thanks for the heads up, please check again.

It works now, thanks.