# ntrace **Repository Path**: movee/ntrace ## Basic Information - **Project Name**: ntrace - **Description**: 网络traceroute跟踪分析工具的一个golang实现,支持icmp、udp和tcpsyn,同时会统计丢包和时延,并分析出异常的trace路径信息,以便于网络分析与故障定位 - **Primary Language**: Go - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-16 - **Last Updated**: 2024-11-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ntrace #### 介绍 网络traceroute跟踪分析工具的一个golang实现,支持icmp、udp和tcpsyn,同时会统计丢包和时延,并分析出异常的trace路径信息,以便于网络分析与故障定位 #### 软件架构 软件架构说明 #### 使用说明 ```bash # ./ntrace -h Usage of ./ntrace: ./ntrace [-options] target -c, --count int repeat count of trace flow (default 10) --dport string destination port or port range, while use udp or tcp, use multi sport and dport to cover ecmp paths (default "53") --flow-interval int flow interval time, measured in milliseconds (default 100) -h, --help help info -l, --length int payload data length (default 64) --max-ttl uint8 max ttl (default 32) --print-interval int interval time of print statistical data, measured in milliseconds (default 5000) -s, --sources string source address, while use icmp echo, use multi sources to cover ecmp paths --sport string source port or port range, while use udp or tcp, use multi sport and dport to cover ecmp paths (default "63000-63999") -T, --tcp use tcp syn packet instead of icmp echo -t, --timeout int message response timeout time, measured in milliseconds (default 1000) --tos uint8 tos -U, --udp use udp datagram instead of icmp echo ``` ##### icmp ```bash # ./ntrace --max-ttl 12 -c 1 10.54.49.39 ===================================== ttl host total loss success min(ms) avg(ms) max(ms) 1 10.131.21.1 1 0 100% 3.97 3.97 3.97 2 10.131.128.37 1 0 100% 0.35 0.35 0.35 3 ? 1 1 0% 0.00 0.00 0.00 4 ? 1 1 0% 0.00 0.00 0.00 5 ? 1 1 0% 0.00 0.00 0.00 6 ? 1 1 0% 0.00 0.00 0.00 7 10.166.66.65 1 0 100% 42.97 42.97 42.97 8 10.165.64.11 1 0 100% 52.63 52.63 52.63 9 10.165.18.185 1 0 100% 56.69 56.69 56.69 10 10.165.0.201 1 0 100% 42.89 42.89 42.89 11 10.54.49.39 2 0 100% 52.15 52.17 52.18 ===================================== abnormal flows: 10.131.21.17->10.54.49.39 : 10.131.21.1, 10.131.128.37, ?, ?, ?, ?, 10.166.66.65, 10.165.64.11, 10.165.18.185, 10.165.0.201, 10.54.49.39 ``` ##### udp ```bash # ./trace -U --max-ttl 13 -c 1 -t 1000 --sport 54-55 10.54.49.39 ===================================== ttl host total loss success min(ms) avg(ms) max(ms) 1 10.131.21.1 2 0 100% 1.22 5.72 10.21 2 10.131.128.37 2 0 100% 0.27 0.29 0.31 3 ? 2 2 0% 0.00 0.00 0.00 4 10.166.210.79 2 1 50% 37.89 18.95 37.89 ? 5 10.105.1.217 2 1 50% 45.11 45.11 45.11 ? 6 ? 2 2 0% 0.00 0.00 0.00 7 10.165.91.135 2 0 100% 45.24 45.95 46.66 10.166.66.53 8 10.165.20.198 2 0 100% 45.28 46.81 48.34 10.165.64.19 9 10.165.18.215 2 0 100% 45.85 48.20 50.56 10.165.18.37 10 10.165.0.139 2 0 100% 42.26 43.78 45.31 10.165.0.9 11 10.54.49.39 6 0 100% 50.11 50.96 51.79 ===================================== abnormal flows: 10.131.21.17:54->10.54.49.39:53 : 10.131.21.1, 10.131.128.37, ?, ?, 10.105.1.217, ?, 10.166.66.53, 10.165.64.19, 10.165.18.37, 10.165.0.9, 10.54.49.39 10.131.21.17:55->10.54.49.39:53 : 10.131.21.1, 10.131.128.37, ?, 10.166.210.79, ?, ?, 10.165.91.135, 10.165.20.198, 10.165.18.215, 10.165.0.139, 10.54.49.39 ``` ##### tcp ```bash # go run main.go -T --max-ttl 13 -c 1 -t 1000 --sport 54-55 10.54.49.39 ===================================== ttl host total loss success min(ms) avg(ms) max(ms) 1 10.131.21.1 2 0 100% 1.67 1.74 1.81 2 10.131.128.37 2 0 100% 0.28 0.31 0.35 3 ? 2 2 0% 0.00 0.00 0.00 4 10.166.210.79 2 1 50% 37.72 18.86 37.72 ? 5 10.105.1.217 2 1 50% 45.28 45.28 45.28 ? 6 ? 2 2 0% 0.00 0.00 0.00 7 10.165.91.135 2 0 100% 45.31 45.96 46.62 10.166.66.53 8 10.165.20.64 2 0 100% 49.06 53.74 58.42 10.165.64.19 9 10.165.18.37 2 0 100% 49.38 49.97 50.56 10.165.18.87 10 10.165.0.139 2 0 100% 42.48 43.91 45.34 10.165.0.9 11 10.54.49.39 2 0 100% 45.44 46.41 47.38 ===================================== abnormal flows: 10.131.21.17:54->10.54.49.39:53 : 10.131.21.1, 10.131.128.37, ?, ?, 10.105.1.217, ?, 10.166.66.53, 10.165.64.19, 10.165.18.37, 10.165.0.9, 10.54.49.39 10.131.21.17:55->10.54.49.39:53 : 10.131.21.1, 10.131.128.37, ?, 10.166.210.79, ?, ?, 10.165.91.135, 10.165.20.64, 10.165.18.87, 10.165.0.139, 10.54.49.39 ``` #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request`