A lightweight implementation of the Two-Way Active Measurement Protocol (TWAMP) for network latency and performance measurement.
- RFC 5357 Compliant: Full implementation of TWAMP as specified
- Bidirectional Measurements: Accurate round-trip time and one-way delay measurements
- Low Overhead: Minimal system resource usage for continuous monitoring
- Systemd Integration: Easy service management with systemd
- Cross-Platform: Supports major Linux distributions (Debian/Ubuntu, Fedora/RHEL/CentOS)
- Configurable: Flexible configuration options for various network environments
- Linux-based operating system (Debian/Ubuntu 18.04+ or Fedora/RHEL/CentOS 7+)
- Root or sudo privileges for installation
- Network connectivity for measurements
- Time synchronization enabled (NTP/chrony) for accurate measurements
Tested on: Fedora 41, Ubuntu 22.04, Ubuntu 24.04
sudo apt update
sudo apt install -y build-essential cmake git pkg-config libsystemd-dev# Fedora / RHEL / CentOS 8+
sudo dnf install -y gcc gcc-c++ cmake git pkg-config systemd-devel
# RHEL / CentOS 7
sudo yum install -y gcc gcc-c++ cmake3 git pkg-config systemd-develDownload the RPM/DEB packages from the Releases page:
git clone https://github.com/ValterGames-Coder/TWAMP.git
cd TWAMPcd server
mkdir build && cd build
cmake ..
sudo make install
sudo systemctl start twamp-server.service
sudo systemctl status twamp-server.servicecd client
mkdir build && cd build
cmake ..
sudo make installsudo systemctl enable systemd-timesyncd
sudo systemctl start systemd-timesyncd
sudo timedatectl set-ntp true# Install chrony
sudo apt install chrony # Debian/Ubuntu
sudo dnf install chrony # Fedora/RHEL/CentOS
# Stop systemd-timesyncd first
sudo systemctl stop systemd-timesyncd
sudo systemctl disable systemd-timesyncd
# Enable chrony
sudo systemctl enable chronyd
sudo systemctl start chronyd# Check synchronization status
timedatectl status
# For chrony users - check NTP sources
sudo chronyc sources -v
# For systemd-timesyncd users
timedatectl show-timesync --allExpected output should show:
System clock synchronized: yesNTP service: active- Multiple NTP sources with low offset values
If you see "Invalid timestamps detected" errors:
-
Check if time sync is running:
timedatectl status
-
Force synchronization (if needed):
# For chrony sudo chronyc makestep # For systemd-timesyncd sudo systemctl restart systemd-timesyncd
-
Monitor synchronization process:
# For chrony sudo chronyc tracking # For systemd-timesyncd journalctl -u systemd-timesyncd -f
The server configuration file is typically located at /etc/twamp/twamp-server.conf. Key configuration options include:
# TWAMP Server Configuration
# Control port (default: 862)
control_port = 862
# Test port (default: 863)
test_port = 863
# Maximum sessions (default: 100)
max_sessions = 100
# Session timeout in minutes (default: 5)
session_timeout = 5Ensure the TWAMP port (default 862) is open:
sudo ufw allow 862/tcp
sudo ufw allow 863/udpsudo firewall-cmd --permanent --add-port=862/tcp
sudo firewall-cmd --permanent --add-port=863/udp
sudo firewall-cmd --reloadsudo systemctl start/stop/restart twamp-server.serviceView server logs:
sudo journalctl -u twamp-server.service -f- Minimum safe interval: 100ms (
-i 100) - For accurate measurements: 500-1000ms
- Avoid intervals below 50ms as they may cause timestamp synchronization issues
Basic measurement:
twamp-client <server_ip>:<port>Advanced options:
twamp-client <server_ip>:<port> -c 5 -i 500 -sCommand line options:
-c <count>: Number of test packets to send (default: 10)-i <interval>: Interval between packets in ms (default: 1000)-s: Short output (only summary after all packets)
- "Invalid timestamps detected": Ensure both client and server have time synchronization enabled
- Connection refused: Check if server is running and firewall ports are open
- Identical timestamp values: Increase packet interval or check system clock resolution