wifinigel / wiperf

Utility to run various UX perf tests from an RPi/WLAN Pi and send results to various data repos
Other
26 stars 15 forks source link

Speedtest being executed using wrong interface #15

Closed lealog closed 4 years ago

lealog commented 4 years ago

Hi Nigel,

I'm using V2.0 in a rpi 3b and sometimes the speedtest test starts using ethernet interface to execute the test (in my case I have Wi-Fi as default interface to run this test). After some debug I realize that could be something in my network that is causing this issue. For some reason, my DHCP server is sending NAK's to rpi interfaces(something related with mac ). After rpi sends a discover, a new IP will be offered and everything starts working.

If this happens, the next speedtest will always run using ethernet interface.

Please check the logs:

Debug from Wi-Fi probe: 2020-08-15 14:55:04,411 - Probe_Log - INFO - Checking we're connected to the network (layer3) 2020-08-15 14:55:04,411 - Probe_Log - INFO - Checking we have an IP address. 2020-08-15 14:55:04,433 - Probe_Log - DEBUG - Interface config info: wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::ba27:ebff:fe17:daef prefixlen 64 scopeid 0x20 inet6 2001:818:e909:cf00:ba27:ebff:fe17:daef prefixlen 64 scopeid 0x0 ether b8:27:eb:17:da:ef txqueuelen 1000 (Ethernet) RX packets 37464825 bytes 3138156381 (2.9 GiB) RX errors 0 dropped 26245 overruns 0 frame 0 TX packets 58467233 bytes 4022586531 (3.7 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

2020-08-15 14:55:04,438 - Probe_Log - DEBUG - IP Address = NA 2020-08-15 14:55:04,439 - Probe_Log - ERROR - Problem with wireless connection: no valid IP address 2020-08-15 14:55:04,441 - Probe_Log - ERROR - Attempting to recover by bouncing wireless interface... 2020-08-15 14:55:04,442 - Probe_Log - ERROR - Bouncing WLAN interface 2020-08-15 14:55:04,442 - Probe_Log - DEBUG - Bouncing interface (platform type = rpi) 2020-08-15 14:55:04,443 - Probe_Log - INFO - Bouncing interface wlan0 (platform type = rpi) 2020-08-15 14:55:04,443 - Probe_Log - WARNING - Taking interface down... 2020-08-15 14:55:16,460 - Probe_Log - WARNING - Bringing interface up... 2020-08-15 14:55:22,435 - Probe_Log - INFO - Interface bounce completed OK. 2020-08-15 14:55:22,436 - Probe_Log - ERROR - Bounce completed. Exiting script. 2020-08-15 14:55:22,436 - Probe_Log - INFO - removing lock file

If the ethernet interface is disabled, the Speedtes will always run over Wi-Fi. Can you please check? Óscar Leal

wifinigel commented 4 years ago

Hi Oscar,

I must admit, I'm not sure why speedtest would use the wrong interface, as a routing check is completed before each test to ensure that the test will use the correct interface.

You should see something that looks like this in the logs:

2020-08-25 07:02:03,949 - Probe_Log - INFO - ########## speedtest ##########
2020-08-25 07:02:03,950 - Probe_Log - INFO - Starting speedtest...
2020-08-25 07:02:04,975 - Probe_Log - INFO -   Checked interface route to : 8.8.8.8. Result: 8.8.8.8 via 192.168.0.1 dev wlan0 src 192.168.0.14 uid 0
2020-08-25 07:02:05,405 - Probe_Log - INFO - Speedtest in progress....please wait.
2020-08-25 07:02:29,535 - Probe_Log - INFO - ping_time: 34, download_rate: 43.15, upload_rate: 5.43, server_name: ookla.ic.net.uk:8080
2020-08-25 07:02:29,539 - Probe_Log - INFO - Speedtest ended.
2020-08-25 07:02:29,539 - Probe_Log - INFO - InfluxDB update: wiperf-speedtest, source=Speedtest
2020-08-25 07:02:29,540 - Probe_Log - INFO - Sending data to Influx host: 192.168.0.190, port: 8086, database: wiperf)
2020-08-25 07:02:29,583 - Probe_Log - INFO - Data sent to influx OK
2020-08-25 07:02:29,585 - Probe_Log - INFO - Speedtest results sent OK.

If you run the following command, which version of wiperf is shown?

cat /usr/share/wiperf/version.txt
lealog commented 4 years ago

Hi Nigel,

I'm running version 2.0.0-beta3. Looking at this behaviour, it seems that the issue will happen when for some reason the rpi receives a DHCP NAK and after that acquires a new different IP.

When this happens, the speedtest will fail and then all test will start using ethernet interface. But is only the speedtest, the iperf3 test are using Wi-Fi interface.

Below you can see an image image

wifinigel commented 4 years ago

Hi Oscar,

I've checked the code and cannot see a scenario that would fit the symptoms you are seeing.

Could I have a copy of your config.ini file, and the full wiperf_agent.log file that covers at least 20 mins before and after the failure? As there is a check that the route to be used for speedtest should be wlan0 before every speedtest, I just can't figure this out.

What test are you performing to verify that the speedtest traffic is going via Ethernet after the failure? Can you do an "ip route" and see what the preferred route is, or perform an "ip route show to match 8.8.8.8" to see the route used to the internet

Thanks

Nigel (wifinigel@gmail.com)

wifinigel commented 4 years ago

Oscar,

I've tried to simulate the issue by doing an "ifdown wlan0" to force the interface bounce you see when your NIC gets the Nak from DHCP . But, each time, the speedtest runs OK on the next cycle (I verified the traffic is going over the wireless adapter with a frame capture over the air).

Will keep testing...

wifinigel commented 4 years ago

Unable to reproduce issue and no further end use feedback.