笨猫博客

  • 🍟首页
  • 🍘目录
    • 🥝VPS教程
    • 🍾猫玩技术
    • 🍹干货分享
    • 🍏软件分享
    • 🍩一只猫
  • 🍋工具
    • 🌽IP路由追踪
    • 🍐域名Whois查询
    • 🥘域名被墙查询
    • 🍧IP正常检测
    • 🔥IP端口检测
    • 🍆短网址
    • 🐟VIP音乐播放
    • 🍯KMS激活
  • 🍓链接
  • 🍪联系
  • 🍱登录
    • 🥦登录
    • 🍒注册
关注互联网,生活,音乐,乐此不疲的一只笨猫
  1. 首页
  2. 猫玩技术
  3. 正文

NextTrace 路由跟踪工具使用教程

2025-02-19 653点热度 0人点赞 0条评论

关于NTrace-V1和NTrace-core两个仓库的说明:
两者将大体上保持一致。所有的开发工作均在NTrace-V1仓库中进行。NTrace-V1仓库首先发布新版本,在稳定定运行一段时间后(时长不定),我们把版本同步到NTrace-core。这意味着NTrace-V1仓库充当了一个“测试版”的角色。
请注意,版本同步也例外存在。如果NTrace-V1的某个版本出现了严重的bug,NTrace-core会跳过这个有缺陷的版本,直接同步到下一个修复了该问题的版本。

使用前

 

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

自动安装

 

  • Linux

    • 一键安装脚本

      curl nxtrace.org/nt | bash
    • 从 nxtrace 的 APT 源安装

      • 支持 AMD64/ARM64 架构
        echo "deb [trusted=yes] https://github.com/nxtrace/nexttrace-debs/releases/latest/download ./" |
        sudo tee /etc/apt/sources.list.d/nexttrace.list
        sudo apt update
        sudo apt install nexttrace
      • APT源由 wcbing, nxtrace 维护
    • Arch Linux AUR 安装命令

      • 直接下载bin包(仅支持amd64)
        yay -S nexttrace-bin
      • 自构建(仅支持amd64源码)
        yay -S nexttrace
      • AUR 的构建分别由 ouuan, huyz 维护
    • Linuxbrew 安装命令

      同macOS Homebrew安装方法(homebrew-core版本仅支持amd64)

    • Deepin 安装命令

      apt install nexttrace
    • x-cmd安装命令

      x env use nexttrace
    • Termux 安装命令

      pkg install nexttrace-enhanced
  • macOS

    • macOS Homebrew 安装命令
      • homebrew-core版本
        brew install nexttrace
      • 本仓库ACTIONS自动构建版(更新更快)
        brew tap nxtrace/nexttrace && brew install nxtrace/nexttrace/nexttrace
      • homebrew-core 由 chenrui333 维护构建,请注意该版本更新可能会后面仓库操作自动构建版本
  • 视窗

    • Windows WinGet安装命令

      • WinGet 版
        winget install nexttrace
      • WinGet 由 Dragon1573 构建 维护
    • Windows Scoop 安装命令

      • scoop-extras 版
      scoop bucket add extras && scoop install extras/nexttrace
      • scoop-extra 由 soenggam 维护

请注意,以上多种安装方式的仓库均由开源供应商自行维护,不保证供货和更新,如遇到问题请及时联系仓库维护者解决,或使用本项目官方编译提供的二进制包。

手动安装

 

  • 下载预编译的执行程序

    对于没有上述方法的用户,请直接前往Release下载编译后的二进制可执行文件。

    • Release里面为很多系统以及不同的架构提供了编译好的二进制可执行文件,如果没有可以自行编译。
    • 一些本项目的需求依赖在Windows底层Golang实现尚未完全,因此目前NextTrace在Windows平台上处于实验性支持阶段。

立即开始

 

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

# 一个方便供机器读取转化的模式
nexttrace --raw 1.0.0.1
nexttrace --json 1.0.0.1

# 只进行IPv4/IPv6解析,且当多个IP时自动选择第一个IP
nexttrace --ipv4 g.co
nexttrace --ipv6 g.co

# IPv6 ICMP Trace
nexttrace 2606:4700:4700::1111

# 禁用路径可视化 使用 --map / -M 参数
nexttrace koreacentral.blob.core.windows.net
# MapTrace URL: https://api.nxtrace.org/tracemap/html/c14e439e-3250-5310-8965-42a1e3545266.html

# 禁用MPLS显示 使用 --disable-mpls / -e 参数 或 NEXTTRACE_DISABLEMPLS 环境变量
nexttrace --disable-mpls example.com
export NEXTTRACE_DISABLEMPLS=1

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

# 也可以通过自定义的IP/DOMAIN列表文件进行快速测试
nexttrace --file /path/to/your/iplist.txt
# 自定义的IP/DOMAIN列表文件格式
## 一行一个IP/DOMAIN + 空格 + 描述信息(可选)
## 例如:
## 106.37.67.1 北京电信
## 240e:928:101:31a::1 北京电信
## bj.10086.cn 北京移动
## 2409:8080:0:1::1
## 223.5.5.5

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],默认33494端口
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
# 此外还提供了一个ENV,可以设置是否隐匿目的IP
export NEXTTRACE_ENABLEHIDDENDSTIP=1

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

# 设置载荷大小为1024字节
nexttrace --psize 1024 example.com

# 设置载荷大小以及DF标志进行TCP Trace
nexttrace --psize 1024 --dont-fragment --tcp example.com

# 特色功能:打印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 --nocolor 1.1.1.1
# 或者使用环境变量
export NO_COLOR=1

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),
##        默认搜索用户当前路径、程序所在路径、和 FHS 路径(Unix-like)
##        如果需要自定义路径,请设置环境变量
export NEXTTRACE_IPINFOLOCALPATH=/xxx/yyy.mmdb
##        对于离线库 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 -P 2001:4860:4860::8888

全部用法参见使用菜单

 

Usage: nexttrace [-h|--help] [-4|--ipv4] [-6|--ipv6] [-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|LeoMoeAPI|leomoeapi|disable-geoip)]
                 [--pow-provider (api.nxtrace.org|sakura)] [-n|--no-rdns]
                 [-a|--always-rdns] [-P|--route-path] [-r|--report] [--dn42]
                 [-o|--output] [-t|--table] [--raw] [-j|--json] [-c|--classic]
                 [-f|--first <integer>] [-M|--map] [-e|--disable-mpls]
                 [-v|--version] [-s|--source "<value>"] [-D|--dev "<value>"]
                 [-z|--send-time <integer>] [-i|--ttl-time <integer>]
                 [--timeout <integer>] [--psize <integer>]
                 [_positionalArg_nexttrace_32 "<value>"] [--dot-server
                 (dnssb|aliyun|dnspod|google|cloudflare)] [-g|--language
                 (en|cn)] [--file "<value>"] [-C|--nocolor]

Arguments:

  -h  --help                         Print help information
  -4  --ipv4                         Use IPv4 only
  -6  --ipv6                         Use IPv6 only
  -T  --tcp                          Use TCP SYN for tracerouting (default port
                                     is 80)
  -U  --udp                          Use UDP SYN for tracerouting (default port
                                     is 33494)
  -F  --fast-trace                   One-Key Fast Trace to China ISPs
  -p  --port                         Set the destination port to use. With
                                     default of 80 for "tcp", 33494 for "udp"
  -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, disable-geoip].
                                     Default: LeoMoeAPI
      --pow-provider                 Choose PoW Provider [api.nxtrace.org,
                                     sakura] For China mainland users, please
                                     use sakura. Default: api.nxtrace.org
  -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
      --raw                          An Output Easy to Parse
  -j  --json                         Output trace results as JSON
  -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
  -e  --disable-mpls                 Disable MPLS
  -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
  -z  --send-time                    Set how many [milliseconds] between
                                     sending each packet.. Useful when some
                                     routers use rate-limit for ICMP messages.
                                     Default: 50
  -i  --ttl-time                     Set how many [milliseconds] between
                                     sending packets groups by TTL. Useful when
                                     some routers use rate-limit for ICMP
                                     messages. Default: 50
      --timeout                      The number of [milliseconds] to keep probe
                                     sockets open before giving up on the
                                     connection.. Default: 1000
      --psize                        Set the payload size. Default: 52
      --_positionalArg_nexttrace_32  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
      --file                         Read IP Address or domain name from file
  -C  --nocolor                      Disable Colorful Output
      --dont-fragment                Set the Don't Fragment bit (IPv4 TCP
                                     only). Default: false
  1. 右键打开命令行,输入以下命令

NextTrace 路由跟踪工具使用教程

.\nexttrace_windows_amd64.exe 1.1.1.1

 

请将 1.1.1.1 替换成需要追踪的 IP,支持 IPv4 / IPv6-注意路径。

nexttrace_windows_amd64.exe 为示例程序名,请根据实际文件名修改成对应的

更多高级命令用法可以参考项目README:https://github.com/sjlleo/nexttrace/blob/main/README_zh_CN.md

  1. 运行完命令之后,可以在下方查询到追踪结果

NextTrace 路由跟踪工具使用教程

  1. 可以使用提供的地图链接,实时显示路由情况

NextTrace 路由跟踪工具使用教程

标签: 暂无
最后更新:2025-02-19

笨猫

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

最新 热点 随机
最新 热点 随机
WinRAR 商业版下载安装和白嫖指南 Certbot申请谷歌免费SSL证书 宝塔面板卸载全解析:命令与脚本两种方式详解 SSL证书密钥类型选择RSA还是ECC算法?对网站的影响及建议 万能 一键dd windows 脚本, 含 win10/win11/server2025官方最精简版,一键激活+VC运行库 煎饼大佬的一键DD/重装脚本
煎饼大佬的一键DD/重装脚本DD一个轻量的Alpine+Linux+发行版+更轻+更快+更安全LibreTV - 免费在线视频搜索与观看平台万能 一键dd windows 脚本, 含 win10/win11/server2025官方最精简版,一键激活+VC运行库SSL证书密钥类型选择RSA还是ECC算法?对网站的影响及建议宝塔面板卸载全解析:命令与脚本两种方式详解
个性化网址导航好诶网好诶新版3.0正式上线! CowPE,基于Windows11的纯净无广告的PE系统 Muzicons:发布自己的情感单曲音乐Widget 自动去除 WordPress 评论中的链接 Surge 规则独家分享 在线AI音频人声分离、在线音乐变速
最近评论
龙笑天 发布于 3 周前(05月25日) 一直用的萌咖的路过 :smile:
C 发布于 1 个月前(05月04日) 有个更省心的路子,上传到 catbox.moe,然后用 i0.wp.com 做加速(也支持heif格...
薯条 发布于 3 个月前(03月21日) 这个博客18年了吗,好久了哎
Q 发布于 3 个月前(03月19日) 您好: 我的一个WORDPRESS站点,安装了 wp telegram插件,我在配置了Bot ...
喂 发布于 3 个月前(03月08日) 热帖ggww
标签
elliptictrue100.10.02
BLOG ChatGPT Chrome CloudFlare DirectAdmin github Godaddy google kloxo Linux OneDrive OneIndex PHP QQ shadowsocks SNS ssh Typecho VPS web2.0 whmcs Windows wordpress 一键脚本 下载 免费 博客 图文教程 图标 图片 域名 头像 奥运 宝塔面板 插件 教程 日记 有趣 浏览器 游戏 猫 生活 电影 百度 网站 视频 设计 软件 阿里云盘 音乐
好友
  • glzjin's blog glzjin's blog
  • ZAERA博客
  • 冰沫记
  • 奇它博客
  • 猫腻‘s Blog
  • 猫饭
  • 肥宅之家
  • 萌博
  • 野路子程序员

COPYRIGHT © 2022 笨猫博客. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang