Help Center/ Virtual Private Network/ FAQs/ How Do I Test the Bandwidth of a P2C VPN Gateway?
Updated on 2024-07-23 GMT+08:00

How Do I Test the Bandwidth of a P2C VPN Gateway?

You are advised to use the iPerf3 tool to test the bandwidth of P2C VPN gateways. Using commands such as FTP and SCP commands for file transfer is not recommended, because the file transfer rate is affected by the disk read/write speed and the bandwidth test result is not accurate.

Prerequisites

  • The VPN gateway and server have been configured, and clients can connect to the VPN gateway.

    In this example, the specification of the VPN gateway is Professional 1 (maximum forwarding bandwidth: 300 Mbit/s).

  • Three ECS instances have been deployed in the VPC where the VPN gateway is located to simulate resource nodes on the cloud.

    In this example, the flavor of each ECS is c6.large.2 (2 vCPUs, 4 GB memory, CentOS 8.0-64bit system image).

  • Three on-premises devices have been prepared to simulate clients.

    In this example, device A and device B are Linux servers (4U8G, running the ubuntu-20.04.6-live-server-amd64 operating system), and device C is a PC (i7 processor, running the Windows 10 operating system).

  • The bandwidth capabilities of on-premises devices, ECS interfaces, and networks meet the following requirements: The upstream and downstream bandwidths are greater than or equal to 100 Mbit/s.
  • The quality of the network between on-premises devices and the VPN gateway is good.

Networking Scenario

This section describes how to use the iPerf3 tool to test the VPN gateway bandwidth. Figure 1 shows the networking diagram.

Figure 1 Networking diagram

Installing iPerf3

The following describes how to install iPerf3 on the on-premises devices used in this test.

Installing iPerf3 on Linux

  1. Open the CLI.
  2. Run the following command to install iPerf3:
    yum install -y iperf3
  3. Run the iperf3 -v command to check whether the installation is successful.

    If the iPerf version is displayed, the installation is successful.

Installing iPerf3 on Windows

Download the iPerf3 software package based on the operating system version from the iPerf3 official website.

Using iPerf3 to Test the Bandwidth of a VPN Gateway

Overview of iPerf3

Table 1 describes the key parameters of iPerf3.

Table 1 Key parameters of iPerf3

Parameter

Description

-s

Specifies that iPerf3 runs in server mode.

-c

Specifies that iPerf3 runs in client mode.

-p

Specifies the listening port of the server, that is, the server port to which a client needs to connect. (The settings on the server and client must be the same.)

-i

Specifies the interval for sending data, in seconds.

-l

Specifies the length of the buffer to read or write. You are advised to set this parameter to 1300 to simulate service data whose payload length is 1300 bytes.

-P

Specifies the number of threads. If this parameter is not specified, a single thread is used by default.

On-premises Devices Functioning as Servers

  1. Run the following commands on on-premises devices to start the iPerf3 process in server mode, with different listening ports specified. The following is an example:
    • Device A (Linux)
      iperf3 -s -p 20001
    • Device B (Linux)
      iperf3 -s -p 20002
    • Device C (Windows)
      iperf3.exe -s -p 20003
  2. Run the iperf3 -c server-ip -p server-port -l 1300 -P 10 command on the three ECS instances to start the iPerf3 process in client mode, with different server listening ports specified. The following is an example:
    iperf3 -c 192.168.10.1 -p 20001 -l 1300 -P 10
    iperf3 -c 192.168.10.2 -p 20002 -l 1300 -P 10
    iperf3 -c 192.168.10.3 -p 20003 -l 1300 -P 10

On-premises Devices Functioning as Clients

  1. Run the iperf3 -s -p server-port command on the three ECS instances to start the iPerf3 process in server mode, with different listening ports specified. The following is an example:
    iperf3 -s -p 20001
    iperf3 -s -p 20002
    iperf3 -s -p 20003
  2. Run the following commands on on-premises devices to start the iPerf3 process in client mode, with different server listening ports specified. The following is an example:
    • Device A
      iperf3 -c 172.16.10.1 -p 20001 -l 1300 -P 10
    • Device B
      iperf3 -c 172.16.10.2 -p 20002 -l 1300 -P 10
    • Device C
      iperf3.exe -c 172.16.10.3 -p 20003 -l 1300 -P 10

Test Result

After the iPerf3 process is executed, the following information is displayed:

Connecting to host 172.16.10.1, port 20001
[  4] local 192.168.10.1 port 20001 connected to 172.16.10.1 port 20001
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec  8.62 MBytes  72.1 Mbits/sec
[  4]   1.00-2.01   sec  9.88 MBytes  82.2 Mbits/sec
[  4]   2.01-3.01   sec  9.88 MBytes  82.9 Mbits/sec
[  4]   3.01-4.00   sec  9.50 MBytes  80.4 Mbits/sec
[  4]   4.00-5.01   sec  9.88 MBytes  82.1 Mbits/sec
[  4]   5.01-6.01   sec  9.62 MBytes  81.2 Mbits/sec
[  4]   6.01-7.00   sec  9.12 MBytes  77.0 Mbits/sec
[  4]   7.00-8.01   sec  10.0 MBytes  83.2 Mbits/sec
[  4]   8.01-9.01   sec  9.50 MBytes  79.9 Mbits/sec
[  4]   9.01-10.01  sec  8.62 MBytes  72.4 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-10.01  sec  94.6 MBytes  79.3 Mbits/sec                  sender
[  4]   0.00-10.01  sec  94.6 MBytes  79.3 Mbits/sec                  receiver

According to the preceding iPerf3 test result, the transmission rate from 192.168.10.1 to 172.16.10.1 is about 79.3 Mbit/s. The test lasted for 10 seconds, during which 94.6 MB data is sent.