==========================
A Python script to benchmark the performance of different DNS servers base on your network setting. so you can determine which dns server is best for you!
This script tests the query time of multiple DNS servers for a list of specified domains. It uses the dig
command to resolve the domains and measures the time taken for each query. The results are stored in a JSON file and can be used to compare the performance of different DNS servers.
- Tests multiple DNS servers for a list of specified domains
- Measures the query time for each DNS server
- Stores results in a JSON file
- Can clear the DNS cache before running the tests
- Can plot the query times for each domain using matplotlib
- Clone the repository and navigate to the directory.
- Install the required dependencies:
matplotlib
andjson
. - Edit the
dns_servers
anddomains
lists in the script to specify the DNS servers and domains you want to test. - Run the script using
python main.py
. - Use the
--clear
switch to clear the DNS cache before running the tests. - Use the
--graph
switch to plot the query times for each domain.
The script will output the fastest and slowest DNS servers for each domain, along with the query time. For example: Running without clearing DNS cache.
########################################
# Fastest DNS for unrivaled.ir: google (8.8.4.4) (116.202.96.103, 122.762680ms)
# Lowest DNS for unrivaled.ir: opendns (208.67.222.222) (116.202.96.103, 644.473553ms)
########################################
########################################
# Fastest DNS for gnu.org: google (8.8.8.8) (209.51.188.116, 113.784313ms)
# Lowest DNS for gnu.org: cloudflare (1.1.1.1) (209.51.188.116, 366.569519ms)
########################################
If you use the --graph
switch, the script will display a bar chart showing the query times for each DNS server for each domain.
To run the script and plot the query times, use the following command:
python dns_benchmark.py --graph
To run the script with both options, use the following command:
python dns_benchmark.py --clear --graph
- Python 3.x
matplotlib
libraryjson
librarydig
command (usually installed by default on Linux and macOS systems)
This project is licensed under the GNU General Public License, version 3.0 (GPL-3.0). See the LICENSE file for details.