nt (Net Test) - A versatile network testing tool that supports ICMP, HTTP(s), DNS, TCP, and MTU testing
nt is a versatile tool for network troubleshooting and testing written in Go. It provides continuous testing of network connectivity using various protocols using subcommands, including icmp, tcp, http, and dns. Monitor round-trip times (RTT), track packet loss rates, and log high latency events with timestamps to ensure your network's reliability.
- Subcommands for Protocols: Use specific subcommands (
icmp,tcp,http,dns) to perform tests. - Continuous ICMP Ping: Monitor network latency and packet loss using ICMP echo requests.
- TCP Connectivity Testing: Check the availability and response times of TCP ports.
- HTTP/HTTPS Testing: Test web server availability and measure HTTP/HTTPS response times.
- DNS Ping: Verify DNS server responsiveness and resolve lookup times.
- MTU Testing: Determine the Maximum Transmission Unit (MTU) size to a given destination host/IP.
- TCP Port Testing: Test if the remote server is listening on one or multiple given TCP ports.
- Recording and Logging: Save test results to a CSV file for later analysis.
- Customizable Output: Adjust the number of rows displayed in the terminal during live tests.
- Cross-Platform: Compatible with Windows and Linux.
- For Option 1 & 2, Go 1.18 or higher is required on your system.
The compiled executable will be placed in $GOPATH/bin
go install github.com/djian01/nt@latestgit clone https://github.com/djian01/nt.git
cd nt
go build .The compiled executable will be placed in \executable\ inside the code folder
git clone https://github.com/djian01/nt.git
cd nt
make build-linuxor
git clone https://github.com/djian01/nt.git
cd nt
make build-windows- Visit the Releases page of the repository.
- Download the
nt_linux_amd64_x.x.x.tar.gzfile for Linux or thent_windows_amd64_x.x.x.zipfile for Windows
nt [flags] <sub-command: icmp/tcp/http/dns/mtu/tcpscan> [args]
-
-r: Enable Recording Save the test results to a CSV file for future analysis. -
-p <number>: Rows Displayed Specify the number of rows displayed in the terminal during live tests. Default is10.
-
-c: ICMP Ping Count
Number of ICMP ping requests to send. Default is0, which means it will run non-stop until interrupted withCtrl+C. -
-d: ICMP Ping Do Not Fragment*
Sets the "Do Not Fragment" flag in the ICMP request. Default isfalse. -
-h: Help
Display help information for theicmpsubcommand. -
-i: ICMP Ping Interval
Interval between ICMP ping requests in seconds. Default is1second. -
-s: ICMP Ping Payload Size
Size of the ICMP ping payload in bytes. Default is32bytes. Total IP Packet size = IP Header (20 bytes) + ICMP Header (8 bytes) + Payload Size (specificed with '-s') Example: If Payload Size is 1472, the IP Packet size is 1500 bytes (20 + 8 + 1472) -
-t: ICMP Ping Timeout
Timeout for each ICMP ping request in seconds. Default is4seconds.
nt -r icmp google.com
nt icmp -c 10 -i 2 -s 48 10.2.3.10
-
-c: TCP Ping Count
Number of TCP ping requests to send. Default is0, which means it will run non-stop until interrupted withCtrl+C. -
-h: Help
Display help information for thetcpsubcommand. -
-i: TCP Ping Interval
Interval between TCP ping requests in seconds. Default is1second. -
-s: TCP Ping Payload Size
Size of the TCP ping payload in bytes. Default is0bytes (no payload). -
-t: TCP Ping Timeout
Timeout for each TCP ping request in seconds. Default is4seconds.
nt -r tcp google.com 443
nt tcp -c 10 -i 2 10.2.3.10 22
The http subcommand allows you to perform HTTP/HTTPS probing against a target host.
You can customize the HTTP method, expected status codes, and more.
Note:
- If custom port is not specificed, the test will use the default ports (HTTP 80, HTTPS 443).
- The default interval for HTTP Ping is 5 seconds.
-
-c: HTTP Ping Count
Number of HTTP ping requests to send. Default is0, which means it will run non-stop until interrupted withCtrl+C. -
-h: Help
Display help information for thehttpsubcommand. -
-i: HTTP Ping Interval
Interval between HTTP ping requests in seconds. Default is5seconds. -
-m: HTTP Ping Method
HTTP request method to use (e.g.,GET,POST). Default is"GET". -
-s, --statuscode: Expected HTTP status code(s). Accepts:- Shorthand ranges:
2xx,3xx,4xx,5xx - Exact codes:
200,301,404, etc.
- Shorthand ranges:
-
-t: HTTP Ping Timeout
Timeout for each HTTP ping request in seconds. Default is4seconds. -
-x, --proxy: HTTP or SOCKS5 Proxy
Route all HTTP/HTTPS requests through a proxy.
Supported schemes:http://orhttps://(standard web proxies)socks5://orsocks5h://(SOCKS proxies)
Examples:
- No authentication:
-x http://172.16.200.102:3128
- With authentication:
Important: If your password contains special characters (
-x http://user01:S%40cretPass@172.16.200.102:3128
@,:,/,%, etc.),
you must URL-encode them. See the URL Encoding Reference for the full table of encodings. Example:- Actual password:
S@cretPass - Encoded:
S%40cretPass(because@β%40)
- Actual password:
π» Example 1: HTTP ping to "https://google.com" with recording enabled (With default values: Port-443, Method-GET, Count-0, Interval-5s, Timeout-4s)
nt -r http https://google.com
π» Example 2: HTTP ping to POST "http://10.2.3.10:8080/token" with count: 10 and interval: 2 sec
nt http -c 10 -i 2 -m POST http://10.2.3.10:8080/token
π» Example 3: HTTP ping using the GET http://10.3.4.10:8080/health. The probe will be considered successful if the response status code is within the 200β299 range or exactly 301.
nt http -s 2xx -s 301 http://10.3.4.10:8080/health
π» Example 4: Using a proxy with authentication. Perform HTTPS probe via an HTTP proxy at 172.16.200.102:3128, authenticating as user01 (password S@cretPass β encoded as S%40cretPass) and interval is 2 sec :
nt http -x http://user01:S%40cretPass@172.16.200.102:3128 -i 2 https://www.youtube.com
-
-c: DNS Ping Count
Number of DNS ping requests to send. Default is0, which means it will run non-stop until interrupted withCtrl+C. -
-h: Help
Display help information for thednssubcommand. -
-i: DNS Ping Interval
Interval between DNS ping requests in seconds. Default is1second. -
-o: DNS Ping Protocol Type
Protocol to use for DNS queries (e.g.,udp,tcp). Default is"udp". -
-t: DNS Ping Timeout
Timeout for each DNS ping request in seconds. Default is4seconds.
nt -r dns 8.8.8.8 google.com
nt dns -c 10 -i 2 4.2.2.2 abc.com
-
-s: Ceiling Test Size
The maximum MTU size to test, in bytes. Default is1500bytes. -
-h: Help
Display help information for themtusubcommand.
nt mtu google.com
π» Example 2: MTU check for destination 192.168.1.10 with user defined ceiling test size 9000 set (for Jumbo Frame enabled environment)
nt mtu -s 9000 192.168.1.10
Note:
- The maximum number of tested ports for each command run is 50.
-
-t: **TCP Ping test Timeout **
TCP Ping test Timeout (default: 4 sec) (default 4) -
-h: Help
Display help information for themtusubcommand.
π» Example 1: TCP Scan to "10.123.1.10" for port "80, 443, 8080 & 1500-1505" with recording enabled
nt -r tcpscan 10.123.1.10 80 443 8080 1500-1505
nt tcpscan -t 5 10.2.3.10 22 1522-1525 8433
When the -r option is enabled, all test results are saved to a CSV file in the same directory as the executable.
During the testing/recording process, the CSV file is named in the following format:
[recording...]_Record_<test type>_<test target host>_<timestamp>.csv
When the testing/recording is completed, the file name will be like this:
Record_<test type>_<test target host>_<timestamp>.csv
During testing/recording, the file name will be prefixed with "[recording...]_". Please DO NOT open this CSV file at that time, as doing so will prevent test records from being saved to the file and will interrupt the test process.
- Example:
Record_icmp_google.com_20211012T101530.csv
The CSV file captures the detailed test results based on the test type.
This project is licensed under the MIT License.
- Email: dennis.jian@packetstreams.net
- GitHub: djian01