218501311-1ceb9b79-79e6-4eb6-988a-9d38f626cdb8.png
216064486-5e0a4ad5-01d6-4b3c-85e9-2e6d2519dc5d.png
VPS一键脚本
bash <(curl -Ls https://raw.githubusercontent.com/sjlleo/nexttrace/main/nt_install.sh)

开源网址:https://github.com/sjlleo/nexttrace

How To Use
Before Using
使用 NextTrace 之前,我们建议您先阅读 #IP 数据以及精准度说明,在了解您自己的对数据精准度需求以后再进行抉择。

Automated Install

Linux 一键安装脚本

bash <(curl -Ls https://raw.githubusercontent.com/sjlleo/nexttrace/main/nt_install.sh)

GHPROXY 镜像(国内使用)

bash <(curl -Ls https://ghproxy.com/https://raw.githubusercontent.com/sjlleo/nexttrace/main/nt_install.sh)

macOS brew 安装命令

brew tap xgadget-lab/nexttrace && brew install nexttrace
Windows 用户请直接前往 Release 下载编译后的二进制 exe 文件。

Release里面为很多系统以及不同架构提供了编译好的二进制可执行文件,如果没有可以自行编译。
一些本项目的必要依赖在Windows上Golang底层实现不完全,所以目前NextTrace在Windows平台出于实验性支持阶段。
Get Started
NextTrace 默认使用ICMP协议发起TraceRoute请求,该协议同时支持IPv4和IPv6

IPv4 ICMP Trace

nexttrace 1.0.0.1

URL

nexttrace http://example.com:8080/index.html?q=1

表格打印,使用 --table / -t 参数,将实时显示结果

nexttrace --table 1.0.0.1

IPv6 ICMP Trace

nexttrace 2606:4700:4700::1111

禁用路径可视化 使用 --map / -M 参数

nexttrace koreacentral.blob.core.windows.net

MapTrace URL: https://api.leo.moe/tracemap/html/c14e439e-3250-5310-8965-42a1e3545266.html

PS: 路由可视化的绘制模块由 @tsosunchia 同学编写,具体代码可在 tsosunchia/traceMap 查看

需要注意的是,在 LeoMoeAPI 2.0 中,由于新增了了地理位置数据,我们已经弃用 traceMap 插件中 OpenStreetMap API 的在线查询的部分,并且使用自己数据库内的位置信息。

路由可视化功能因为需要每个 Hop 的地理位置坐标,而第三方 API 通常不提供此类信息,所以此功能目前只支持搭配 LeoMoeAPI 使用。

NextTrace 现已经支持快速测试,有一次性测试回程路由需求的朋友可以使用

# 北上广(电信+联通+移动+教育网)IPv4 / IPv6 ICMP 快速测试
nexttrace --fast-trace

# 也可以使用 TCP SYN 而非 ICMP 进行测试
nexttrace --fast-trace --tcp
NextTrace 已支持指定网卡进行路由跟踪

# 请注意 Lite 版本此参数不能和快速测试联用,如有需要请使用 enhanced 版本
# 使用 eth0 网卡
nexttrace --dev eth0 2606:4700:4700::1111

# 使用 eth0 网卡IP
# 网卡 IP 可以使用 ip a 或者 ifconfig 获取
# 使用网卡IP进行路由跟踪时需要注意跟踪的IP类型应该和网卡IP类型一致(如都为 IPv4)
nexttrace --source 204.98.134.56 9.9.9.9
NextTrace 也可以使用TCP和UDP协议发起Traceroute请求,不过目前UDP只支持IPv4

# TCP SYN Trace
nexttrace --tcp www.bing.com

# 可以自行指定端口[此处为443],默认80端口
nexttrace --tcp --port 443 2001:4860:4860::8888

# UDP Trace
nexttrace --udp 1.0.0.1

# 可以自行指定端口[此处为5353],默认53端口
nexttrace --udp --port 5353 1.0.0.1
NextTrace也同样支持一些进阶功能,如 TTL 控制、并发数控制、模式切换等

# 每一跳发送2个探测包
nexttrace --queries 2 www.hkix.net

# 无并发,每次只发送一个探测包
nexttrace --parallel-requests 1 www.hkix.net

# 从TTL为5开始发送探测包,直到TTL为10结束
nexttrace --first 5 --max-hops 10 www.decix.net

# 关闭IP反向解析功能
nexttrace --no-rdns www.bbix.net

# 特色功能:打印Route-Path图
# Route-Path图示例:
# AS6453 塔塔通信「Singapore『Singapore』」
#  ╭╯
#  ╰AS9299 Philippine Long Distance Telephone Co.「Philippines『Metro Manila』」
#  ╭╯
#  ╰AS36776 Five9 Inc.「Philippines『Metro Manila』」
#  ╭╯
#  ╰AS37963 阿里云「ALIDNS.COM『ALIDNS.COM』」
nexttrace --route-path www.time.com.my
NextTrace支持用户自主选择 IP 数据库(目前支持:LeoMoeAPI, IP.SB, IPInfo, IPInsight, IPAPI.com, Ip2region, IPInfoLocal, CHUNZHEN)

# 可以自行指定IP数据库[此处为IP-API.com],不指定则默认为LeoMoeAPI
nexttrace --data-provider ip-api.com
## 特别的: 其中 ipinfo 和 IPInsight API 对于免费版查询有频率限制,可从这些服务商自行购买服务以解除限制,如有需要可以 clone 本项目添加其提供的 token 自行编译
##        TOKEN填写路径:ipgeo/tokens.go
## 特别的: 对于离线库 IPInfoLocal,请自行下载并命名为 ipinfoLocal.mmdb (可以从这里下载:https://ipinfo.io/signup?ref=free-database-downloads)
##        对于离线库 Ip2region 可NextTrace自动下载,也可自行下载并命名为 ip2region.db
## 另外:由于IP.SB被滥用比较严重,会经常出现无法查询的问题,请知悉。
##      IP-API.com限制调用较为严格,如有查询不到的情况,请几分钟后再试。

# 纯真IP数据库默认使用 http://127.0.0.1:2060 作为查询接口,如需自定义请使用环境变量
export NEXTTRACE_CHUNZHENURL=http://127.0.0.1:2060
## 可使用 https://github.com/freshcn/qqwry 自行搭建纯真IP数据库服务

# 也可以通过设置环境变量来指定默认IP数据库
export NEXTTRACE_DATAPROVIDER=ipinfo
NextTrace支持使用混合参数和简略参数

Example:

    nexttrace --data-provider ip-api.com --max-hops 20 --tcp --port 443 --queries 5 --no-rdns 1.1.1.1
    nexttrace -tcp --queries 2 --parallel-requests 1 --table --route-path 2001:4860:4860::8888

Equivalent to:

    nexttrace -d ip-api.com -m 20 -T -p 443 -q 5 -n 1.1.1.1
    nexttrace -T -q 2 --parallel-requests 1 -t -R 2001:4860:4860::8888

全部用法详见 Usage 菜单

Usage: nexttrace [-h|--help] [-T|--tcp] [-U|--udp] [-F|--fast-trace] [-p|--port
                 <integer>] [-q|--queries <integer>] [--parallel-requests
                 <integer>] [-m|--max-hops <integer>] [-d|--data-provider
                 (Ip2region|ip2region|IP.SB|ip.sb|IPInfo|ipinfo|IPInsight|ipinsight|IPAPI.com|ip-api.com|IPInfoLocal|ipinfolocal|chunzhen)]
                 [-n|--no-rdns] [-a|--always-rdns] [-P|--route-path]
                 [-r|--report] [--dn42] [-o|--output] [-t|--table]
                 [-c|--classic] [-f|--first <integer>] [-M|--map]
                 [-v|--version] [-s|--source "<value>"] [-D|--dev "<value>"]
                 [-R|--route] [-z|--send-time <integer>] [-i|--ttl-time
                 <integer>] [_positionalArg_nexttrace_25 "<value>"]
                 [--dot-server (dnssb|aliyun|dnspod|google|cloudflare)]
                 [-g|--language (en|cn)]

Arguments:

  -h  --help                         Print help information
  -T  --tcp                          Use TCP SYN for tracerouting (default port
                                     is 80)
  -U  --udp                          Use UDP SYN for tracerouting (default port
                                     is 53)
  -F  --fast-trace                   One-Key Fast Trace to China ISPs
  -p  --port                         Set the destination port to use. It is
                                     either initial udp port value for
                                     "default"method (incremented by each
                                     probe, default is 33434), or initial seq
                                     for "icmp" (incremented as well, default
                                     from 1), or some constantdestination port
                                     for other methods (with default of 80 for
                                     "tcp", 53 for "udp", etc.)
  -q  --queries                      Set the number of probes per each hop.
                                     Default: 3
      --parallel-requests            Set ParallelRequests number. It should be
                                     1 when there is a multi-routing. Default:
                                     18
  -m  --max-hops                     Set the max number of hops (max TTL to be
                                     reached). Default: 30
  -d  --data-provider                Choose IP Geograph Data Provider [IP.SB,
                                     IPInfo, IPInsight, IP-API.com, Ip2region,
                                     IPInfoLocal, CHUNZHEN]. Default: LeoMoeAPI
  -n  --no-rdns                      Do not resolve IP addresses to their
                                     domain names
  -a  --always-rdns                  Always resolve IP addresses to their
                                     domain names
  -P  --route-path                   Print traceroute hop path by ASN and
                                     location
  -r  --report                       output using report mode
      --dn42                         DN42 Mode
  -o  --output                       Write trace result to file
                                     (RealTimePrinter ONLY)
  -t  --table                        Output trace results as table
  -c  --classic                      Classic Output trace results like
                                     BestTrace
  -f  --first                        Start from the first_ttl hop (instead from
                                     1). Default: 1
  -M  --map                          Disable Print Trace Map
  -v  --version                      Print version info and exit
  -s  --source                       Use source src_addr for outgoing packets
  -D  --dev                          Use the following Network Devices as the
                                     source address in outgoing packets
  -R  --route                        Show Routing Table [Provided By BGP.Tools]
  -z  --send-time                    Set the time interval for sending every
                                     packet. Useful when some routers use
                                     rate-limit for ICMP messages. Default: 100
  -i  --ttl-time                     Set the time interval for sending packets
                                     groups by TTL. Useful when some routers
                                     use rate-limit for ICMP messages. Default:
                                     500
      --_positionalArg_nexttrace_25  IP Address or domain name
      --dot-server                   Use DoT Server for DNS Parse [dnssb,
                                     aliyun, dnspod, google, cloudflare]
  -g  --language                     Choose the language for displaying [en,
                                     cn]. Default: cn

最后修改:2023 年 05 月 22 日
如果觉得我的文章对你有用,请随意赞赏