DNS Ping: to check packet loss and latency issues with DNS servers

Overview

DNSping

PkgGoDev Go Report Card Docker Build Docker Pulls

DNS Ping checks packet loss and latency issues with DNS servers

Installation

If you have golang, easiest install is go get -u fortio.org/dnsping

Or with docker docker run fortio/dnsping ...

Or brew custom tap source build brew install fortio/dnsping/dnsping (please star the project so it can go in core and get binary bottles built)

Otherwise head over to https://github.com/fortio/dnsping/releases for binary releases

Usage:

dnsping [flags] query server

$ dnsping -h
dnsping v1.1.0 usage:
	dnsping [flags] query server
eg:	dnsping www.google.com. 127.0.0.1
with flags:
  -c requests
    	How many requests to make. Default is to run until ^C
  -fixed-id int
    	Non 0 id to use instead of random or sequential
  -i wait
    	How long to wait between requests (default 1s)
  -json path
    	Json output to provided file path or '-' for stdout (empty = no json output)
  -loglevel value
    	loglevel, one of [Debug Verbose Info Warning Error Critical Fatal] (default Info)
  -no-recursion
    	Pass to disable (default) recursion.
  -p Port
    	Port to connect to (default 53)
  -q type
    	Query type to use (A, AAAA, SOA, CNAME...) (default "A")
  -sequential-id
    	Use sequential ids instead of random.
  -t Timeout
    	Timeout for each query (default 700ms)
  -v	Display version and exit.

Sample run

dnsping -fixed-id 42 -json sampleResult.json -c 8  www.google.com 8.8.4.4
16:08:03 I Will query 8 times, sleeping 1s in between, the server 8.8.4.4:53 for A (1) record for www.google.com.
16:08:03 I   8.7 ms   1: [www.google.com.	298	IN	A	172.217.6.68]
16:08:04 I  16.5 ms   2: [www.google.com.	229	IN	A	172.217.6.36]
16:08:05 I  14.1 ms   3: [www.google.com.	179	IN	A	216.58.194.196]
16:08:06 E 700.3 ms   4: failed call: read udp 10.10.50.62:65456->8.8.4.4:53: i/o timeout
16:08:07 I  15.0 ms   5: [www.google.com.	195	IN	A	216.58.194.196]
16:08:08 I  13.5 ms   6: [www.google.com.	196	IN	A	216.58.194.196]
16:08:09 I  14.8 ms   7: [www.google.com.	179	IN	A	216.58.194.196]
16:08:10 I  15.5 ms   8: [www.google.com.	285	IN	A	172.217.6.68]
1 error (12.50%), 7 success.
response time (in ms) : count 8 avg 99.792926 +/- 227 min 8.684216 max 700.257965 sum 798.343406
# range, mid point, percentile, count
>= 8.68422 <= 9 , 8.84211 , 12.50, 1
> 12 <= 14 , 13 , 25.00, 1
> 14 <= 16 , 15 , 75.00, 4
> 16 <= 18 , 17 , 87.50, 1
> 500 <= 700.258 , 600.129 , 100.00, 1
# target 50% 15
# target 90% 540.052
# target 99% 684.237
Successfully wrote 1212 bytes of Json data to sampleResult.json

Which also produces the json:

{
  "Config": {
    "Server": "8.8.4.4:53",
    "Query": "www.google.com.",
    "HowMany": 8,
    "Interval": 1000000000,
    "Timeout": 700000000,
    "FixedID": 42,
    "QueryType": 1,
    "SequentialIDs": false,
    "Recursion": true
  },
  "Errors": 1,
  "Success": 7,
  "Stats": {
    "Count": 8,
    "Min": 8.684216,
    "Max": 700.257965,
    "Sum": 798.3434060000001,
    "Avg": 99.79292575000001,
    "StdDev": 226.96508473843934,
    "Data": [
      {
        "Start": 8.684216,
        "End": 9,
        "Percent": 12.5,
        "Count": 1
      },
      {
        "Start": 12,
        "End": 14,
        "Percent": 25,
        "Count": 1
      },
      {
        "Start": 14,
        "End": 16,
        "Percent": 75,
        "Count": 4
      },
      {
        "Start": 16,
        "End": 18,
        "Percent": 87.5,
        "Count": 1
      },
      {
        "Start": 500,
        "End": 700.257965,
        "Percent": 100,
        "Count": 1
      }
    ],
    "Percentiles": [
      {
        "Percentile": 50,
        "Value": 15
      },
      {
        "Percentile": 90,
        "Value": 540.051593
      },
      {
        "Percentile": 99,
        "Value": 684.2373278
      }
    ]
  }
}

Made thanks to https://github.com/miekg/dns (and https://github.com/fortio/fortio stats and logger)

Comments
  • IPv6 as Server does not work: dnsping -c 42  -fixed-id 42 -json sampleResult.json -c 8 www.google.com 2001:4860:4860::8888

    IPv6 as Server does not work: dnsping -c 42 -fixed-id 42 -json sampleResult.json -c 8 www.google.com 2001:4860:4860::8888

    Ipv4 is working but Ipv6 dns server not

    dnsping -c 42  -fixed-id 42 -json sampleResult.json -c 8 www.google.com 2001:4860:4860::8888
    19:11:06 I dnsping dev: will query 8 times, sleeping 1s in between, the server 2001:4860:4860::8888:53 for A (1) record for www.google.com.
    19:11:06 E   0.0 ms   1: failed call: dial udp: address 2001:4860:4860::8888:53: too many colons in address
    19:11:07 E   0.0 ms   2: failed call: dial udp: address 2001:4860:4860::8888:53: too many colons in address
    19:11:08 E   0.0 ms   3: failed call: dial udp: address 2001:4860:4860::8888:53: too many colons in address
    19:11:09 E   0.0 ms   4: failed call: dial udp: address 2001:4860:4860::8888:53: too many colons in address
    19:11:10 E   0.0 ms   5: failed call: dial udp: address 2001:4860:4860::8888:53: too many colons in address
    19:11:11 E   0.0 ms   6: failed call: dial udp: address 2001:4860:4860::8888:53: too many colons in address
    19:11:12 E   0.0 ms   7: failed call: dial udp: address 2001:4860:4860::8888:53: too many colons in address
    19:11:13 E   0.0 ms   8: failed call: dial udp: address 2001:4860:4860::8888:53: too many colons in address
    8 errors (100.00%), 0 success.
    response time (in ms) : count 8 avg 0 +/- 0 min 0 max 0 sum 0
    # range, mid point, percentile, count
    >= 0 <= 0 , 0 , 100.00, 8
    # target 50% 0
    # target 90% 0
    # target 99% 0
    Successfully wrote 724 bytes of Json data to sampleResult.json
    
    
    dnsping -c 42  -fixed-id 42 -json sampleResult.json -c 8 www.google.com 8.8.8.8
    19:12:14 I dnsping dev: will query 8 times, sleeping 1s in between, the server 8.8.8.8:53 for A (1) record for www.google.com.
    19:12:14 I  15.6 ms   1: [www.google.com.       184     IN      A       172.217.19.100]
    19:12:15 I  15.9 ms   2: [www.google.com.       184     IN      A       172.217.16.100]
    19:12:16 I  15.7 ms   3: [www.google.com.       249     IN      A       216.58.214.196]
    19:12:17 I  16.8 ms   4: [www.google.com.       182     IN      A       172.217.20.4]
    19:12:18 I  15.8 ms   5: [www.google.com.       180     IN      A       172.217.19.100]
    19:12:19 I  16.5 ms   6: [www.google.com.       182     IN      A       172.217.19.100]
    19:12:20 I  15.8 ms   7: [www.google.com.       261     IN      A       172.217.20.4]
    19:12:21 I  15.7 ms   8: [www.google.com.       177     IN      A       172.217.16.100]
    0 errors (0.00%), 8 success.
    response time (in ms) : count 8 avg 16.006315 +/- 0.4021 min 15.639415999999999 max 16.832446 sum 128.050519
    # range, mid point, percentile, count
    >= 15.6394 <= 16 , 15.8197 , 75.00, 6
    > 16 <= 16.8324 , 16.4162 , 100.00, 2
    # target 50% 15.8558
    # target 90% 16.4995
    # target 99% 16.7991
    Successfully wrote 939 bytes of Json data to sampleResult.json
    
    opened by grzchr15 4
  • Bump fortio.org/fortio from 1.32.3 to 1.38.2

    Bump fortio.org/fortio from 1.32.3 to 1.38.2

    Bumps fortio.org/fortio from 1.32.3 to 1.38.2.

    Release notes

    Sourced from fortio.org/fortio's releases.

    Fortio 1.38.2

    What's Changed

    fortio/fortio#634

    • New api jrpc.GetArray for endpoints returning JSON arrays to be put in golang slices.
    • Tests for slice/array returned from jrpc calls

    Full Changelog: https://github.com/fortio/fortio/compare/v1.38.1...v1.38.2

    Fortio 1.38.1

    What's Changed

    • Dependencies / security updates
      • Build with go1.19.2 - new linters changes/fixes (fortio/fortio#630)
      • Dependabot updates

    Full Changelog: https://github.com/fortio/fortio/compare/v1.38.0...v1.38.1

    Fortio 1.38.0

    What's Changed

    • Added connection times histogram to see cost of establishing connection vs rest of roundtrip; most meaningful in conjunction with a low -connection-reuse (fortio/fortio#626)
    • fortio/fortio#625
      • Enable delay=,close= and header= query args for the /debug endpoint
      • Only do compression if requested explicitly when forwarding/fetching (fixes fortio/fortio#624)
      • Fix a data race

    Full Changelog: https://github.com/fortio/fortio/compare/v1.37.1...v1.38.0

    Fortio 1.37.1

    What's Changed

    • jrpc library: allow empty body to be valid for jrpc.HandleCall/Deserialize; allow method override in client from GET when no payload present and POST when there is a body, allows to POST even with no body or use PUT, DELETE etc... (fortio/fortio#623)

    Full Changelog: https://github.com/fortio/fortio/compare/v1.37.0...v1.37.1

    Fortio 1.37.0

    What's Changed

    Fortio jrpc Json Rest/Remote Calls package api improvement (fortio/fortio#622):

    Better names for CallNoPayload -> Get and CallWithPayload -> Fetch

    if you used jrpc.Fetch from fortio 1.36, use jrpc.FetchBytes now

    Full Changelog: https://github.com/fortio/fortio/compare/v1.36.0...v1.37.0

    Fortio 1.36.0

    What's Changed

    ... (truncated)

    Commits
    • d2a2d42 Tests for slice/array returned from jrpc calls as well as a cleaner shortcut:...
    • fbcebcb build with go1.19.2 - new linters changes/fixes - dep updates, incl. security...
    • 0d100a6 Bump google.golang.org/grpc from 1.49.0 to 1.50.0 (#628)
    • d8d32f2 Bump github.com/fsnotify/fsnotify from 1.5.4 to 1.6.0 (#629)
    • c9eaf5e only do compression if requested explictly when forwarding/fetching (#625)
    • c72b231 add connection times histogram (#626)
    • 0fa8982 Allow empty body to be valid for jrpc.HandleCall/Deserialize; allow method ov...
    • 0d61b4f Better names for CallNoPayload -> Get and CallWithPayload -> Fetch (#622)
    • 83ce661 support passing headers and timeout in jrpc calls (#621)
    • cbf33f7 moved testify compatible code to its own package so it can be reused (#620)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Bump github.com/miekg/dns from 1.1.49 to 1.1.50

    Bump github.com/miekg/dns from 1.1.49 to 1.1.50

    Bumps github.com/miekg/dns from 1.1.49 to 1.1.50.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • many improvements:

    many improvements:

    • shorter/better log output (without debug file/linenumber...)
    • show valid query types and accept them in lower case, use -q for query like nslookup so -t can be used for timeout
    • new -t timeout, lowered default to 700ms from 2s (so errors can be caught up and still do the default 1 ping per second even if continuously erring out)
    • use the lib client to be able to set timeout and get rtt from there
    • refactor shared format string between good and error cases
    • auto add missing trailing . to query (fully qualified domains, no search)
    opened by ldemailly 1
  • Bump fortio.org/fortio from 1.38.2 to 1.38.4

    Bump fortio.org/fortio from 1.38.2 to 1.38.4

    Bumps fortio.org/fortio from 1.38.2 to 1.38.4.

    Release notes

    Sourced from fortio.org/fortio's releases.

    Fortio 1.38.4

    What's Changed

    fortio/fortio#654

    • Fixed bug with not detecting extra arguments for fortio server (so for instance fortio server loglevel verbose wasn't erroring out despite missing - (#652)
    • Fixed bug where network or other early errors in fortio curl (or fcurl) wouldn't yield exit 1 status code (#653)
    • Added tests for the above
    • Bumped some go package dependencies

    Full Changelog: https://github.com/fortio/fortio/compare/v1.38.3...v1.38.4

    Fortio 1.38.3

    What's Changed

    • You can now override the default User-Agent or even delete it by passing -H user-agent: - also fixed proxy related issues with std go client tendency to add it's own User-Agent: when absent from the request. fortio/fortio#649
    • Resurrected the dockerhub autobuild of fortio/fortio.fcurl and fortio.echosrv smaller images.
    • Bump build image (go 1.19.3), added govulncheck, fix permissions in /go - also stop using /go/src in ci/dockerfiles - fortio/fortio#641
    • Updates to a lot of github actions, pinning updates, eliminate most CI warnings. fortio/fortio#647 + dependabot updates.

    Full Changelog: https://github.com/fortio/fortio/compare/v1.38.2...v1.38.3

    Commits
    • 860b2f9 added test for #652, stepped on #653 while testing the test, added test for t...
    • 08dd2ac support User-Agent change and deletion from -H, simplify UI for headers (#649)
    • 224f9c7 codeql v2 and a lot of github actions update, sha pinning in dockerfile etc (...
    • 9f500ab Bump docker/setup-buildx-action from 1.7.0 to 2.2.1 (#646)
    • 3b6e76a Bump docker/setup-qemu-action from 1.2.0 to 2.1.0 (#645)
    • 4783f61 Bump docker/login-action from 1.10.0 to 2.1.0 (#644)
    • 2d145c5 Bump docker/build-push-action from 2.5.0 to 3.2.0 (#643)
    • 7bd4442 bump build image (go 1.19.3), added govulncheck, fix permissions in /go - als...
    • 1b84463 README formatting and links correction (#636)
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
Releases(v1.2.9)
Owner
Fortio (Φορτίο)
Load testing, client/server, graphing and statistics: golang library and command line tools.
Fortio (Φορτίο)
Prometheus exporter for ping metrics such as RTT, packet loss, and jitter to any number of hosts.

ping_exporter Command ping_exporter provides a Prometheus exporter for ping metrics such as RTT, packet loss, and jitter to any number of hosts. Usage

Beard Slayer 7 Sep 24, 2022
C-ping is a very simple and small ping tool that sends ICMP Echo datagram to a host.

C-ping is a very simple and small ping tool that sends ICMP Echo datagram to a host.

Chen Chen 4 Aug 9, 2022
Cross check makes health checks on PostgreSQL and MySQL database servers

Cross Check Cross check makes health checks on PostgreSQL and MySQL database servers, it also performs master & slave control for clusters in H/A Acti

Ali 2 Jan 14, 2022
Capture packet request/response pairs for a port and/or IP to aid in Network protocol based Nuclei Templates creation.

network-fingerprint Capture packet request/response pairs for a port and/or IP to aid in Network protocol based Nuclei Templates creation. Resources I

ProjectDiscovery 45 Nov 15, 2022
Hetzner-dns-updater - A simple tool to update a DNS record via Hetzner DNS API. Used for simple HA together with Nomad

hetzner-dns-updater A small utility tool to update a single record via Hetzner D

Patrick Pacher 0 Feb 12, 2022
Provides packet processing capabilities for Go

GoPacket This library provides packet decoding capabilities for Go. See godoc for more details. Minimum Go version required is 1.5 except for pcapgo/E

Google 5.3k Dec 29, 2022
Packet Sniffer in golang

WirePenguin ?? A CLI Packet Sniffer in golang using Cobra and Gopacket packages much much simpler than WireShark =) You can capture packets both live

Mohammad ebrahim Adibzadeh 33 Dec 13, 2022
Tiny packet forwarder for golang

Tiny Packet Forwarder Usually, I use iptables on Linux to do forward. i encounter some problems sometime, for example: RDP disconnect immediately afte

null 8 Dec 15, 2022
Netkit - A type parameter(generics) net kit, support tcp kcp, customize packet

Netkit Netkit is a type parameter(generics) golang package Get Started Need Go i

null 1 Jan 12, 2022
`kawipiko` -- blazingly fast static HTTP server -- focused on low latency and high concurrency, by leveraging Go, `fasthttp` and the CDB embedded database

kawipiko -- blazingly fast static HTTP server kawipiko is a lightweight static HTTP server written in Go; focused on serving static content as fast an

Volution 318 Jan 3, 2023
Check DNS and optionally Consul and serve the status from a Web page

dns-checker Table of contents Preamble Compiling the program Keepalived and LVS Available options Setting up systemd Preamble This application checks

Massimiliano Adamo 0 Nov 7, 2021
Hedged Go GRPC client which helps to reduce tail latency at scale.

hedgedgrpc Hedged Go GRPC client which helps to reduce tail latency at scale. Rationale See paper Tail at Scale by Jeffrey Dean, Luiz André Barroso. I

cristaltech 5 Dec 16, 2022
PinGo is a standalone and feature-rich tool for common IP-based reachability checking tasks. Ping or Trace and Observe in real-time the statistics.

pingo As a network champion from designing and implementing to troubleshooting large scale networks - I know that is usually not easy for administrato

Jerome Amon 3 Sep 26, 2022
gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code

gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code

frenchy77 0 Jan 24, 2022
Implementation of Minecraft protocols : ping, query and icon.

mcutils - Implementation of Minecraft protocols in Go Informations General All protocols are implemented in Go, without any external dependency. All p

null 13 Dec 19, 2022
ping 和 http get 请求探测 适配 nightingale

n9e-probe 功能 ping 和 http get 请求探测 适配 nightingale 指标 ping metric 说明 ping.latency ping 请求的延迟,单位是毫秒。-1 表示 ping 不通 tag 说明 ip 探测的目标 ip region 如果配置了,则插入 reg

Shanghai Edu 25 Sep 27, 2022
🚥 Yet another pinger: A high-performance ICMP ping implementation build on top of BPF technology.

yap Yet-Another-Pinger: A high-performance ICMP ping implementation build on top of BPF technology. yap uses the gopacket library to receive and handl

dongdong 44 Nov 9, 2022
[FORK] ICMP Ping library for Go

forked from go-ping/ping go get -u github.com/gandaldf/ping go-ping A simple but powerful ICMP echo (ping) library for Go, inspired by go-fastping. He

Diego Parisi 0 Oct 21, 2021
Ping library for Golang with multi-host support

pingo Fast and lightweight ping library for Golang with multi-host support. Features ICMP sockets: UDP port 0 means "let the kernel pick a free number

Arseny Mitin 36 Nov 9, 2022