41. Introduction to Networking Tools: ping and traceroute
Termux provides access to fundamental Linux networking utilities, allowing you to diagnose connectivity and latency issues directly from your phone.
1. Checking Connectivity (ping)
ping uses ICMP packets to test if a remote host is reachable and measures the round-trip delay time.
Installation (if not pre-installed):
bash $ pkg install iputils
Usage:
bash
Ping Google's DNS server
$ ping 8.8.8.8
Ping a domain name
$ ping google.com
Note: Unlike desktop Linux, ping in Termux often runs indefinitely. Use Ctrl + C to stop the process and view the summary statistics (packet loss, average time).
2. Tracing Network Path (traceroute)
traceroute maps the path that data packets take to reach a destination, showing every router (hop) along the way. This is useful for identifying where connectivity issues or high latency are occurring.
Installation:
bash $ pkg install traceroute
Usage:
bash $ traceroute example.com
By viewing the hops, you can determine if the delay is local (first few hops), in your ISP network, or near the destination server.