You need to enable JavaScript to run this app.
导航
一键式网络诊断(netdig)
最近更新时间:2024.06.20 17:59:55首次发布时间:2024.06.20 17:59:55

您可以通过 netdig 命令一键式诊断网络,帮助您确定网络问题。

注意事项

  • 仅支持在 Linux 和 macOS 系统执行网络诊断命令。
  • 网络诊断命令依赖多个本地命令行,包括:
    • dig 命令
    • ping 命令
    • traceroute 命令
    • curl 命令
    • tcpdump 命令

命令语法

./tosutil netdig domain/ipaddress [-aoe] [-ipv6] [-w] [-we=xxx] [-p] [-pss=xxx] [-tr] [-c] [-dp=xxx] [-di=xxx] [-u] [-ucl=xxx]

参数说明

参数名

参数类型

描述

domain

String

目标主机域名。TOS 支持的地域和访问域名,请参见地域和访问域名(Endpoint)

ipaddress

String

目标主机 IP 地址。

-aoe

Bool

执行过程中遇到错误时中断命令。

-ipv6

Bool

解析域名时选择 IPv6 地址。

-w

Bool

使用 dig 命令查看 dns lookup 出口。

-we

String

查看 dns lookup 出口时的 dig 地址,默认为 whoami.byte008.com

-p

Bool

使用 ping 命令测试大包和小包的 MTU。

-pss

String

使用 ping 命令时指定的 packet 大小列表,用 # 分隔配置,默认为 64#1295#1472

-tr

Bool

使用 traceroute 命令进行 UDP/ICMP 协议的路由路径探测。

-c

Bool

使用 curl 命令测试请求耗时。

-dp

String

使用 tcpdump 命令抓取 probe 命令产生的网络包,该参数的值是 probe 的可选参数。

注意

该参数的值必须使用双引号 "" 包裹。

-di

String

使用 tcpdump 命令时指定抓取的网卡名称。

-u

Bool

打包并上传收集到的网络信息到 TOS 存储桶。

-ucl

String

打包上传时使用该参数指定的桶和前缀,格式为 tos://bucket/[prefix]

使用示例

执行命令进行网络诊断测试,并收集相关信息打包上传到指定的桶。示例如下:

  • 命令
./tosutil netdig tos-cn-beijing.volces.com -w -p -tr -c -dp "-pt upload -timeout 15" -u -ucl tos://bucket-test
  • 返回
Start to exec command [dig whoami.byte008.com]

Start to exec command [ping -c 10 -s 64 tos-cn-beijing.volces.com]

Start to exec command [ping -c 10 -s 1295 tos-cn-beijing.volces.com]

Start to exec command [ping -c 10 -s 1472 tos-cn-beijing.volces.com]

Start to exec command [traceroute -P UDP -n -w 1 tos-cn-beijing.volces.com]

Start to exec command [traceroute -P ICMP -n -w 1 tos-cn-beijing.volces.com]

Start to exec command [curl -o /dev/null -s -w time_namelookup:\t%{time_namelookup}\ntime_connect:\t\t%{time_connect}\ntime_appconnect:\t%{time_appconnect}\ntime_pretransfer:\t%{time_pretransfer}\ntime_starttransfer:\t%{time_starttransfer}\ntime_total:\t\t%{time_total}\ntime_redirect:\t\t%{time_redirect}\n http://tos-cn-beijing.volces.com]

Start to exec command [tcpdump -nn -w 618b7d5a-2bf1-11ef-ade1-b645e116****.pcap (tcp[tcpflags] & (tcp-syn|tcp-fin|tcp-rst) != 0 or tcp[13] & 0x3f = 0x3f) and host tos-cn-beijing.volces.com]

Start to test the uploading speed for region cn-beijing

Average upload rate: 6.73MB/s

Time consuming details
Resolve dns cost:      24 ms
Build connection cost: 36 ms
Tls handshake cost:    -1 ms
Send request cost:     14938 ms
Wait response cost:    -1 ms
Total cost:            15000 ms

Collect network info finished, start to upload it as key [2024-06-16T15:01:59Z/618b7e18-2bf1-11ef-ade1-b645e116****] in bucket [bucket-test]

[-------------------------------------------------] 100.00% ?/s 99.60MB/? 127ms

Upload network info finished, the uploaded url is:
http://bucket-test.tos-cn-beijing.volces.com/2024-06-16T15:01:59Z/618b7e18-2bf1-11ef-ade1-b645e116****?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTY2E1ZTExYjgzMjk0NGJkYTgyYTQ3OWE5NjVjYzV****%2F20240616%2Fbeijing%2Ftos%2Frequest&X-Tos-Date=20240616T150410Z&X-Tos-Expires=25200&X-Tos-Signature=6aedd32bec9f224414afeda5f2859d9f8684f493714cb86e0b320a3a5ab****&X-Tos-SignedHeaders=host
Capture network packet finished, start to upload it as key [2024-06-16T15:01:59Z/618b7d5a-2bf1-11ef-ade1-b645e1163e54.pcap] in bucket [bucket-test]

[--------------------------------------------------] 100.00% ?/s 99.60MB/? 40ms

Upload network packet finished, the uploaded url is:
http://bucket-test.tos-cn-beijing.volces.com/2024-06-16T15:01:59Z/618b7d5a-2bf1-11ef-ade1-b645e1163e54.pcap?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTY2E1ZTExYjgzMjk0NGJkYTgyYTQ3OWE5NjVjYzViZTQ%2F20240616%2Fbeijing%2****Frequest&X-Tos-Date=20240616T150410Z&X-Tos-Expires=25200&X-Tos-Signature=95601b6fe804552b5256410fa2242062a32c2b850d3822a27485b4665ef7****&X-Tos-SignedHeaders=host