Testing Tunnel Performance with ping
Once your TUN-over-UDP tunnel is up and running, a simple and effective way to test connectivity and measure performance is by using the ping
command.
In this setup, the TUN interfaces are configured as follows:
- Client-side TUN device:
tun0
, IP:10.0.0.1
- Server-side TUN device:
tun1
, IP:10.0.0.2
The tunnel allows bidirectional communication, so 10.0.0.1
should be able to successfully ping 10.0.0.2
.
What Does ping
Measure?
ping
sends ICMP Echo Request packets to a target IP address and waits for an Echo Reply. The main metric it reports is RTT (Round-Trip Time)—the time it takes for a packet to travel to the destination and back.
This makes ping
a quick way to:
- Verify that the tunnel is up and functional
- Measure latency between endpoints
- Spot signs of packet loss or jitter
Basic Usage
From the device with IP 10.0.0.1
, run:
ping 10.0.0.2
Sample output:
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=1.42 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=1.39 ms
64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=1.36 ms
^C
--- 10.0.0.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 1.360/1.390/1.420/0.025 ms
time=X ms
: This is the RTT for each packet.min/avg/max/mdev
: Summary statistics over the ping session.
Testing with Custom Intervals
By default, ping
sends one packet per second. You can adjust the interval using the -i
option.
Example: High-Frequency Ping (every 0.2s)
ping -i 0.2 10.0.0.2
This sends 5 packets per second, giving you more granular data.
Example: Low-Frequency Ping (every 5s)
ping -i 5 10.0.0.2
Useful for long-term monitoring without generating much traffic.
Interpreting RTT
- Low and stable RTT indicates good tunnel performance.
- High RTT may signal congestion, buffering, or distance.
- Variable RTT (jitter) can cause issues for latency-sensitive applications.
- Packet loss (reported at the end of the ping session) suggests network instability or configuration issues.
Stopping the Test
Press Ctrl + C
to stop the test and see summary statistics.
Summary
Use ping
to quickly verify tunnel functionality and get a feel for network performance. For deeper analysis, you can combine it with tools like iperf
, tcpdump
, or NanoPing’s own metrics/KPIs.
Let me know if you’d like a follow-up guide using iperf
or scripting ping tests for automation.