QoS: UDP round trip and one way (qos)
Sends a stream of numbered UDP packets to a responder, spaced like voice packets, and measures what a call over the same path would meet: the round-trip time, the jitter, the packet loss and the packets that arrive out of order. With a Probeward reflector at the other end it also reports the delay, jitter and loss of each direction on its own.
Use it between two sites that carry voice or video, or on any link where "the ping is fine" is not an answer: ping sends four packets a minute apart in time, this sends a stream, so it feels the queues that a stream feels.
What it looks like

The sensor's page after a few polls, against a target whose replies are delayed by about 100 ms with a spread of 20 ms. In the dark theme: the sensor's page. The form for adding it: light, dark.
The two ends
The sensor needs something at the other end that sends each packet back. There are two choices.
- A Probeward reflector. Run
probeward reflector --listen 0.0.0.0:8620on the machine at the other end: it is the same binary as the server and the probe, needs no database and no configuration, and stops with Ctrl-C or when its service is stopped. It stamps each packet with the time it received it and the time it sent it back, and counts the packets it has seen. Only this gives the one-way figures. Run it where the far end of the path is: on a machine at the remote site, next to its probe. It sends back only packets of the format below, and every answer is exactly as long as the request, so it cannot be used to multiply traffic towards a forged address. Open its UDP port to the probes that use it and to nobody else. - Any UDP echo service: the
echoservice ofinetd(RFC 862, port 7), a router's UDP echo responder, or a few lines of any language that send each datagram back unchanged. It gives every round-trip figure and no one-way figure.
Set port to the port the responder listens on. The default is 8620, the reflector's.
Channels
| Key | Name | Unit | Default limits |
|---|---|---|---|
rtt_avg_ms | Round-trip time (average) | ms | warning above 150, error above 400 |
rtt_min_ms | Round-trip time (minimum) | ms | none |
rtt_max_ms | Round-trip time (maximum) | ms | none |
jitter_ms | Jitter | ms | warning above 30, error above 100. Only with two answers or more |
loss_pct | Packet loss | % | warning above 1, error above 5 |
out_of_order | Packets out of order | none | none |
forward_delay_ms | One-way delay to the responder | ms | none. Only with one_way |
return_delay_ms | One-way delay back from the responder | ms | none. Only with one_way |
forward_jitter_ms | Jitter to the responder | ms | warning above 30, error above 100. Only with one_way |
return_jitter_ms | Jitter back from the responder | ms | warning above 30, error above 100. Only with one_way |
forward_loss_pct | Packet loss to the responder | % | warning above 1, error above 5. Only with one_way |
return_loss_pct | Packet loss back from the responder | % | warning above 1, error above 5. Only with one_way |
clock_offset_ms | Clock offset estimate (assumes a symmetric path) | ms | none. Only with one_way |
The default limits are the ones usually quoted for voice: a one-way delay under 150 ms, jitter under 30 ms and loss under 1 %. They are limits on a stream of 20 packets, which is what one poll sends, so they are a guide to a call, not a measure of one.
Jitter is the mean of the absolute difference between the round-trip times of packets that follow each other, taking the answers in the order they were sent. It is the figure of RFC 3550 without its smoothing, which suits a poll that stands alone. A path that delays every packet by the same amount, however much, has no jitter.
Loss is the share of the packets sent that did not come back within reply_wait_ms after the last one went out. It cannot tell a packet lost on the way there from one lost on the way back; the one-way channels can.
Out of order counts the packets that arrived after a packet sent later than they were (the "reordered" packets of RFC 4737). A path whose delay varies by more than the spacing of the packets reorders them: with the default spacing of 20 ms, a delay with a spread of 20 ms does.
One way, and what it needs
With one_way set and a Probeward reflector, each answer carries four times: when the sender sent the packet (T1), when the reflector received it (T2), when the reflector sent it back (T3) and when the sender received the answer (T4). The delay there is T2 - T1, the delay back is T4 - T3, and their sum is the round trip less the time the reflector held the packet. The sensor reports both.
One-way delays are only as good as the clocks. T1 and T4 are read from the probe's clock, T2 and T3 from the reflector's. A clock that is 5 ms ahead adds 5 ms to the delay there and takes 5 ms off the delay back. Unless both hosts are kept in step with each other, for instance by the same NTP server (see the NTP sensor to watch them), the two figures cannot be read separately, and a negative delay is possible and means exactly this. Their sum is always right, whatever the clocks say.
Jitter and loss need no clock at all. A clock that is wrong by a constant amount is wrong by it in every packet, and a difference between two packets cancels it. The one-way jitter and loss are as exact as the round-trip ones, and are the figures to rely on when the clocks are not known to agree.
The clock offset estimate is half the difference between the delay there and the delay back, which is the offset of the reflector's clock from the probe's if the path takes the same time each way. When it does not, the estimate shows that half the difference as an offset too, and cannot tell them apart: a path that delays only the way back by 100 ms reads as a clock that is 50 ms off. Treat it as a hint of whether the one-way delays can be trusted, not as a measurement, which is why it has no limit.
How the loss is split. The reflector counts the packets it receives from the sender in this poll and puts the count in each answer. At the last answer that came back, the packets sent so far are known, and so are the packets the reflector had received: the difference was lost on the way there. Of those it received, the answers that arrived are known too: the difference was lost on the way back. Packets sent after the last answer that arrived cannot be told apart and are left out of both figures, so a poll whose last packets were lost reports the loss of the packets before them.
one_way set against a responder that sends the packets back unchanged is a configuration failure that says so, and not a poll with the one-way channels missing.
Parameters
| Parameter | Default | Meaning |
|---|---|---|
port | 8620 | UDP port of the responder. |
count | 20 | Packets per poll, 2 to 500. |
interval_ms | 20 | Delay between the starts of consecutive packets, 1 to 1000. 20 ms is the spacing of voice packets. |
packet_size | 160 | Size of each UDP payload in bytes, 48 to 1400. 160 is a 20 ms voice packet at 64 kbit/s. |
reply_wait_ms | 1000 | How long to keep listening after the last packet, 50 to 10000. Shortened when the poll timeout leaves less. |
one_way | false | Report the figures of each direction. Needs a Probeward reflector. |
Suggested interval: 60 seconds. No credential.
The stream takes count times interval_ms, plus the wait for the last answer, and must fit inside the poll timeout. When the packets alone do not fit, the poll fails with a configuration message that says so before it sends anything.
On the target and the probe host
- The responder's UDP port must be reachable from the probe, and the answers must be able to come back. A stateful firewall allows them as replies to what the probe sent; one that filters UDP by port in each direction needs the port open both ways.
- Nothing needs a privilege on the probe host. A port nothing listens on is reported at once: the host answers with an ICMP "port unreachable" and the poll fails with
nothing is listening on that UDP port. A firewall that drops silently is reported as total packet loss. - Rate limits on a firewall or a router can drop part of a stream: the sensor reports it as loss, which for a stream it is.
The packet
For anyone who wants to write a responder. All numbers are big-endian; a packet is at least 48 bytes, padded with zeros to the size asked for, and at most 1400.
| Bytes | Field |
|---|---|
| 0 to 3 | The ASCII text PWQ1. |
| 4 | 1 in a request, 2 in an answer. |
| 5 to 7 | Zero. |
| 8 to 11 | The session: a number the sender picks for each poll. |
| 12 to 15 | The sequence number of the packet within the session, from 0. |
| 16 to 23 | When the sender sent it, in nanoseconds since the Unix epoch. |
| 24 to 31 | When the reflector received it. Zero in a request. |
| 32 to 39 | When the reflector sent it back. Zero in a request. |
| 40 to 43 | How many packets of this session the reflector has received, counting this one. |
| 44 to 47 | Zero. |
A reflector copies the request into its answer, changes byte 4 to 2, fills in the three fields it owns and sends it to the address the request came from. A plain echo does none of this, and the sensor tells the two apart by byte 4.
Failures
| Message | Meaning |
|---|---|
100% packet loss: no answer from <address>:<port> to N packets (kind timeout) | Nothing came back: the responder is not running, a firewall drops the packets, or the path is down. Partial loss is not a failure; the loss_pct limits decide. |
<address>:<port> refused the packets: nothing is listening on that UDP port (kind unreachable) | The host answered that the port is closed. Start the responder. |
one_way is set, but <address>:<port> answered with the packets unchanged ... (kind config) | The responder is a plain echo. Run a reflector, or turn one_way off. |
sending N packets M ms apart takes T ms, which the poll timeout does not allow ... (kind config) | Send fewer packets, closer together, or raise the timeout. |
exchange packets with ..., route to ... (kind unreachable) | The probe host cannot send to the address. |
Verification
Run on the loopback interface against the real reflector (no loss; the delays add up to the round trip; the reflector ignores packets that are not its own and never answers with more than it received) and against a UDP echo that drops every fourth packet (25 % loss exactly), with scripted answers for the jitter, order, loss-split and offset arithmetic, worked out by hand in the tests.
Against a lab target whose network is impaired on purpose, with an echo and a responder speaking the packet format of this page (a short script, not the Probeward reflector, which was not run on the lab machine):
| Target sends back with | Measured |
|---|---|
| nothing added | 0.2 ms, jitter 0.1 ms, no loss |
| a delay of 50 ms | 50.2 ms, jitter 0.1 ms |
| a delay of 100 ms with a spread of 20 ms | 100 ms, jitter 22 ms, about 40 of 150 packets out of order. One way: 1 ms there and 101 ms back, jitter 0.7 ms there and 24 ms back |
| 5 % loss | 4 to 7 % over 500 packets. One way: no loss there, the same back |
| a delay of 80 ms with a spread of 10 ms and 2 % loss | 80 ms, jitter 6.5 ms, 1.8 to 2.8 % loss. One way: no loss there, 2 % back |
| everything dropped | 100 % packet loss, a failed poll |
The impairment is applied to what the lab machine sends, so the way there is clean and the way back carries all of it, and the one-way figures show exactly that. The clock offset read -50 ms for the delayed paths, which is the asymmetry described above and not a clock error: the two machines share a clock source. Not seen: two Probeward probes on separate clocks, a path that is lossy in both directions, and the Probeward reflector across a network (only on the loopback interface).
The live tests read their targets from the environment and say so and return when they are not set:
| Variable | Meaning |
|---|---|
PROBEWARD_TEST_NETEM_CLEAN, _DELAY50, _DELAY100J, _LOSS5, _DELAY80J_LOSS2, _BLACKHOLE | Addresses of a target with no impairment, with a 50 ms delay, with 100 ms and a jitter setting of 20 ms, with 5 % loss, with 80 ms and a jitter setting of 10 ms and 2 % loss, and one that sends back nothing. The impairment is on what the target sends. |
PROBEWARD_TEST_NETEM_ECHO_PORT | The UDP port of a plain echo on each of those addresses. |
PROBEWARD_TEST_NETEM_REFLECTOR_PORT | The UDP port of a reflector on each of them. |
cargo test -p probeward-sensors --test live_quality qos -- --nocapture