Tag: DNS Diagnostics

  • dnsdiag: DNS Diagnostics and Performance Measurement Tools

    DNS Diagnostics and Performance Measurement Tools

    Ever been wondering if your ISP is hijacking your DNS traffic? Ever observed any misbehavior with your DNS responses? Ever been redirected to wrong address and suspected something is wrong with your DNS? Here we have a set of tools to perform basic audits on your DNS requests and responses to make sure your DNS is working as you expect.

    You can measure the response time of any given DNS server for arbitrary requests using dnsping. Just like traditional ping utility, it gives you similar functionality for DNS requests.

    You can also trace the path your DNS request takes to destination to make sure it is not being redirected or hijacked. This can be done by comparing different DNS queries being sent to the same DNS server using dnstraceroute and observe if there is any difference between the path.

    dnseval evaluates multiple DNS resolvers and helps you choose the best DNS server for your network. While it is highly recommended using your own DNS resolver and never trust any third-party DNS server, but in case you need to choose the best DNS forwarder for your network, dnseval lets you compare different DNS servers from performance (latency) and reliability (loss) point of view.

    DNS Diagnostics

    Installation

    From source code

    git clone https://github.com/farrokhi/dnsdiag.git
    cd dnsdiag
    pip3 install -r requirements.txt

    using pip

    pip3 install dnsdiag

    From Binary

    https://github.com/farrokhi/dnsdiag/releases

    Usage

    dnsping

    dnsping pings a DNS resolver by sending an arbitrary DNS query for given number of times:

    [pastacode lang=”markup” message=”” highlight=”” provider=”manual” manual=”%25%20.%2Fdnsping.py%20-c%203%20-t%20AAAA%20-s%208.8.8.8%20dnsdiag.org%0Adnsping.py%20DNS%3A%208.8.8.8%3A53%2C%20hostname%3A%20dnsdiag.org%2C%20rdatatype%3A%20AAAA%0A4%20bytes%20from%208.8.8.8%3A%20seq%3D0%20%20%20time%3D123.509%20ms%0A4%20bytes%20from%208.8.8.8%3A%20seq%3D1%20%20%20time%3D115.726%20ms%0A4%20bytes%20from%208.8.8.8%3A%20seq%3D2%20%20%20time%3D117.351%20ms%0A%0A—%208.8.8.8%20dnsping%20statistics%20—%0A3%20requests%20transmitted%2C%203%20responses%20received%2C%20%20%200%25%20lost%0Amin%3D115.726%20ms%2C%20avg%3D118.862%20ms%2C%20max%3D123.509%20ms%2C%20stddev%3D4.105%20ms”/]

    This script calculates minimum, maximum and average response time as well as jitter (stddev)

    dnstraceroute

    dnstraceroute is a traceroute utility to figure out the path that your DNS request is passing through to get to its destination. You may want to compare it to your actual network traceroute and make sure your DNS traffic is not routed to any unwanted path.

    [pastacode lang=”markup” message=”” highlight=”” provider=”manual” manual=”%25%20.%2Fdnstraceroute.py%20–expert%20-C%20-t%20A%20-s%208.8.4.4%20facebook.com%0Adnstraceroute.py%20DNS%3A%208.8.4.4%3A53%2C%20hostname%3A%20facebook.com%2C%20rdatatype%3A%20A%0A1%09192.168.0.1%20(192.168.0.1)%201%20ms%0A2%09192.168.28.177%20(192.168.28.177)%204%20ms%0A3%09192.168.0.1%20(192.168.0.1)%20693%20ms%0A4%09172.19.4.17%20(172.19.4.17)%203%20ms%0A5%09google-public-dns-b.google.com%20(8.8.4.4)%208%20ms%0A%0A%3D%3D%3D%20Expert%20Hints%20%3D%3D%3D%0A%20%5B*%5D%20public%20DNS%20server%20is%20next%20to%20a%20private%20IP%20address%20(possible%20hijacking)”/]

    Using --expert will instruct dnstraceroute to print expert hints (such as warnings of possible DNS traffic hijacking).

    dnseval

    dnseval is a bulk ping utility that sends an arbitrary DNS query to a give list of DNS servers. This script is meant for comparing response time of multiple DNS servers at once:

    [pastacode lang=”markup” message=”” highlight=”” provider=”manual” manual=”%25%20.%2Fdnseval.py%20-t%20AAAA%20-f%20public-v4.txt%20-c10%20yahoo.com%0Aserver%20%20%20%20%20%20%20%20%20%20%20avg(ms)%20%20%20%20%20min(ms)%20%20%20%20%20max(ms)%20%20%20%20%20stddev(ms)%20%20lost(%25)%20%20ttl%20%20%20%20%20flags%0A——————————————————————————————————%0A8.8.8.8%20%20%20%20%20%20%20%20%20%20270.791%20%20%20%20%20215.599%20%20%20%20%20307.498%20%20%20%20%2040.630%20%20%20%20%20%20%250%20%20%20%20%20%20%20298%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0A8.8.4.4%20%20%20%20%20%20%20%20%20%20222.955%20%20%20%20%20171.753%20%20%20%20%20307.251%20%20%20%20%2060.481%20%20%20%20%20%20%2510%20%20%20%20%20%20291%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0Ans.ripe.net%20%20%20%20%20%20174.855%20%20%20%20%20160.949%20%20%20%20%20187.458%20%20%20%20%2010.099%20%20%20%20%20%20%250%20%20%20%20%20%20%20289%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0A4.2.2.1%20%20%20%20%20%20%20%20%20%20172.798%20%20%20%20%20163.892%20%20%20%20%20189.918%20%20%20%20%207.823%20%20%20%20%20%20%20%250%20%20%20%20%20%20%20287%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0A4.2.2.2%20%20%20%20%20%20%20%20%20%20178.594%20%20%20%20%20169.158%20%20%20%20%20184.696%20%20%20%20%205.067%20%20%20%20%20%20%20%250%20%20%20%20%20%20%20285%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0A4.2.2.3%20%20%20%20%20%20%20%20%20%20153.574%20%20%20%20%20138.509%20%20%20%20%20173.439%20%20%20%20%2012.015%20%20%20%20%20%20%250%20%20%20%20%20%20%20284%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0A4.2.2.4%20%20%20%20%20%20%20%20%20%20153.182%20%20%20%20%20141.023%20%20%20%20%20162.323%20%20%20%20%206.700%20%20%20%20%20%20%20%250%20%20%20%20%20%20%20282%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0A4.2.2.5%20%20%20%20%20%20%20%20%20%20154.840%20%20%20%20%20141.557%20%20%20%20%20163.889%20%20%20%20%207.195%20%20%20%20%20%20%20%250%20%20%20%20%20%20%20281%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0A209.244.0.3%20%20%20%20%20%20156.270%20%20%20%20%20147.320%20%20%20%20%20161.365%20%20%20%20%203.958%20%20%20%20%20%20%20%250%20%20%20%20%20%20%20279%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0A209.244.0.4%20%20%20%20%20%20159.329%20%20%20%20%20151.283%20%20%20%20%20163.726%20%20%20%20%203.958%20%20%20%20%20%20%20%250%20%20%20%20%20%20%20278%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0A195.46.39.39%20%20%20%20%20171.098%20%20%20%20%20163.612%20%20%20%20%20181.147%20%20%20%20%205.067%20%20%20%20%20%20%20%250%20%20%20%20%20%20%20276%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–%0A195.46.39.40%20%20%20%20%20175.335%20%20%20%20%20160.920%20%20%20%20%20185.618%20%20%20%20%208.726%20%20%20%20%20%20%20%250%20%20%20%20%20%20%20274%20%20%20%20%20QR%20–%20–%20RD%20RA%20–%20–“/]

    Copyright (c) 2016, Babak Farrokhi
    All rights reserved.

    Source: https://github.com/farrokhi/