排查:fail to connect to {ip} cannot assign requested address
After investigation, it is necessary to measure the network request time, including DNS resolution, connection, transmission and other times.
The curl command under Linux can measure network requests well, as follows
curl -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} http://www.jd.com
-o means output results to /dev/null (to avoid returning data to drown out time information)
-s means to remove state information
-w indicates the result of listing the following parameters
The parameters supported by the curl command are as follows
time_connect 建立到服务器的 TCP 连接所用的时间
time_starttransfer 在发出请求之后,Web 服务器返回数据的第一个字节所用的时间
time_total 完成请求所用的时间
time_namelookup DNS解析时间,从请求开始到DNS解析完毕所用时间(记得关掉 Linux 的 nscd 的服务测试)
speed_download 下载速度,单位-字节每秒。
With this command, you can calculate the DNS resolution, connection, transmission, and total time in network requests, and perform preliminary troubleshooting.
E.g:
time curl -o /dev/null -s -w %{http_code}:%{http_connect}:%{content_type}:%{time_namelookup}:%{time_redirect}:%{time_pretransfer}:%{time_connect}:%{time_starttransfer}:%{time_total}:%{speed_download} -d '<?xml version="1.0" encoding="GBK" ?><Cell_Req ver="1.0"><HDR version="1.0" cdma="0" gps="" glong="" glat="" precision=""><src>yun_droid_mapsdk</src><license>KBIH8I09CJK09BN89HILIBHKKXZV8OU</license><imei>111339641496121.6635</imei ></HDR><DRR phnum="" nettype="" inftype="2"><mcc></mcc><mnc></mnc><lac></lac><cellid></cellid><signal></signal><nb></nb><mmac>c0:83:0a:55:1d:91,-65*</mmac><macs>c0:83:0a:55:1d:91,-65*8c:10:d4:e7:91:c6,-76*58:20:b1:55:9c:5d,-74*40:65:a3:63:a2:ee,-74*</macs></DRR></Cell_Req>' http://{ip}/APS/r
200:000:text/xml;charset=GBK:0.005198:0.000000:0.129652:0.129178:0.242116:0.242243:1011.000
real 0m0.255s
user 0m0.006s
sys 0m0.006s
47.88.132.64