Using mping script for ping and traceroute testing

Publish: 2019-06-03 | Modify: 2019-06-03

mping script can initiate ping and route tracking tests from local machine to domestic servers. Since xiaoz needs to test the return path from foreign VPS to China, this script was developed. You can try it if you need it.

Usage

Simply copy and execute the following command:

wget https://raw.githubusercontent.com/helloxz/mping/master/mping.sh && bash mping.sh

Result

The generated result is shown below:

---------------------------------------------------------------------------
Your local IP is: [89.208.xxx.xx, Russia, Moscow]
Ping test in progress, please wait...
---------------------------------------------------------------------------
【Sichuan Telecom】 - 61.139.2.69

10 packets transmitted, 10 received, 0% packet loss, time 9011ms
rtt min/avg/max/mdev = 175.868/176.184/178.301/0.890 ms
---------------------------------------------------------------------------
【Tianjin Telecom】 - 219.150.32.132

10 packets transmitted, 10 received, 0% packet loss, time 9014ms
rtt min/avg/max/mdev = 151.440/151.993/156.191/1.453 ms
---------------------------------------------------------------------------
【Jiangsu Telecom】 - 218.2.2.2

10 packets transmitted, 10 received, 0% packet loss, time 9004ms
rtt min/avg/max/mdev = 131.140/131.427/132.370/0.556 ms
---------------------------------------------------------------------------
【Sichuan Unicom】 - 119.6.6.6

10 packets transmitted, 10 received, 0% packet loss, time 9020ms
rtt min/avg/max/mdev = 219.419/220.274/223.815/1.494 ms
---------------------------------------------------------------------------
【Hebei Unicom】 - 202.99.160.68

10 packets transmitted, 10 received, 0% packet loss, time 9015ms
rtt min/avg/max/mdev = 160.475/161.261/164.652/1.277 ms
---------------------------------------------------------------------------
【Zhejiang Unicom】 - 221.12.1.227

10 packets transmitted, 10 received, 0% packet loss, time 9015ms
rtt min/avg/max/mdev = 137.538/137.633/137.769/0.377 ms
---------------------------------------------------------------------------
【Anhui Mobile】 - 211.138.180.2

10 packets transmitted, 10 received, 0% packet loss, time 9013ms
rtt min/avg/max/mdev = 142.817/148.090/150.868/2.003 ms
---------------------------------------------------------------------------
【Shandong Mobile】 - 218.201.96.130

10 packets transmitted, 10 received, 0% packet loss, time 9011ms
rtt min/avg/max/mdev = 170.958/180.617/187.635/7.493 ms
---------------------------------------------------------------------------
【Sichuan Mobile】 - 223.87.238.22

10 packets transmitted, 10 received, 0% packet loss, time 9019ms
rtt min/avg/max/mdev = 174.732/175.320/177.393/0.958 ms
---------------------------------------------------------------------------
【Guangdong Mobile】 - 211.139.129.222

10 packets transmitted, 10 received, 0% packet loss, time 9012ms
rtt min/avg/max/mdev = 161.062/161.325/161.601/0.569 ms
---------------------------------------------------------------------------
【Parameter Explanation】
x% packet loss: packet loss rate
min: minimum latency
avg: average latency
max: maximum latency
mdev: average deviation
---------------------------------------------------------------------------

---------------------------------------------------------------------------
Route tracking in progress, please wait...
---------------------------------------------------------------------------
【Sichuan Telecom】 - 61.139.2.69

traceroute to 61.139.2.69 (61.139.2.69), 30 hops max, 60 byte packets
 1  *
 2  218.30.49.97  4.93 ms  AS4134  United States ctamericas.com
 3  59.43.182.106  152.42 ms  *  China Guangdong Guangzhou Telecom
 4  *
 5  59.43.130.157  154.37 ms  *  China Guangdong Guangzhou Telecom
 6  59.43.146.218  178.42 ms  *  China Telecom
 7  *
 8  61.139.113.54  176.67 ms  AS4134  China Sichuan Chengdu Telecom
 9  ns.sc.cninfo.net (61.139.2.69)  175.93 ms  AS4134  China Sichuan Chengdu Telecom

---------------------------------------------------------------------------
【Hebei Unicom】 - 202.99.160.68

traceroute to 202.99.160.68 (202.99.160.68), 30 hops max, 60 byte packets
 1  *
 2  218.30.48.61  10.11 ms  AS4134  United States California San Jose ctamericas.com
 3  59.43.189.33  131.19 ms  *  China Shanghai Telecom
 4  59.43.187.61  127.61 ms  *  China Shanghai Telecom
 5  59.43.138.45  127.48 ms  *  China Shanghai Telecom
 6  59.43.17.117  158.76 ms  *  China Beijing Telecom
 7  59.43.17.126  154.31 ms  *  China Beijing Telecom
 8  219.158.40.165  158.52 ms  AS4837  China Beijing Unicom
 9  219.158.3.65  157.37 ms  AS4837  China Beijing Unicom
10  219.158.9.170  155.47 ms  AS4837  China Beijing Unicom
11  202.99.160.214  156.95 ms  AS4837  China Hebei Shijiazhuang Unicom
12  61.182.146.82  176.78 ms  AS4837  China Hebei Shijiazhuang Unicom
13  221.192.35.2  162.34 ms  AS4837  China Hebei Shijiazhuang Unicom
14  202.99.160.68  160.62 ms  AS4837  China Hebei Shijiazhuang Unicom

---------------------------------------------------------------------------
【Anhui Mobile】 - 211.138.180.2

traceroute to 211.138.180.2 (211.138.180.2), 30 hops max, 60 byte packets
 1  *
 2  218.30.48.129  0.98 ms  AS4134  United States ctamericas.com
 3  59.43.186.217  8.40 ms  *  United States California San Jose Telecom
 4  59.43.182.186  128.05 ms  *  China Shanghai Telecom
 5  *
 6  59.43.130.201  136.00 ms  *  China Shanghai Telecom
 7  59.43.80.106  140.13 ms  *  China Shanghai Telecom
 8  202.97.46.14  132.73 ms  AS4134  China Shanghai Telecom
 9  *
10  221.176.17.33  129.22 ms  AS9808  China Shanghai Mobile
11  221.176.27.177  151.86 ms  AS9808  China Anhui Hefei Mobile
12  221.183.13.210  148.72 ms  AS9808  China Anhui Hefei Mobile
13  *
14  *
15  ns1.ah.chinamobile.com (211.138.180.2)  143.25 ms  AS9808  China Anhui Hefei Mobile

---------------------------------------------------------------------------

This result is generated by mping: https://github.com/helloxz/mping

Ping Parameter Explanation

  • x% packet loss: packet loss rate
  • min: minimum latency
  • avg: average latency
  • max: maximum latency
  • mdev: average deviation

Dependency

Route tracking uses the besttrace tool provided by ipip.net. After using this script, the besttrace binary file will be downloaded in the current directory. You can delete it or take no action after testing.

Project Address

Github: https://github.com/helloxz/mping


Comments