# nprobe **Repository Path**: movee/nprobe ## Basic Information - **Project Name**: nprobe - **Description**: 基于golang实现的网络探测(ping)工具,支持丰富的探测协议,如icmp echo、tcp syn、udp、udp echo、tcp echo等,同时基于一个叫做ping-pong ringbuffer的无锁数据结构进行探测结果的聚合统计。 - **Primary Language**: Go - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-11-30 - **Last Updated**: 2024-12-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # nprobe #### 介绍 基于golang实现的网络探测(ping)工具,支持丰富的探测协议,如icmp echo、tcp syn、udp、udp echo、tcp echo等,同时基于一个叫做ping-pong ringbuffer的无锁数据结构进行探测结果的聚合统计。 #### 使用说明 ```bash # ./nprobe -h Usage of ./output/nprobe: ./output/nprobe [-options] target --bit-flip check packet bit flip events -c, --count int repeat count of probe flow (default 9223372036854775807) --dport string destination port or port range, while use udp or tcp, use multi sport and dport to cover ecmp paths (default "53") -h, --help help info --length int payload data length (default 64) -l, --listen work as a server --pps int packets count per second of a target (default 10) -s, --sources string source address, while use icmp echo, use multi sources to cover ecmp paths --span int time duration for statistical, measured in milliseconds (default 1000) --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 packet instead of icmp echo -S, --tcpsyn use tcp syn packet instead of icmp echo -t, --timeout int message response timeout time, measured in milliseconds (default 1000) --tos uint8 tos --ttl uint8 ttl (default 64) -U, --udp use udp datagram instead of icmp echo --with-echo-server whether udp probe working with a echo server ``` ##### icmp ```bash # ./nprobe 10.131.21.20,10.54.49.39 seq target total loss bitflip success min(ms) avg(ms) max(ms) 1 10.131.21.20 3 0 0 100% 0.15 0.17 0.18 10.54.49.39 3 0 0 100% 48.39 48.40 48.41 2 10.131.21.20 10 0 0 100% 0.10 0.15 0.20 10.54.49.39 10 0 0 100% 48.30 48.33 48.41 3 10.131.21.20 10 0 0 100% 0.13 0.13 0.14 10.54.49.39 10 0 0 100% 48.30 48.31 48.32 4 10.131.21.20 10 0 0 100% 0.12 0.13 0.15 10.54.49.39 10 0 0 100% 48.31 48.31 48.33 5 10.131.21.20 10 0 0 100% 0.10 0.13 0.14 10.54.49.39 10 0 0 100% 48.31 48.31 48.32 ``` ##### tcpsyn ```bash # ./nprobe -S 10.54.49.39 seq target total loss bitflip success min(ms) avg(ms) max(ms) 1 10.54.49.39 4 0 0 100% 48.28 50.95 52.29 2 10.54.49.39 10 0 0 100% 43.27 57.16 67.04 3 10.54.49.39 10 0 0 100% 42.81 51.77 62.45 4 10.54.49.39 10 0 0 100% 42.89 51.61 58.94 5 10.54.49.39 10 0 0 100% 43.76 50.05 54.47 6 10.54.49.39 10 0 0 100% 43.01 51.23 58.20 7 10.54.49.39 10 0 0 100% 44.12 52.86 61.54 ``` ##### udp 目标没有监听相应的端口,根据icmp destination unreachable报文判断是否丢包 ```bash # ./nprobe -U yq01-sdn-online50.yq01,szm3b-szlab-dev25.szm3b seq target total loss bitflip success min(ms) avg(ms) max(ms) 1 10.131.21.20 3 0 0 100% 0.16 0.18 0.21 10.54.49.39 3 0 0 100% 53.14 53.89 54.56 2 10.131.21.20 10 6 0 40.0000% 0.00 0.13 0.68 10.54.49.39 10 0 0 100% 48.39 57.17 64.25 ===================================== abnormal loss flows: 10.131.21.17:63006->10.131.21.20:53 10.131.21.17:63007->10.131.21.20:53 10.131.21.17:63008->10.131.21.20:53 10.131.21.17:63009->10.131.21.20:53 10.131.21.17:63011->10.131.21.20:53 10.131.21.17:63012->10.131.21.20:53 ``` ##### udp echo 启动udp echo server ```bash # ./nprobe -U -l seq source total loss bitflip success min(ms) avg(ms) max(ms) 1 10.131.21.17 8 0 0 100% 0.00 0.00 0.00 2 10.131.21.17 10 0 0 100% 0.00 0.00 0.00 3 10.131.21.17 10 0 0 100% 0.00 0.00 0.00 4 10.131.21.17 10 0 0 100% 0.00 0.00 0.00 5 10.131.21.17 10 0 0 100% 0.00 0.00 0.00 ``` 使用客户端进行探测 ```bash # /nprobe -U --with-echo-server 10.131.21.17 seq target total loss bitflip success min(ms) avg(ms) max(ms) 1 10.131.21.17 8 0 0 100% 0.07 0.10 0.15 2 10.131.21.17 10 0 0 100% 0.05 0.07 0.09 3 10.131.21.17 10 0 0 100% 0.06 0.07 0.09 4 10.131.21.17 10 0 0 100% 0.05 0.07 0.13 5 10.131.21.17 10 0 0 100% 0.05 0.07 0.09 ``` ##### tcp echo 启动tcp echo server ```bash # ./nprobe -T -l seq source total loss bitflip success min(ms) avg(ms) max(ms) 1 10.131.21.17 2 0 0 100% 0.00 0.00 0.00 2 10.131.21.17 10 0 0 100% 0.00 0.00 0.00 3 10.131.21.17 10 0 0 100% 0.00 0.00 0.00 4 10.131.21.17 10 0 0 100% 0.00 0.00 0.00 5 10.131.21.17 10 0 0 100% 0.00 0.00 0.00 ``` 使用客户端进行探测 ```bash # ./output/nprobe -T 10.131.21.17 seq target total loss bitflip success min(ms) avg(ms) max(ms) 1 10.131.21.17 2 0 0 100% 0.10 0.12 0.15 2 10.131.21.17 10 0 0 100% 0.04 0.06 0.10 3 10.131.21.17 10 0 0 100% 0.05 0.07 0.12 4 10.131.21.17 10 0 0 100% 0.05 0.06 0.08 5 10.131.21.17 10 0 0 100% 0.04 0.06 0.08 ```