3个版本

0.11.0 2024年8月11日
0.11.0-rc.22024年8月9日

1602网络编程

Download history 327/week @ 2024-08-07

每月327次下载
用于 2 个仓库

Apache-2.0

93KB
593

Continuous integration Crate Packaging status HitCount project chat #trippy-dev:matrix.org

Trippy

Trippy结合了traceroute和ping的功能,旨在帮助分析网络问题。

trippy

导航

功能

  • 使用多种协议进行跟踪
    • ICMPUDP & TCP
    • IPv4 & IPv6
  • 可自定义跟踪选项
    • 数据包大小 & 负载模式
    • 开始和最大生存时间(TTL)
    • 最小和最大往返时间
    • 回合结束宽限期 & 最大未知跳数
    • 源地址和目标端口(TCP & UDP
    • 源地址和源接口
    • TOS(即DSCP + ECN
  • 支持classicparisdublin 等价成本多路径路由策略(跟踪问题
  • RFC4884 ICMP多部分消息
    • 通用扩展对象
    • MPLS标签栈
  • 无权限模式
  • NAT检测
  • Tui界面
    • 从单个Trippy实例同时跟踪多个目标
    • 每跳统计(发送、接收、丢失率%,最后,平均,最好,最差,标准差,抖动 & 状态)
    • 每跳往返时间(RTT)历史和频率分布图
    • 具有缩放功能的交互式跳转 RTT 图表
    • 交互式 GeoIp 世界地图
    • 隔离并按单个跟踪流进行过滤
    • 可自定义颜色主题和快捷键
    • 可自定义列顺序和可见性
    • 通过命令行参数和配置文件进行配置
    • 显示每个跳转的多个主机,并可选择显示 N 个主机和频率百分比
    • 显示跳转详细信息,并在每个跳转内导航主机
    • 冻结/解冻 Tui,重置统计信息,刷新缓存,退出时保留屏幕
    • 响应式 UI,可调整刷新率
    • 跳转隐私
  • 域名系统 (DNS)
    • 使用系统、外部 (Google 8.8.8.8 或 Cloudflare 1.1.1.1) 或自定义解析器
    • 延迟反向 DNS 查询
    • 查找 自治系统 号码 (ASN) 和名称
  • GeoIp
    • 从本地的 MaxMindIPinfo mmdb 文件中查找和显示 GeoIp 信息
  • 生成跟踪报告
    • jsoncsv 和表格(美观打印和 Markdown 格式)
    • 跟踪 flows 报告
    • Graphviz dot 图表
    • 可配置的报告周期
  • 在多个平台(macOS、Linux、Windows、NetBSD、FreeBSD、OpenBSD)上运行
  • 具备功能意识的程序(仅限 Linux)

版本

以下表格列出了可用的 Trippy 版本以及相应的发行说明和文档链接

版本 发行日期 状态 发行说明 文档
0.12.0-dev n/a 开发 n/a docs
0.11.0 n/a 当前 note docs
0.10.0 2024-03-31 上一个 note docs
0.9.0 2023-11-30 已弃用 note docs
0.8.0 2023-05-15 已弃用 note docs
0.7.0 2023-03-25 已弃用 note docs
0.6.0 2022-08-19 已弃用 note docs

[!NOTE] 仅支持 Trippy 当前和上一个版本的最新修补版本。

分发

Packaging status

Cargo

Crates.io

cargo install trippy --locked

PPA (Ubuntu)

Ubuntu PPA

sudo add-apt-repository ppa:fujiapple/trippy
sudo apt update && apt install trippy

Snap (Linux)

trippy

snap install trippy

Homebrew (macOS)

Homebrew package

brew install trippy

WinGet (Windows)

winget package

winget install trippy

Scoop (Windows)

Scoop package

scoop install trippy

Chocolatey (Windows)

Chocolatey package

choco install trippy

NetBSD

pkgsrc current package

pkgin install trippy

FreeBSD

FreeBSD port

pkg install trippy

OpenBSD

OpenBSD port

pkg_add trippy

Pacman (Arch Linux)

Arch package

pacman -S trippy

Nix

nixpkgs unstable package

nix-env -iA trippy

Docker

Docker Image Version (latest by date)

docker run -it fujiapple/trippy

二进制资产下载

OS Arch Env 当前 上一个
Linux x86_64 gnu 0.11.0 0.10.0
Linux x86_64 musl 0.11.0 0.10.0
Linux aarch64 gnu 0.11.0 0.10.0
Linux aarch64 musl 0.11.0 0.10.0
Linux arm7 gnueabihf 0.11.0 0.10.0
Linux arm7 musleabi 0.11.0 0.10.0
Linux arm7 musleabihf 0.11.0 0.10.0
macOS x86_64 darwin 0.11.0 0.10.0
macOS aarch64 darwin 0.11.0 0.10.0
Windows x86_64 msvc 0.11.0 0.10.0
Windows x86_64 gnu 0.11.0 0.10.0
Windows aarch64 msvc 0.11.0 0.10.0
FreeBSD x86_64 n/a 0.11.0 0.10.0
NetBSD x86_64 n/a 0.11.0 0.10.0
RPM x86_64 gnu 0.11.0 0.10.0
Debian x86_64 gnu 0.11.0 0.10.0
Debian x86_64 musl 0.11.0 0.10.0

仓库

以下表格列出了 Trippy 提供的 crate。有关更多信息,请参阅 crate

Crate 描述
trippy Trippy 应用程序的二进制 crate 和库 crate
trippy-core 提供 Trippy 核心跟踪功能的库 crate
trippy-packet 提供数据包线格式和数据包解析功能的库 crate
trippy-dns 执行正向和反向延迟 DNS 解析的库 crate
trippy-privilege 用于发现平台权限的库 crate
trippy-tui Trippy 终端用户界面的库 crate

权限

由于使用原始套接字,Trippy 通常需要提升权限。可以通过以下几种方式启用您的平台所需的权限:以下内容。在某些平台上,也可以不使用提升权限使用 Trippy,但有一些限制。

Unix

1: 通过 sudoroot 用户运行

sudo trip example.com

2: 以 root 用户身份运行 chowntrip 并设置 setuid

sudo chown root $(which trip) && sudo chmod +s $(which trip)

3: [仅限 Linux] 设置 CAP_NET_RAW 权限

sudo setcap CAP_NET_RAW+p $(which trip)

[!注意]
Trippy 是一个具有能力感知的应用程序,如果它在允许集中存在,则会将 CAP_NET_RAW 添加到有效集中。Trippy 在创建原始套接字后将丢弃所有能力。

Windows

在 Windows 上,必须以管理员权限运行 Trippy。

无权限模式

Trippy 允许在支持该功能的平台上以非特权模式运行所有跟踪模式(ICMPUDPTCP)。

[!注意] 目前,非特权模式仅在 macOS 上受支持。Linux 的支持是可能的,并且可能在未来添加。NetBSD、FreeBSD 或 Windows 不支持非特权模式,因为这些平台不支持 IPPROTO_ICMP 套接字类型。有关更多信息,请参阅 #101

可以通过添加 --unprivileged(或 -u)命令行标志或在 配置文件trippy 部分中添加 unprivileged 条目来启用非特权模式。

[trippy]
unprivileged = true

[!注意] 在非特权模式下不支持 parisdublin ECMP 策略,因为这些策略需要操作 UDPIP 以及头部,而这反过来又需要使用原始套接字。

使用示例

基本用法和默认参数

trip example.com

不需要提升权限即可进行跟踪(仅支持的平台,请参阅 权限

trip example.com --unprivileged

使用 udp(或 tcpicmp)协议进行跟踪(也别名 --icmp--udp--tcp

trip example.com -p udp

同时跟踪多个目标(仅限 icmp 协议,请参阅 #72

trip example.com google.com crates.io

以至少 250ms 的最小往返时间和 50ms 的宽限期进行跟踪

trip example.com -i 250ms -g 50ms

使用自定义的第一个和最大 time-to-live

trip example.com --first-ttl 2 --max-ttl 10

tcp 跟踪使用自定义目标端口 443

trip example.com -p tcp -P 443

udp 跟踪使用自定义源端口 5000

trip example.com -p udp -S 5000

对于具有固定源和目标端口的 udp,使用 dublin(或 paris) ECMP 路由策略

trip example.com -p udp -R dublin -S 5000 -P 3500

使用自定义源地址进行跟踪

trip example.com -p tcp -A 127.0.0.1

使用接口 en0 的 IPv4 地址确定源地址进行跟踪

trip example.com -p tcp -I en0

使用 IPv6 进行跟踪

trip example.com -6

使用 ipv4-then-ipv6 回退(或 ipv6-then-ipv4ipv4ipv6

trip example.com --addr-family ipv4-then-ipv6

生成包含 5 轮数据的 json(或 csvprettymarkdown)跟踪报告

trip example.com -m json -C 5

在 5 轮后生成 TCP 跟踪所有跟踪流的所有 Graphviz DOT 文件报告

trip example.com --tcp -m dot -C 5

在 5 轮后生成 UDP 跟踪所有跟踪流的所有文本报告

trip example.com --udp -m flows -C 5

使用 google DNS 解析器(或 cloudflaresystemresolv)执行 DNS 查询

trip example.com -r google

查找所有发现IP地址的AS信息(系统解析器尚未可用,请参阅#66

trip example.com -r google -z

设置反向DNS查找缓存存活时间为60秒

trip example.com --dns-ttl 60sec

mmdb文件中查找并显示short(或longlocationoff)GeoIp信息

trip example.com --geoip-mmdb-file GeoLite2-City.mmdb --tui-geoip-mode short

解析icmp扩展

trip example.com -e

隐藏前两个跳转的IP地址、主机名和GeoIp

trip example.com --tui-privacy-max-ttl 2

自定义Tui列(请参阅列参考

trip example.com --tui-custom-columns holsravbwdt

自定义颜色主题

trip example.com --tui-theme-colors bg-color=blue,text-color=ffff00

列出所有可自定义颜色主题的Tui项

trip --print-tui-theme-items

自定义键绑定

trip example.com --tui-key-bindings previous-hop=k,next-hop=j,quit=shift-q

列出所有可自定义键绑定的Tui命令

trip --print-tui-binding-commands

指定Trippy配置文件的存储位置

trip example.com --config-file /path/to/trippy.toml

生成模板配置文件

trip --print-config-template > trippy.toml

生成bashshell补全(或fishpowershellzshelvish

trip --generate bash

生成ROFF手册页

trip --generate-man

silent跟踪模式运行并输出带有完整跨度事件的compact跟踪日志

trip example.com -m silent -v --log-format compact --log-span-events full

命令参考

[!注意] Trippy命令行参数可以按任意顺序给出,可以出现在目标之前或之后。

A network diagnostic tool

Usage: trip [OPTIONS] [TARGETS]...

Arguments:
  [TARGETS]...
          A space delimited list of hostnames and IPs to trace

Options:
  -c, --config-file <CONFIG_FILE>
          Config file

  -m, --mode <MODE>
          Output mode [default: tui]

          Possible values:
          - tui:      Display interactive TUI
          - stream:   Display a continuous stream of tracing data
          - pretty:   Generate a pretty text table report for N cycles
          - markdown: Generate a Markdown text table report for N cycles
          - csv:      Generate a CSV report for N cycles
          - json:     Generate a JSON report for N cycles
          - dot:      Generate a Graphviz DOT file for N cycles
          - flows:    Display all flows for N cycles
          - silent:   Do not generate any tracing output for N cycles

  -u, --unprivileged
          Trace without requiring elevated privileges on supported platforms
          [default: false]

  -p, --protocol <PROTOCOL>
          Tracing protocol [default: icmp]

          Possible values:
          - icmp: Internet Control Message Protocol
          - udp:  User Datagram Protocol
          - tcp:  Transmission Control Protocol

      --udp
          Trace using the UDP protocol

      --tcp
          Trace using the TCP protocol

      --icmp
          Trace using the ICMP protocol

  -F, --addr-family <ADDR_FAMILY>
          The address family [default: Ipv4thenIpv6]

          Possible values:
          - ipv4:           Ipv4 only
          - ipv6:           Ipv6 only
          - ipv6-then-ipv4: Ipv6 with a fallback to Ipv4
          - ipv4-then-ipv6: Ipv4 with a fallback to Ipv6

  -4, --ipv4
          Use IPv4 only

  -6, --ipv6
          Use IPv6 only

  -P, --target-port <TARGET_PORT>
          The target port (TCP & UDP only) [default: 80]

  -S, --source-port <SOURCE_PORT>
          The source port (TCP & UDP only) [default: auto]

  -A, --source-address <SOURCE_ADDRESS>
          The source IP address [default: auto]

  -I, --interface <INTERFACE>
          The network interface [default: auto]

  -i, --min-round-duration <MIN_ROUND_DURATION>
          The minimum duration of every round [default: 1s]

  -T, --max-round-duration <MAX_ROUND_DURATION>
          The maximum duration of every round [default: 1s]

  -g, --grace-duration <GRACE_DURATION>
          The period of time to wait for additional ICMP responses after the
          target has responded [default: 100ms]

      --initial-sequence <INITIAL_SEQUENCE>
          The initial sequence number [default: 33434]

  -R, --multipath-strategy <MULTIPATH_STRATEGY>
          The Equal-cost Multi-Path routing strategy (UDP only) [default:
          classic]

          Possible values:
          - classic:
            The src or dest port is used to store the sequence number
          - paris:
            The UDP `checksum` field is used to store the sequence number
          - dublin:
            The IP `identifier` field is used to store the sequence number

  -U, --max-inflight <MAX_INFLIGHT>
          The maximum number of in-flight ICMP echo requests [default: 24]

  -f, --first-ttl <FIRST_TTL>
          The TTL to start from [default: 1]

  -t, --max-ttl <MAX_TTL>
          The maximum number of TTL hops [default: 64]

      --packet-size <PACKET_SIZE>
          The size of IP packet to send (IP header + ICMP header + payload)
          [default: 84]

      --payload-pattern <PAYLOAD_PATTERN>
          The repeating pattern in the payload of the ICMP packet [default: 0]

  -Q, --tos <TOS>
          The TOS (i.e. DSCP+ECN) IP header value (TCP and UDP only) [default: 0]

  -e, --icmp-extensions
          Parse ICMP extensions

      --read-timeout <READ_TIMEOUT>
          The socket read timeout [default: 10ms]

  -r, --dns-resolve-method <DNS_RESOLVE_METHOD>
          How to perform DNS queries [default: system]

          Possible values:
          - system:     Resolve using the OS resolver
          - resolv:     Resolve using the `/etc/resolv.conf` DNS configuration
          - google:     Resolve using the Google `8.8.8.8` DNS service
          - cloudflare: Resolve using the Cloudflare `1.1.1.1` DNS service

  -y, --dns-resolve-all
          Trace to all IPs resolved from DNS lookup [default: false]

      --dns-timeout <DNS_TIMEOUT>
          The maximum time to wait to perform DNS queries [default: 5s]

      --dns-ttl <DNS_TTL>
          The time-to-live (TTL) of DNS entries [default: 300s]

  -z, --dns-lookup-as-info
          Lookup autonomous system (AS) information during DNS queries [default:
          false]

  -s, --max-samples <MAX_SAMPLES>
          The maximum number of samples to record per hop [default: 256]

      --max-flows <MAX_FLOWS>
          The maximum number of flows to record [default: 64]

  -a, --tui-address-mode <TUI_ADDRESS_MODE>
          How to render addresses [default: host]

          Possible values:
          - ip:   Show IP address only
          - host: Show reverse-lookup DNS hostname only
          - both: Show both IP address and reverse-lookup DNS hostname

      --tui-as-mode <TUI_AS_MODE>
          How to render AS information [default: asn]

          Possible values:
          - asn:          Show the ASN
          - prefix:       Display the AS prefix
          - country-code: Display the country code
          - registry:     Display the registry name
          - allocated:    Display the allocated date
          - name:         Display the AS name

      --tui-custom-columns <TUI_CUSTOM_COLUMNS>
          Custom columns to be displayed in the TUI hops table [default:
          holsravbwdt]

      --tui-icmp-extension-mode <TUI_ICMP_EXTENSION_MODE>
          How to render ICMP extensions [default: off]

          Possible values:
          - off:  Do not show `icmp` extensions
          - mpls: Show MPLS label(s) only
          - full: Show full `icmp` extension data for all known extensions
          - all:  Show full `icmp` extension data for all classes

      --tui-geoip-mode <TUI_GEOIP_MODE>
          How to render GeoIp information [default: short]

          Possible values:
          - off:      Do not display GeoIp data
          - short:    Show short format
          - long:     Show long format
          - location: Show latitude and Longitude format

  -M, --tui-max-addrs <TUI_MAX_ADDRS>
          The maximum number of addresses to show per hop [default: auto]

      --tui-preserve-screen
          Preserve the screen on exit [default: false]

      --tui-refresh-rate <TUI_REFRESH_RATE>
          The Tui refresh rate [default: 100ms]

      --tui-privacy-max-ttl <TUI_PRIVACY_MAX_TTL>
          The maximum ttl of hops which will be masked for privacy [default: 0]

      --tui-theme-colors <TUI_THEME_COLORS>
          The TUI theme colors [item=color,item=color,..]

      --print-tui-theme-items
          Print all TUI theme items and exit

      --tui-key-bindings <TUI_KEY_BINDINGS>
          The TUI key bindings [command=key,command=key,..]

      --print-tui-binding-commands
          Print all TUI commands that can be bound and exit

  -C, --report-cycles <REPORT_CYCLES>
          The number of report cycles to run [default: 10]

  -G, --geoip-mmdb-file <GEOIP_MMDB_FILE>
          The supported MaxMind or IPinfo GeoIp mmdb file

      --generate <GENERATE>
          Generate shell completion

          [possible values: bash, elvish, fish, powershell, zsh]

      --generate-man
          Generate ROFF man page

      --print-config-template
          Print a template toml config file and exit

      --log-format <LOG_FORMAT>
          The debug log format [default: pretty]

          Possible values:
          - compact: Display log data in a compact format
          - pretty:  Display log data in a pretty format
          - json:    Display log data in a json format
          - chrome:  Display log data in Chrome trace format

      --log-filter <LOG_FILTER>
          The debug log filter [default: trippy=debug]

      --log-span-events <LOG_SPAN_EVENTS>
          The debug log format [default: off]

          Possible values:
          - off:    Do not display event spans
          - active: Display enter and exit event spans
          - full:   Display all event spans

  -v, --verbose
          Enable verbose debug logging

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

主题参考

以下表格列出了默认的Tui颜色主题。这些可以被命令行选项--tui-theme-colors或配置文件中theme-colors部分覆盖。

项目 描述 默认值
bg-color 默认背景颜色 黑色
border-color 默认边框颜色 灰色
text-color 默认文本颜色 灰色
tab-text-color 跟踪标签中文本的颜色 绿色
hops-table-header-bg-color 跳转表头的背景颜色 白色
hops-table-header-text-color 跳转表头中的文本颜色 黑色
hops-table-row-active-text-color 跳转表头中活动行的文本颜色 灰色
hops-table-row-inactive-text-color 跳转表头中非活动行的文本颜色 深灰色
hops-chart-selected-color 跳转图中选择系列的颜色 绿色
hops-chart-unselected-color 跳转图中未选择系列的颜色 灰色
hops-chart-axis-color 跳转图中轴的颜色 深灰色
frequency-chart-bar-color 频率图中条的颜色 绿色
frequency-chart-text-color 频率图中条上文本的颜色 灰色
flows-chart-bar-selected-color 流量图中选择条的颜色 绿色
flows-chart-bar-unselected-color 流量图中未选择条的颜色 深灰色
flows-chart-text-current-color 流量图中当前流文本的颜色 浅绿色
flows-chart-text-non-current-color 流量图中非当前流文本的颜色 白色
samples-chart-color 样本图的颜色 黄色
help-dialog-bg-color 帮助对话框的背景颜色 蓝色
help-dialog-text-color 帮助对话框中文本的颜色 灰色
settings-dialog-bg-color 设置对话框的背景颜色 蓝色
settings-tab-text-color 设置对话框标签中文本的颜色 绿色
settings-table-header-text-color 设置表头中的文本颜色 黑色
settings-table-header-bg-color 设置表头背景颜色 白色
settings-table-row-text-color 设置表中行的文本颜色 灰色
map-world-color 世界地图的颜色 白色
map-radius-color 地图精度半径圆的颜色 黄色
map-selected-color 地图选中项框的颜色 绿色
map-info-panel-border-color 地图信息面板边框的颜色 灰色
map-info-panel-bg-color 地图信息面板的背景颜色 黑色
map-info-panel-text-color 地图信息面板中文本的颜色 灰色

支持以下ANSI颜色

  • 黑色, 红色, 绿色, 黄色, 蓝色, 品红色, 青色, 灰色, 深灰色, 浅红色, 浅绿色, 浅黄色, 浅蓝色, 浅品红色, 浅青色, 白色

此外,还可以使用CSS 命名颜色(例如 SkyBlue)和原始十六进制值(例如 ffffff),但请注意,这些在某些平台和终端上可能不受支持,并且可能无法在其他地方正确显示。

颜色名称不区分大小写,并且可以包含连字符。

快捷键参考

以下表格列出了默认的Tui命令键绑定。这些可以通过命令行选项--tui-key-bindings或配置文件中的bindings部分来覆盖。

命令 描述 默认值
toggle-help 切换帮助 h
toggle-help-alt 切换帮助(替代绑定) ?
toggle-settings 切换设置 s
toggle-settings-tui 打开设置(Tui选项卡) 1
toggle-settings-trace 打开设置(Trace选项卡) 2
toggle-settings-dns 打开设置(Dns选项卡) 3
toggle-settings-geoip 打开设置(GeoIp选项卡) 4
toggle-settings-bindings 打开设置(Bindings选项卡) 5
toggle-settings-theme 打开设置(Theme选项卡) 6
toggle-settings-columns 打开设置(Columns选项卡) 7
next-hop 选择下一跳 down
previous-hop 选择上一跳 up
next-trace 选择下一条记录 right
previous-trace 选择上一条记录 left
next-hop-address 选择下一跳地址 .
previous-hop-address 选择上一跳地址 ,
address-mode-ip 仅显示IP地址 i
address-mode-host 仅显示主机名 n
address-mode-both 显示IP地址和主机名 b
toggle-freeze 切换显示冻结 ctrl+f
toggle-chart 切换图表 c
toggle-map 切换GeoIp地图 m
toggle-flows 切换流 f
toggle-privacy 切换跳数隐私 p
expand-hosts 展开每个跳的显示主机 ]
expand-hosts-max 将每个跳显示的主机展开到最大 }
contract-hosts 收缩每个跳显示的主机 [
contract-hosts-min 将每个跳显示的主机收缩到最小 {
chart-zoom-in 放大图表 =
chart-zoom-out 缩小图表 -
clear-trace-data 清除所有跟踪数据 ctrl+r
clear-dns-cache 刷新DNS缓存 ctrl+k
clear-selection 清除当前选择 esc
toggle-as-info 切换AS信息显示 z
toggle-hop-details 切换跳详情 d
quit 退出应用程序 q

支持的可选修饰符有:shiftctrlaltsuperhyper 以及 meta。可以指定多个修饰符,例如 ctrl+shift+b

列参考

以下表格列出了在Tui中可显示的列。这些列可以通过命令行选项 --tui-custom-columns 或配置文件中 tui 部分的 tui-custom-columns 属性来覆盖。

代码 描述
# h 跳转的生存时间 (TTL)
主机 o 跳转的主机名和IP地址
可能包括AS信息、GeoIp和ICMP扩展
在跳转详细导航模式下显示完整的跳转详细信息
丢失% l 跳转的丢包率%
发送 s 发送给跳转的探测包数量
接收 r 接收到的跳转探测包响应数量
最后 a 最后一次探测的跳转往返时间 (RTT)
平均 v 所有探测的跳转的平均RTT
最佳 b 所有探测的跳转中的最佳RTT
最差 w 所有探测的跳转中的最差RTT
标准差 d 所有探测的跳转的标准差
状态 t 跳转的状态
- 🟢 健康的跳转
- 🔵 非目标跳转有丢包(不一定表示问题)
- 🟤 非目标跳转无响应(不一定表示问题)
- 🟡 目标跳转有丢包(可能表示问题)
- 🔴 目标跳转无响应(可能表示问题)
抖动 j 连续轮次之间的往返时间 (RTT) 差异
平均 g 所有探测的跳转的平均抖动
最大 x 所有探测的跳转中的最大抖动
积分 i The smoothed jitter value of all probes for the hop
序列 Q 最后一次探测的跳转的序列号
端口 S 最后一次探测的跳转的源端口
目的端口 P 最后一次探测的跳转的目的端口
类型 T 最后一次探测的跳转的ICMP包类型
- TE: TimeExceeded
- ER: EchoReply
- DU: DestinationUnreachable
- NA: NotApplicable
代码 C 最后一次探测的跳转的ICMP包代码
NAT N 跳转的NAT检测状态
失败 f 无法发送的探测包数量

默认列是 holsravbwdt

[!注意] 列将按照配置中的顺序显示。

配置参考

Trippy 可以通过命令行参数或可选的配置文件进行配置。如果在配置文件和命令行参数中都指定了给定的配置项,则后者将优先。

可以通过 -c--config-file)参数提供 Trippy 的配置文件位置。如果没有提供,Trippy 将尝试在以下位置之一查找 trippy.toml.trippy.toml 配置文件

  • 当前目录
  • 用户主目录
  • Unix系统中的XDG配置目录:$XDG_CONFIG_HOME~/.config
  • 仅限Windows的数据目录:%APPDATA%

针对版本 0.9.00.10.00.11.0,提供了注释模板配置文件。

Trippy(版本 0.9.0 或更高版本)可以生成模板配置文件

trip --print-config-template > trippy.toml

常见问题解答

为什么Trippy显示“等待数据...”?

[!IMPORTANT]
如果您使用的是Windows,您必须 配置 Windows Defender防火墙以允许传入的ICMP流量。

当Trippy显示“等待数据...”时,这意味着它在一个跟踪过程中收到的响应为零。这表明探测可能没有被发送,或者更常见的是,没有收到响应。

请确保本地和网络防火墙允许ICMP流量,并且系统中的 traceroute(或Windows上的 tracert.exe)按预期工作。请注意,在Windows上,即使 tracert.exe按预期工作,您也必须 配置 Windows Defender防火墙以允许传入的ICMP流量。

对于更深入的诊断,您可以运行如 https://www.wireshark.orghttps://www.tcpdump.org 的工具来验证icmp请求和响应是否被发送和接收。

如何在Windows Defender防火墙中允许传入的ICMP流量?

可以使用PowerShell创建Windows Defender防火墙规则。

New-NetFirewallRule -DisplayName "ICMPv4 Trippy Allow" -Name ICMPv4_TRIPPY_ALLOW -Protocol ICMPv4 -Action Allow
New-NetFirewallRule -DisplayName "ICMPv6 Trippy Allow" -Name ICMPv6_TRIPPY_ALLOW -Protocol ICMPv6 -Action Allow

以下是如何启用规则:

Enable-NetFirewallRule ICMPv4_TRIPPY_ALLOW
Enable-NetFirewallRule ICMPv6_TRIPPY_ALLOW

以下是如何禁用规则:

Disable-NetFirewallRule ICMPv4_TRIPPY_ALLOW
Disable-NetFirewallRule ICMPv6_TRIPPY_ALLOW

Windows Defender防火墙规则也可以手动配置,有关逐步指南,请参阅 此处

没有针对Trippy的具体推荐设置,它提供了一系列可配置的功能,可用于执行不同类型的分析。设置的选择将取决于您要执行的分析以及您的工作环境。

以下列出了一些常见选项,以及一些基本指导,说明何时可能适用:

[!NOTE] Windows的 tracert 工具默认使用ICMP,而大多数Unix traceroute 工具默认使用UDP。

ICMP

默认情况下,Trippy将对目标运行ICMP跟踪。这通常会在每次跟踪中产生对目标的固定路径(单个流),这使得读取和分析变得容易。这对于一般的网络故障排除非常有用。

然而,许多路由器被配置为限制ICMP流量,这可能使得获取准确的丢包率图像变得困难。此外,ICMP流量通常不受ECMP路由的影响,因此可能不会反映UDP和TCP等其他协议可能采用的路径。

要运行简单的ICMP跟踪

trip example.com

由于ICMP流量的限制,有些人更喜欢在Tui中隐藏 Loss%Recv 列,因为这些容易误读。

trip example.com --tui-custom-columns hosavbwdt

可以通过将它们添加到Trippy配置文件中来使这些设置永久化。

[tui]
custom-columns = "hosavbwdt"

[!注意] 《Sts》列通过不同的颜色代码反映中间路由器与目标路由器之间的分组丢失情况,更多信息请参见列参考

具有固定端口的UDP/Dublin

UDP跟踪提供了一种更真实地观察受ECMP路由影响的流量路径的方法。

在33434-33534的范围内设置一个固定的目标端口可能允许Trippy确定探针已到达目标,因为许多路由器和防火墙配置为允许该范围内的UDP探针,并将以目标不可达响应。

然而,使用固定目标端口和可变源端口的UDP跟踪通常会导致每次跟踪轮次中的每个探针遵循不同的路径。这可能会使得输出难以解释,因为不同的主机将在轮次之间为给定跳数(生存时间)回复。

通过使用dublin ECMP策略,该策略将序列号编码在IP identifier字段中,Trippy可以固定源端口和目标端口,通常在每次跟踪轮次中的每个探针都会遵循单一路径。

[!注意] UDP/Dublin对于IPv6将序列号编码为有效载荷长度,因为在IPv6中IP identifier字段不可用。

[!注意] 请记住,每个探针都是一个独立的试验,并且每个都可能穿越完全不同的路径。在实践中,ICMP探针通常遵循单一路径,而UDP和TCP探针的路径通常由协议、源和目的IP地址以及端口的五元组确定。

也要注意,返回路径可能不与前进路径相同,也可能因探针而异。例如dublinparis这样的策略可以帮助控制前向探针的路径,但不能帮助控制返回路径。因此,建议在两个方向上运行跟踪以获得全面的了解。

要使用dublin ECMP策略运行具有固定源和目标端口的UDP跟踪

trip example.com --udp --multipath-strategy dublin --source-port 5000 --target-port 33434

[!注意] 源端口可以是任何有效的端口号,但目标端口通常应在33434-33534的范围内或目标主机上允许UDP探针的任何范围。

可以通过将它们添加到Trippy配置文件中来使这些设置永久化。

[strategy]
protocol = "udp"
multipath-strategy = "dublin"
source-port = 5000
target-port = 33434

具有固定目标端口和可变源端口的UDP/Dublin

作为上述内容的扩展,如果您在使用dublin ECMP策略时没有固定源端口,Trippy将在每次跟踪轮次中更改源端口(即,给定轮次中的每个探针将共享相同的源端口,并且源端口将在每个轮次中更改)。这通常会导致给定轮次中的每个探针遵循相同的路径,但每个轮次遵循不同的路径。

可以通过按toggle-flows键绑定(默认为f键)在Trippy Tui中探索这些单独的流。

SeqSprtDprt列添加到Tui将分别显示序列号、源端口和目标端口,这使得可视化更加容易。

trip example.com --udp --multipath-strategy dublin --target-port 33434 --tui-custom-columns holsravbwdtSPQ

可以通过将它们添加到Trippy配置文件中来使这些设置永久化。

[strategy]
protocol = "udp"
multipath-strategy = "dublin"
target-port = 33434

[tui]
custom-columns = "holsravbwdtSPQ"

为了使流更容易可视化,您可以生成所有跟踪流的Graphviz DOT文件报告

trip example.com --udp --multipath-strategy dublin --target-port 33434 -m dot -C 5

UDP/Paris

使用paris ECMP策略的UDP提供了与固定端口dublin策略相同的优势,并且可以使用相同的方式使用。

它们在探针中编码序列号的方式上有所不同。《code>dublin策略使用IP《code>标识符字段,而《code>paris策略使用UDP《code>校验和字段。

要使用《code>paris ECMP策略运行具有固定源端口和目标端口的UDP跟踪

trip example.com --udp --multipath-strategy paris --source-port 5000 --target-port 33434

由于UDP《code>校验和字段通常会被NAT设备修改,所以当存在NAT时,《code>dublin策略更推荐。

[!NOTE] 在某些情况下,使用《code>dublin策略时,Trippy可以检测到NAT设备的存在,并且可以在Tui的《code>Nat列中显示以指示何时检测到NAT。更多信息请参阅《a href="#readme-column-reference" rel="noopener ugc nofollow">Column Reference。

TCP

TCP跟踪类似于UDP跟踪,因为它提供了对受ECMP路由影响的流量路径的更真实视图。

TCP跟踪默认使用目标端口80,并将源端口设置为序列号,这通常会导致每个跟踪轮次中的每个探针遵循不同的路径。

要运行TCP跟踪

trip example.com --tcp

TCP跟踪对于诊断TCP连接和高层协议(如HTTP)的问题很有用。通常,可以替代TCP使用UDP跟踪来诊断IP层网络问题,因为它提供了控制探针路径的方法,因此通常更受欢迎。

[!NOTE] Trippy不支持TCP跟踪的《code>dublin或《code>paris ECMP策略,因此您不能同时固定源端口和目标端口。有关详细信息,请参阅《a href="https://github.com/fujiapple852/trippy/issues/274" rel="noopener ugc nofollow">tracking issue。

鸣谢

Trippy由《a href="https://github.com/ratatui-org/ratatui" rel="noopener ugc nofollow">ratatui(以前称为《a href="https://github.com/fdehau/tui-rs" rel="noopener ugc nofollow">tui-rs)和《a href="https://github.com/crossterm-rs/crossterm" rel="noopener ugc nofollow">crossterm以及《a href="https://github.com/fujiapple852/trippy/blob/master/Cargo.toml" rel="noopener ugc nofollow">几个基础Rust库共同支持。

Trippy从《a href="https://github.com/traviscross/mtr" rel="noopener ugc nofollow">mtr中汲取了大量灵感,并吸收了来自《a href="https://github.com/libparistraceroute/libparistraceroute" rel="noopener ugc nofollow">libparistraceroute和《a href="https://github.com/insomniacslk/dublin-traceroute" rel="noopener ugc nofollow">Dublin Traceroute》两方的想法。

Trippy的网络安全代码受到了《a href="https://github.com/libpnet/libpnet" rel="noopener ugc nofollow">pnet的启发,并且该代码库的一些元素被整合到了Trippy中。

来自《a href="https://team-cymru.com/community-services/ip-asn-mapping/#dns" rel="noopener ugc nofollow">IP到ASN映射服务的《a href="https://team-cymru.com" rel="noopener ugc nofollow">Team Cymru检索了《a href="https://en.wikipedia.org/wiki/Autonomous_system_(Internet)" rel="noopener ugc nofollow">AS数据。

《a href="https://trippy.cli.rs" rel="noopener ugc nofollow">trippy.cli.rs的CNAME托管由《a href="https://cli.rs" rel="noopener ugc nofollow">cli.rs提供。

Trippy聊天室由《a href="https://zulip.com" rel="noopener ugc nofollow">Zulip赞助。

许可

本项目根据Apache许可证(版本2.0)的条款分发。

除非您明确表示,否则您有意提交的任何贡献,根据Apache-2.0许可证的定义,均应按上述方式许可,不附加任何额外条款或条件。

有关详细信息,请参阅《a href="https://github.com/fujiapple852/trippy/blob/31378e735defdd5c468ee21c5c614a3306e8be88/crates/trippy-dns/LICENSE" rel="noopener ugc nofollow">LICENSE。

版权所有 2022 《a href="https://github.com/fujiapple852/trippy/graphs/contributors" rel="noopener ugc nofollow">Trippy贡献者

依赖关系

~6–15MB
~193K SLoC