wifinigel / wiperf_poller

Polling engine for the wiperf utility
Other
3 stars 5 forks source link

Not checking interface router when using Librespeed speedtest (peedtest_targets_count: 2) #19

Open lealog opened 3 years ago

lealog commented 3 years ago

During the V3 tests I realize that the wiperf is not checking if the interface route is the right.

I have configured two speedtest servers:

[Speedtest] ; yes = enabled, no = disabled enabled: yes speedtest_targets_count: 2 ; ; Give this speedtest instance a name to include in reports etc. st_name_1: Speedtest_Ookla_v4 ; Speedtest provider valid options: ookla or librespeed st_provider_1: ookla ; ; Ookla: ; The server ID of a specific Ookla server taken from : https://c.speedtest.net/speedtest-servers-static.php ; Note this must be the number (NOT url!) taken from the field id="xxxxx". If not specified, best server used (default) ; ; Librespeed: ; The numeric server ID of the server listed in the avaiable servers seen by running the Librespeed CLI ; command: librespeed-cli --list ; st_server_id_1: 31309 ; ; Additional args to pass to Librespeed CLI command (e.g. --local-json /etc/wipef/localserver.json --duration 20) - Note: Librespeed only st_librespeed_args_1: ; ; Choose the IP version to be used for the speedtest. Options: "ipv4" or "ipv6". st_ip_ver_1: ipv4 ; ; More speedtests added here... st_name_2: librespeed_IPv4 st_provider_2: librespeed st_server_id_2: 1 st_librespeed_args_2: --local-json /home/pi/localserver.json st_ip_ver_2: ipv4 ;

The librespeed server (192.168.1.228) is on the same eth0 and WLAN0 subnet (192.168.1.0/24)

ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.68 netmask 255.255.255.0 broadcast 192.168.1.255 ether dc:a6:32:5b:20:05 txqueuelen 1000 (Ethernet) RX packets 2832385 bytes 3281276154 (3.0 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2971614 bytes 3154305028 (2.9 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.73 netmask 255.255.255.0 broadcast 192.168.1.255 ether dc:a6:32:5b:20:06 txqueuelen 1000 (Ethernet) RX packets 1090927 bytes 1145283594 (1.0 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1069852 bytes 1035168783 (987.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Logs:

2021-03-21 01:01:57,788 - Probe_Log - INFO - -------------------------------------- 2021-03-21 01:01:57,788 - Probe_Log - INFO - --- speedtest --- 2021-03-21 01:01:57,789 - Probe_Log - INFO - -------------------------------------- 2021-03-21 01:01:57,789 - Probe_Log - INFO - Getting adapter IPv4 info: wlan0 2021-03-21 01:01:57,815 - Probe_Log - DEBUG - Interface config info: 3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 inet 192.168.1.73/24 brd 192.168.1.255 scope global dynamic wlan0 valid_lft 2892sec preferred_lft 2892sec

2021-03-21 01:01:57,817 - Probe_Log - DEBUG - IP Address = 192.168.1.73 2021-03-21 01:01:57,818 - Probe_Log - INFO - Getting adapter IPv6 info: wlan0 2021-03-21 01:01:57,842 - Probe_Log - DEBUG - Interface config info: inet6 xxxxxxxxxxxxxxxxxxx scope global dynamic mngtmpaddr

2021-03-21 01:01:57,843 - Probe_Log - DEBUG - IP Address = xxxxxxxxxxxxxxxxxxxxxxxxx 2021-03-21 01:01:57,843 - Probe_Log - INFO - Starting speedtest(s)... 2021-03-21 01:01:58,848 - Probe_Log - INFO - DNS hostname lookup : ipv4.google.com / Result: 142.250.184.174 2021-03-21 01:01:58,849 - Probe_Log - INFO - Performing IPv4 test target viability check 2021-03-21 01:01:58,875 - Probe_Log - INFO - Checked interface route to : 142.250.184.174. Result: 142.250.184.174 via 192.168.1.1 dev wlan0 src 192.168.1.73 uid 0 2021-03-21 01:01:58,901 - Probe_Log - INFO - Checked interface route to : 142.250.184.174. Result: 142.250.184.174 via 192.168.1.1 dev wlan0 src 192.168.1.73 uid 0 2021-03-21 01:01:58,903 - Probe_Log - INFO - !!! Speedtest #1 of 2 in progress....please wait. 2021-03-21 01:01:58,903 - Probe_Log - DEBUG - Running Ookla speedtest. 2021-03-21 01:01:58,904 - Probe_Log - INFO - Getting adapter IPv4 info: wlan0 2021-03-21 01:01:58,930 - Probe_Log - DEBUG - Interface config info: 3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 inet 192.168.1.73/24 brd 192.168.1.255 scope global dynamic wlan0 valid_lft 2891sec preferred_lft 2891sec

2021-03-21 01:01:58,931 - Probe_Log - DEBUG - IP Address = 192.168.1.73 2021-03-21 01:01:59,138 - Probe_Log - INFO - Speedtest info: specific server ID provided for test: 31309 2021-03-21 01:02:19,544 - Probe_Log - INFO - {'time': 1616288539544, 'target_index': 1, 'target_name': 'Speedtest_Ookla_v4', 'ping_time': 8, 'download_rate_mbps': 58.65, 'upload_rate_mbps': 66.02, 'server_name': 'speedtest-pcs1.meo.pt:8080', 'mbytes_sent': 83.58, 'mbytes_received': 73.47, 'latency_ms': 8, 'jitter_ms': None, 'client_ip': '188.37.36.3', 'provider': 'Ookla'} 2021-03-21 01:02:19,545 - Probe_Log - DEBUG - Main: Speedtest results: 2021-03-21 01:02:19,545 - Probe_Log - DEBUG - {'time': 1616288539544, 'target_index': 1, 'target_name': 'Speedtest_Ookla_v4', 'ping_time': 8, 'download_rate_mbps': 58.65, 'upload_rate_mbps': 66.02, 'server_name': 'speedtest-pcs1.meo.pt:8080', 'mbytes_sent': 83.58, 'mbytes_received': 73.47, 'latency_ms': 8, 'jitter_ms': None, 'client_ip': '188.37.36.3', 'provider': 'Ookla'} 2021-03-21 01:02:19,545 - Probe_Log - INFO - Speedtest ended.

If the librespeed test is not using wlan0, the test will be executed via eth0. This is not the expected behaviour.

lealog commented 3 years ago

It seems that for Speedtest 1, the wiperf is checking the route:

2021-03-21 01:01:58,875 - Probe_Log - INFO - Checked interface route to : 142.250.184.174. Result: 142.250.184.174 via 192.168.1.1 dev wlan0 src 192.168.1.73 uid 0 2021-03-21 01:01:58,901 - Probe_Log - INFO - Checked interface route to : 142.250.184.174. Result: 142.250.184.174 via 192.168.1.1 dev wlan0 src 192.168.1.73 uid 0

But for Speedtest 2 will not verify.

This issue is also related with #18.

wifinigel commented 3 years ago

I'm not sure I totally understand this issue. "If the librespeed test is not using wlan0, the test will be executed via eth0. This is not the expected behaviour." I'm not sure why librespeed would not use wlan0, as all traffic should be forced out of wlan0 as the default route due to the metric added to eth0.

Each speedtest, regardless of whether ookla or librespeed is subject to a check to ensure that the route to the "WAN" (Internet) is still via wlan0.

This may be cleared up once we fix issue #18

wifinigel commented 3 years ago

Reviewing supplied logs, it appears that the route check is being completed, but it is not obvious that it is for the second speedtest:

image

The red arrow shows where the second speedtest test cycle actually starts. Added additional logging message to clearly indicate start of testing cycle. Fix pushed to dev branch of GitHub repo - available on next install of dev branch.