File: 2ping.1

package info (click to toggle)
2ping 4.5-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 492 kB
  • sloc: python: 3,304; makefile: 44; sh: 4
file content (339 lines) | stat: -rw-r--r-- 12,794 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
.\" Automatically generated by Pandoc 2.5
.\"
.TH "2PING" "1" "" "" "2ping"
.hy
.SH NAME
.PP
2ping \- A bi\-directional ping utility
.SH SYNOPSIS
.PP
2ping [\f[I]options\f[R]] \f[I]\-\-listen\f[R] | host/IP [host/IP
[\&...]]
.SH DESCRIPTION
.PP
\f[C]2ping\f[R] is a bi\-directional ping utility.
It uses 3\-way pings (akin to TCP SYN, SYN/ACK, ACK) and
after\-the\-fact state comparison between a 2ping listener and a 2ping
client to determine which direction packet loss occurs.
.PP
To use 2ping, start a listener on a known stable network host.
The relative network stability of the 2ping listener host should not be
in question, because while 2ping can determine whether packet loss is
occurring inbound or outbound relative to an endpoint, that will not
help you determine the cause if both of the endpoints are in question.
.PP
Once the listener is started, start 2ping in client mode and tell it to
connect to the listener.
The ends will begin pinging each other and displaying network
statistics.
If packet loss occurs, 2ping will wait a few seconds (default 10,
configurable with \f[I]\-\-inquire\-wait\f[R]) before comparing notes
between the two endpoints to determine which direction the packet loss
is occurring.
.PP
To quit 2ping on the client or listener ends, enter \[ha]C, and a list
of statistics will be displayed.
To get a short inline display of statistics without quitting, enter
\[ha]\[rs] or send the process a QUIT signal.
.SH OPTIONS
.PP
\f[C]ping\f[R]\-compatible options (long option names are
\f[C]2ping\f[R]\-specific):
.TP
.B \-\-audible, \-a
Audible ping.
.TP
.B \-\-adaptive, \-A
Adaptive ping.
Interpacket interval adapts to round\-trip time, so that effectively not
more than one (or more, if preload is set) unanswered probe is present
in the network.
On networks with low rtt this mode is essentially equivalent to flood
mode.
.TP
.B \-\-count=\f[I]count\f[R], \-c \f[I]count\f[R]
Stop after sending \f[I]count\f[R] ping requests.
.TP
.B \-\-flood, \-f
Flood ping.
For every ping sent a period \[lq].\[rq] is printed, while for ever ping
received a backspace is printed.
This provides a rapid display of how many pings are being dropped.
If interval is not given, it sets interval to zero and outputs pings as
fast as they come back or one hundred times per second, whichever is
more.
.RS
.PP
\f[C]2ping\f[R]\-specific notes: Detected outbound/inbound loss
responses are printed as \[lq]>\[rq] and \[lq]<\[rq], respectively.
Receive errors are printed as \[lq]E\[rq].
Due to the asynchronous nature of \f[C]2ping\f[R], successful responses
(backspaces) may overwrite these loss and error characters.
.RE
.TP
.B \-\-interval=\f[I]interval\f[R], \-i \f[I]interval\f[R]
Wait \f[I]interval\f[R] seconds between sending each ping.
The default is to wait for one second between each ping normally, or not
to wait in flood mode.
.TP
.B \-\-interface\-address=\f[I]address\f[R], \-I \f[I]address\f[R]
Set source IP address.
When in listener mode, this option may be specified multiple to bind to
multiple IP addresses.
When in client mode, this option may only be specified once, and all
outbound pings will be bound to this source IP.
.RS
.PP
\f[C]2ping\f[R]\-specific notes: This option only takes an IP address,
not a device name.
Note that in listener mode, if the machine has an interface with
multiple IP addresses and an request comes in via a sub IP, the reply
still leaves via the interface\[cq]s main IP.
So either this option \[en] or (preferred) listening on all IPs
individually via the Python \[lq]netifaces\[rq] module \[en] must be
used if you would like to respond via an interface\[cq]s sub\-IP.
.RE
.TP
.B \-\-preload=\f[I]count\f[R], \-l \f[I]count\f[R]
If specified, \f[C]2ping\f[R] sends that many packets not waiting for
reply.
.TP
.B \-\-pattern=\f[I]hex_bytes\f[R], \-p \f[I]hex_bytes\f[R]
You may specify up to 16 \[lq]pad\[rq] bytes to fill out the packets you
send.
This is useful for diagnosing data\-dependent problems in a network.
For example, \f[I]\-\-pattern=ff\f[R] will cause the sent packet pad
area to be filled with all ones.
.RS
.PP
\f[C]2ping\f[R]\-specific notes: This pads the portion of the packet
that does not contain the active payload data.
If the active payload data is larger than the minimum packet size
(\f[I]\-\-min\-packet\-size\f[R]), no padding will be sent.
.RE
.TP
.B \-\-quiet, \-q
Quiet output.
Nothing is displayed except the summary lines at startup time and when
finished.
.TP
.B \-\-packetsize\-compat=\f[I]bytes\f[R], \-s \f[I]bytes\f[R]
\f[C]ping\f[R] compatibility; this will set
\f[I]\-\-min\-packet\-size\f[R] to this plus 8 bytes.
.TP
.B \-\-verbose, \-v
Verbose output.
In \f[C]2ping\f[R], this prints decodes of packets that are sent and
received.
.TP
.B \-\-version, \-V
Show version and exit.
.TP
.B \-\-deadline=\f[I]seconds\f[R], \-w \f[I]seconds\f[R]
Specify a timeout, in seconds, before \f[C]2ping\f[R] exits regardless
of how many pings have been sent or received.
Due to blocking, this may occur up to one second after the deadline
specified.
.PP
\f[C]2ping\f[R]\-specific options:
.TP
.B \-\-help, \-h
Print a synposis and exit.
.TP
.B \-\-ipv4, \-4
Limit binds to IPv4.
In client mode, this forces resolution of dual\-homed hostnames to the
IPv4 address.
(Without \f[I]\-\-ipv4\f[R] or \f[I]\-\-ipv6\f[R], the first result will
be used as specified by your operating system, usually the AAAA address
on IPv6\-routable machines, or the A address on IPv4\-only machines.) In
listener mode, this filters out any non\-IPv4
\f[I]\-\-interface\-address\f[R] binds, either through hostname
resolution or explicit passing.
.TP
.B \-\-ipv6, \-6
Limit binds to IPv6.
In client mode, this forces resolution of dual\-homed hostnames to the
IPv6 address.
(Without \f[I]\-4\f[R] or \f[I]\-6\f[R], the first result will be used
as specified by your operating system, usually the AAAA address on
IPv6\-routable machines, or the A address on IPv4\-only machines.) In
listener mode, this filters out any non\-IPv6
\f[I]\-\-interface\-address\f[R] binds, either through hostname
resolution or explicit passing.
.TP
.B \-\-all\-interfaces
Deprecated.
In listener mode, all addresses will be listened to by default if the
Python \[lq]netifaces\[rq] module is installed, unless overridden by one
or more \f[I]\-\-interface\-address\f[R] invocations.
.TP
.B \-\-auth=\f[I]key\f[R]
Set a shared key, send cryptographic hashes with each packet, and
require cryptographic hashes from peer packets signed with the same
shared key.
.TP
.B \-\-auth\-digest=\f[I]digest\f[R]
When \f[I]\-\-auth\f[R] is used, specify the digest type to compute the
cryptographic hash.
Valid options are \f[C]hmac\-md5\f[R] (default), \f[C]hmac\-sha1\f[R],
\f[C]hmac\-sha256\f[R] and \f[C]hmac\-sha512\f[R].
.TP
.B \-\-debug
Print (lots of) debugging information.
.TP
.B \-\-encrypt=\f[I]key\f[R]
Set a shared key, encrypt 2ping packets, and require encrypted packets
from peers encrypted with the same shared key.
Requires the PyCryptodome or PyCrypto module.
.TP
.B \-\-encrypt\-method=\f[I]method\f[R]
When \f[I]\-\-encrypt\f[R] is used, specify the method used to encrypt
packets.
Valid options are \f[C]hkdf\-aes256\-cbc\f[R] (default).
.TP
.B \-\-fuzz=\f[I]percent\f[R]
Simulate corruption of incoming packets, with a \f[I]percent\f[R]
probability each bit will be flipped.
After fuzzing, the packet checksum will be recalculated, and then the
checksum itself will be fuzzed (but at a lower probability).
.TP
.B \-\-inquire\-wait=\f[I]secs\f[R]
Wait at least \f[I]secs\f[R] seconds before inquiring about a lost
packet.
Default is 10 seconds.
UDP packets can arrive delayed or out of order, so it is best to give it
some time before inquiring about a lost packet.
.TP
.B \-\-listen
Start as a listener.
The listener will not send out ping requests at regular intervals, and
will instead wait for the far end to initiate ping requests.
A listener is required as the remote end for a client.
When run as a listener, a SIGHUP will reload the configuration on all
interfaces.
.TP
.B \-\-loopback
Use one or more client/listener pairs of UNIX datagram sockets.
Mainly for testing purposes.
.TP
.B \-\-loopback\-pairs=\f[I]pairs\f[R]
Number of pairs to generate when using \f[I]\-\-loopback\f[R].
.TP
.B \-\-min\-packet\-size=\f[I]min\f[R]
Set the minimum total payload size to \f[I]min\f[R] bytes, default 128.
If the payload is smaller than \f[I]min\f[R] bytes, padding will be
added to the end of the packet.
.TP
.B \-\-max\-packet\-size=\f[I]max\f[R]
Set the maximum total payload size to \f[I]max\f[R] bytes, default 512,
absolute minimum 64.
If the payload is larger than \f[I]max\f[R] bytes, information will be
rearranged and sent in future packets when possible.
.TP
.B \-\-nagios=\f[I]wrta\f[R],\f[I]wloss%\f[R],\f[I]crta\f[R],\f[I]closs%\f[R]
Produce output suitable for use in a Nagios check.
If \f[I]\-\-count\f[R] is not specified, defaults to 5 pings.
A warning condition (exit code 1) will be returned if average RTT
exceeds \f[I]wrta\f[R] or ping loss exceeds \f[I]wloss%\f[R].
A critical condition (exit code 2) will be returned if average RTT
exceeds \f[I]crta\f[R] or ping loss exceeds \f[I]closs%\f[R].
.TP
.B \-\-no\-3way
Do not perform 3\-way pings.
Used most often when combined with \f[I]\-\-listen\f[R], as the listener
is usually the one to determine whether a ping reply should become a
3\-way ping.
.RS
.PP
Strictly speaking, a 3\-way ping is not necessary for determining
directional packet loss between the client and the listener.
However, the extra leg of the 3\-way ping allows for extra chances to
determine packet loss more efficiently.
Also, with 3\-way ping disabled, the listener will receive no client
performance indicators, nor will the listener be able to determine
directional packet loss that it detects.
.RE
.TP
.B \-\-no\-match\-packet\-size
When sending replies, 2ping will try to match the packet size of the
received packet by adding padding if necessary, but will not exceed
\f[I]\-\-max\-packet\-size\f[R].
\f[I]\-\-no\-match\-packet\-size\f[R] disables this behavior, always
setting the minimum to \f[I]\-\-min\-packet\-size\f[R].
.TP
.B \-\-no\-send\-version
Do not send the current running version of 2ping with each packet.
.TP
.B \-\-notice=\f[I]text\f[R]
Send arbitrary notice \f[I]text\f[R] with each packet.
If the remote peer supports it, this may be displayed to the user.
.TP
.B \-\-packet\-loss=\f[I]out:in\f[R]
Simulate random packet loss outbound and inbound.
For example, \f[I]25:10\f[R] means a 25% chance of not sending a packet,
and a 10% chance of ignoring a received packet.
A single number without colon separation means use the same percentage
for both outbound and inbound.
.TP
.B \-\-port=\f[I]port\f[R]
Use UDP port \f[I]port\f[R], either a numeric port number or a service
name string.
With \f[I]\-\-listen\f[R], this is the port to bind as, otherwise this
is the port to send to.
Default is UDP port 15998.
.RS
.PP
When port \f[I]\[lq]\-1\[rq]\f[R] is specified, a random unused high
port is picked.
This is useful for automated unit and functional testing, but not for
normal use.
.RE
.TP
.B \-\-send\-monotonic\-clock
Send a monotonic clock value with each packet.
Peer time (if sent by the peer) can be viewed with
\f[I]\-\-verbose\f[R].
.TP
.B \-\-send\-random=\f[I]bytes\f[R]
Send random data to the peer, up to \f[I]bytes\f[R].
The number of bytes will be limited by other factors, up to
\f[I]\-\-max\-packet\-size\f[R].
If this data is to be used for trusted purposes, it should be combined
with \f[I]\-\-auth\f[R] for HMAC authentication.
.TP
.B \-\-send\-time
Send the host time (wall clock) with each packet.
Peer time (if sent by the peer) can be viewed with
\f[I]\-\-verbose\f[R].
.TP
.B \-\-srv
In client mode, causes hostnames to be looked up via DNS SRV records.
If the SRV query returns multiple record targets, they will all be
pinged in parallel; priority and weight are not considered.
The record\[cq]s port will be used instead of \f[I]\-\-port\f[R].
This functionality requires the dnspython module to be installed.
.TP
.B \-\-srv\-service=\f[I]service\f[R]
When combined with \f[I]\-\-srv\f[R], service name to be used for SRV
lookups.
Default service is \[lq]2ping\[rq].
.TP
.B \-\-stats=\f[I]interval\f[R]
Print a line of brief current statistics every \f[I]interval\f[R]
seconds.
The same line can be printed on demand by entering \[ha]\[rs] or sending
the QUIT signal to the 2ping process.
.TP
.B \-\-subtract\-peer\-host\-latency
If a peer sends its host latency (the amount of time it spends between
receiving a packet and sending out a reply), subtract it from RTT
calculations.
.SH BUGS
.PP
None known, many assumed.
.SH AUTHOR
.PP
\f[C]2ping\f[R] was written by Ryan Finnie <ryan\[at]finnie.org>.
.SH AUTHORS
Ryan Finnie.