Measuring one-way network latency, jitter and packet loss on Linux

Ping can tell you round-trip or two-way latency, but if you want to know if it's upstream of downstream that's slowing down you need something else. You need OWAMP (One-Way Ping).

Below are my notes from setting up OWAMP on Ubuntu 12.10.

# Install ntp
apt-get update
apt-get -y install ntp

# Reconfigure NTP, remove default time sources
sed -i.bak /etc/ntp.conf \

# Use fixed list of time sources common for all our nodes
# You don't really need that many and likely don't want to
# use these as they're all in Finland and Sweden.
server  #      (Stratum 2)
server    #      (Stratum 2)
server    #        (Stratum 3)
server   #        (Stratum 3)
server   #        (Stratum 3)
server    #         (Stratum 1) PPS
server    #         (Stratum 1) PPS
server    #         (Stratum 1) PPS
server    #         (Stratum 1) GPS
server     #  (Stratum 1) PPS
server    #  (Stratum 1) PPS
server    #  (Stratum 1) PPS
server   #      (Stratum 1) PPS
server   #      (Stratum 1) PPS
server   #      (Stratum 1) GPS
server   #      (Stratum 1) PPS
server   #      (Stratum 1) PPS

# Enable NTP on boot
update-rc.d ntp enable

# Restart with new settings
service ntp stop
service ntp start

# Check status, will stabilize after few minutes
ntpq -c peers
ntpq -c associations

# Grab OWAMP source
mkdir -p /opt/src/owamp
cd /opt/src/owamp

# Compile and install
tar xvzf owamp-3.3rc1.tar.gz
cd owamp-3.3rc1
./configure --prefix=/opt
make install

# Add /opt to path
echo "/opt/lib" >>/etc/
sed -i.bak /etc/environment -e's|PATH="|PATH="/opt/sbin:/opt/bin:|g'
export PATH=/opt/sbin:/opt/bin:$PATH

# Create config files to only listen on private ips
mkdir -p /opt/etc
touch /opt/etc/owampd.conf
limit root with disk=1000M,bandwidth=0,delete_on_fetch=on,allow_open_mode=off
limit noc with parent=root,allow_open_mode=on
assign net noc
assign net noc

# Launch owampd on next boot
sed -i.bak /etc/rc.local -e's/^exit 0/#exit 0/'
echo "/opt/bin/owampd -c /opt/etc-d /tmp -R /var/run -G nogroup -U nobody" >>/etc/rc.local

# Plus once right now on foreground for testing
/opt/bin/owampd -c /opt/etc -d /tmp -R /var/run -G nogroup -U nobody -v -Z 

# Test upstream latency to another PC with identical setup
owping -c100 -i0.1 -L10 -s0 -t -AO -nm -S10.100.1.15

--- owping statistics from []:50578 to []:50441 ---
SID:    0a0a010ad4c3dcf7620bef80c9e5e726
first:  2013-02-11T23:11:20.804
last:   2013-02-11T23:11:29.847
100 sent, 2 lost (2.000%), 0 duplicates
one-way delay min/median/max = 33.2/52.2/72.4 ms, (err=9.06 ms)
one-way jitter = 18.6 ms (P95-P50)
Hops = 1 (consistently)
no reordering
# There's WANEM network emulator between and
# It's configured for 50ms latency with 20ms jitter and 2% loss on upstream.
# Docs