---
tags: speed
---
# Speed Test
[TOC]
:::spoiler 前人資料
- [學長過去留下的資料 - Google Drive](https://drive.google.com/drive/folders/18tl4iu7iOKEcKcx55jplAJGt4cQ8gAj4)
- [BWCTL](https://docs.google.com/presentation/d/1VwyMX1HtH0FjICEV3h90Y71PrxbDmBLN/edit#slide=id.p9)
- [NDT](https://docs.google.com/presentation/d/1VEEiX9NQ80St9IOJD0i9M8Yukze9hULd/edit#slide=id.p1)
:::
## pScheduler
:::warning
pScheduler is **the new replacement for perfSONAR's bwctl tool** starting with perfSONAR v4.0.
:::
### SOP
- [Bundle Installation on Debian/Ubuntu](https://docs.perfsonar.net/install_debian.html)
```shell=
cd /etc/apt/sources.list.d/
curl -o perfsonar-release.list http://downloads.perfsonar.net/debian/perfsonar-release.list
curl http://downloads.perfsonar.net/debian/perfsonar-official.gpg.key | apt-key add -
apt update
apt install perfsonar-tools
```
### iPerf3
- [iPerf 3 user documentation](https://iperf.fr/iperf-doc.php#3doc)
- Includes in perfSONAR pkg
<table>
<tr>
<td align="center">GENERAL OPTIONS</td>
<td align="center">Usage</td>
</tr>
<tr>
<td>-p, --port</td>
<td>set server port to listen on/connect to to (default 5201)</td>
</tr>
<tr>
<td>-f, --format</td>
<td>format to report: Kbits, Mbits, KBytes, MBytes</td>
</tr>
<tr>
<td>-i, --interval</td>
<td>pause seconds between periodic bandwidth reports; default is 1, use 0 to disable</td>
</tr>
<tr>
<td>-V, --verbose</td>
<td>detailed output</td>
</tr>
<tr>
<td>-J, --json</td>
<td>output in JSON format</td>
</tr>
<tr>
<td>--logfile</td>
<td>send output to a log file</td>
</tr>
</table>
> -A, --affinit
> -B, --bind
> --forceflush
> -d, --debug
#### Server
```shell=
iperf3 -s -D
```
<table>
<tr>
<td align="center">SERVER SPECIFIC OPTIONS</td>
<td align="center">Usage</td>
</tr>
<tr>
<td>-D, --daemon</td>
<td>run the server in background as a daemon</td>
</tr>
<tr>
<td>-I, --pidfile</td>
<td>write a file with the process ID, most useful when running as a daemon</td>
</tr>
</table>
#### Client
```shell=
iperf3 -c server_IP
```
<table>
<tr>
<td align="center">CLIENT SPECIFIC OPTIONS</td>
<td align="center">Usage</td>
</tr>
<tr>
<td>-u, --udp</td>
<td>use UDP rather than TCP</td>
</tr>
<tr>
<td>-b, --bandwidth</td>
<td>Set target bandwidth to n bits/sec (default 1 Mbit/sec for UDP, unlimited for TCP).
<br>Setting the target bandwidth to 0 will disable bandwidth limits (particularly useful for UDP tests).</td>
</tr>
<tr>
<td>--fq-rate</td>
<td>Set a rate to be used with fair-queueing based socket-level pacing, in bits per second.</td>
</tr>
<tr>
<td>-t, --time</td>
<td>time in seconds to transmit for (default 10 secs)</td>
</tr>
<tr>
<td>-n, --bytes</td>
<td>number of bytes to transmit (instead of -t)</td>
</tr>
<tr>
<td>-k, --blockcount</td>
<td>number of blocks (packets) to transmit (instead of -t or -n)</td>
</tr>
<tr>
<td>-l, --length</td>
<td>length of buffer to read or write</td>
</tr>
<tr>
<td>--cport</td>
<td>bind data streams to a specific client port (for TCP and UDP only, default is to use an ephemeral port)</td>
</tr>
<tr>
<td>-P, --parallel</td>
<td>number of parallel client streams to run</td>
</tr>
<tr>
<td>-O, --omit</td>
<td>Omit the first n seconds of the test, to skip past the TCP slow-start period.</td>
</tr>
<tr>
<td>-w, --window</td>
<td>window size / socket buffer size</td>
</tr>
<tr>
<td>-M, --set-mss</td>
<td>set TCP/SCTP maximum segment size (MTU - 40 bytes)</td>
</tr>
<tr>
<td>-T, --title</td>
<td>Prefix every output line with this string.</td>
</tr>
<tr>
<td>--get-server-output</td>
</tr>
</table>
## Switch Port Speed
- [Juniper Switch - Port Speed](https://www.juniper.net/documentation/us/en/software/junos/interfaces-ethernet/topics/topic-map/port-speed-configuration.html)
- vSwitch


- [Half & Full Duplex](https://www.comms-express.com/infozone/article/half-full-duplex/)
## `tcpdump` capturing packets
```shell=
sudo tcpdump -i ens160 -c 100 -s 65535 -w capture.pcap
```
## Other tools
### BWCTL (unavailable)
:::danger
**NOTE: bwctl and related tools have been replaced by pScheduler.**
:::
- **Bandwidth Test Controller**
- Includes
- [iPerf](https://iperf.fr/)
- A tool to measure maximum TCP bandwidth, allowing the tuning of various parameters and UDP characteristics.
- reports bandwidth, delay jitter, datagram loss.
- [thrulay](http://thrulay-hd.sourceforge.net/)
- measures the capacity of a network by sending a bulk TCP stream over it and measures one-way delay by sending a Poisson stream of very precisely positioned UDP packets.
- [nuttcp](https://www.nuttcp.net/Welcome%20Page.html)
- `bwctl` (Client) & `bwctld` (Daemon)
#### SOP on Ubuntu
- [bwctl, bwping, bwtraceroute on Ubuntu](http://manpages.ubuntu.com/manpages/bionic/man1/bwctl.1.html)
- Server
- This package contains the scheduling and policy daemon that wraps these tools. To schedule and control tests you need the bwctl-client package.
```shell=
sudo apt install bwctl-server
```
- Client
- This package contains the command line tool for scheduling and controlling tests. It requires the bwctl-server package to be installed on the hosts at both ends of the network that you are trying to test.
```shell=
sudo apt install bwctl-client
```
### NDT
- **Network Diagnostic Tool**
### LibreSpeed
- [GitHub - librespeed/speedtest](https://github.com/librespeed/speedtest)
## Reference
### Official
1. [Internet2 - Performance and Analytics Tools](https://internet2.edu/security/performance-analytics/)
2. [perfSONAR](https://www.perfsonar.net/)
3. [iPerf](https://iperf.fr/)
## Problems Occured
### Check Routing Table
```shell=
netplan -rn
```
or
```shell=
route -n
```
or
```shell=
ip route
```
