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

Run iperf & speedtest on both IPv4 & IPv6 in same test cycle #53

Open wifinigel opened 3 years ago

wifinigel commented 3 years ago

From @lealog:

Any possibility to have iperf2 and speedtest on the same cycle using IPv4 and IPv6 tests? Today I can only select one of the IP versions.

wifinigel commented 3 years ago

@lealog Are you able to run IPv6 tests now from wiperf? I have never tried that.

lealog commented 3 years ago

I did some tests using IPv6 destinations only. IPv6 PING Not working

; Number of targets we'd like to ping ping_targets_count: 7 ; first host we'd like to ping ping_host1: google.com ping_host2: facebook.com ping_host3: instagram.com ping_host4: wikipedia.org ping_host5: whatsapp.com ; IPv6 only ping_host6: ipv6.google.com ping_host7: www.v6.facebook.com

2021-01-31 01:22:40,488 - Probe_Log - ERROR -   Issue looking up host ipv6.google.com (DNS Issue?): [Errno -2] Name or service not known

DNS IPv6 Tests Not Working

; Number of DNS targets we'd like to test dns_targets_count: 7 ; ; First DNS target dns_target1: google.com dns_target2: facebook.com dns_target3: instagram.com dns_target4: wikipedia.org dns_target5: whatsapp.com ; IPv6 only dns_target6: ipv6.google.com dns_target7: www.v6.facebook.com

2021-01-31 01:28:50,714 - Probe_Log - DEBUG - DNS test target: ipv6.google.com
2021-01-31 01:28:50,714 - Probe_Log - DEBUG - Performing DNS lookup for: ipv6.google.com
2021-01-31 01:28:50,721 - Probe_Log - ERROR - DNS test lookup to ipv6.google.com failed. Err msg: [Errno -2] Name or service not known
2021-01-31 01:28:50,721 - Probe_Log - DEBUG - DNS lookup for: ipv6.google.com failed! - err: [Errno -2] Name or service not known
2021-01-31 01:28:50,722 - Probe_Log - ERROR - DNS test error - no results (check logs) - exiting DNS tests
2021-01-31 01:28:50,722 - Probe_Log - DEBUG - DNS test target: www.v6.facebook.com
2021-01-31 01:28:50,723 - Probe_Log - DEBUG - Performing DNS lookup for: www.v6.facebook.com
2021-01-31 01:28:50,729 - Probe_Log - ERROR - DNS test lookup to www.v6.facebook.com failed. Err msg: [Errno -2] Name or service not known
2021-01-31 01:28:50,730 - Probe_Log - DEBUG - DNS lookup for: www.v6.facebook.com failed! - err: [Errno -2] Name or service not known
2021-01-31 01:28:50,730 - Probe_Log - ERROR - DNS test error - no results (check logs) - exiting DNS tests

IPv6 HTTP Tests Not Working

; Number of HTTP targets we'd like to test http_targets_count: 10 ; ; First HTTP target http_target1: google.com http_target2: facebook.com http_target3: instagram.com http_target4: wikipedia.org http_target5: whatsapp.com ; IPv6 only http_target6: ipv6.google.com http_target7: www.v6.facebook.com http_target8: loopsofzen.uk http_target9: v6.testmyipv6.com http_target10: ipv6-things.srv.peterjin.org

2021-01-31 01:36:52,601 - Probe_Log - INFO - DNS test ended.
2021-01-31 01:36:52,601 - Probe_Log - INFO - ########## http tests ##########
2021-01-31 01:36:52,602 - Probe_Log - INFO - Starting HTTP tests...
2021-01-31 01:38:02,504 - Probe_Log - INFO - *****************************************************
2021-01-31 01:38:02,504 - Probe_Log - INFO -  Starting logging...
2021-01-31 01:38:02,505 - Probe_Log - INFO - *****************************************************
2021-01-31 01:38:02,512 - Probe_Log - INFO - (Note: logging set to debug level.)
2021-01-31 01:38:02,513 - Probe_Log - INFO - Checking optional OS commands are available.
2021-01-31 01:38:02,513 - Probe_Log - INFO - Checking required OS commands are available.
2021-01-31 01:38:02,513 - Probe_Log - DEBUG - #### Initialized WirelessAdapter instance... ####
2021-01-31 01:38:02,513 - Probe_Log - INFO - Checking if we use remote cfg file...
2021-01-31 01:38:02,513 - Probe_Log - INFO - No remote cfg file confgured...using current local ini file.
2021-01-31 01:38:02,514 - Probe_Log - ERROR - Existing lock file found...
2021-01-31 01:38:02,515 - Probe_Log - ERROR - Exiting due to lock file indicating script running.
2021-01-31 01:38:02,515 - Probe_Log - ERROR - (Delete /tmp/wiperf_poller.lock if you are sure script not running)

IPv6 SpeedTest using librespeed - OK

; Speedtest provider valid options: ookla or librespeed
provider: librespeed
;
; 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
;
server_id: 51
;
; Additional args to pass to Librespeed CLI command (e.g. --local-json /etc/wipef/localserver.json --duration 20) - Note: Librespeed only
librespeed_args: --ipv6
2021-01-31 03:24:05,286 - Probe_Log - DEBUG - Running Librespeed speedtest.
2021-01-31 03:24:05,286 - Probe_Log - DEBUG - Librespeed command: /usr/local/bin/librespeed-cli --json --server 51 --ipv6
2021-01-31 03:24:38,116 - Probe_Log - DEBUG - Librespeed returned info: {"timestamp":"2021-01-31T03:24:38.108500639Z","server":{"name":"Amsterdam, Netherlands (Clouvider)","url":"http://ams.speedtest.clouvider.net/backend"},"client":{"ip":"","hostname":"","city":"","region":"","country":"","loc":"","org":"","postal":"","timezone":""},"bytes_sent":91684864,"bytes_received":721962292,"ping":43,"jitter":0,"upload":47.02,"download":370.23,"share":""}

2021-01-31 03:24:38,118 - Probe_Log - INFO - time: 1612063478117, ping_time: 43, download_rate_mbps: 370.23, upload_rate_mbps: 47.02, server_name: Amsterdam, Netherlands (Clouvider), mbytes_sent: 89.54,  mbytes_received: 705.04, latency_ms: 43, jitter_ms: 0, client_ip: , provider: Librespeed
2021-01-31 03:24:38,119 - Probe_Log - DEBUG - Main: Speedtest results:
2021-01-31 03:24:38,119 - Probe_Log - DEBUG - {'time': 1612063478117, 'ping_time': 43, 'download_rate_mbps': 370.23, 'upload_rate_mbps': 47.02, 'server_name': 'Amsterdam, Netherlands (Clouvider)', 'mbytes_sent': 89.54, 'mbytes_received': 705.04, 'latency_ms': 43, 'jitter_ms': 0, 'client_ip': '', 'provider': 'Librespeed'}
2021-01-31 03:24:38,120 - Probe_Log - INFO - Speedtest ended.
2021-01-31 03:24:38,121 - Probe_Log - INFO - Sending results to local file cache.
2021-01-31 03:24:38,130 - Probe_Log - INFO - InfluxDB update: wiperf-speedtest, source=Speedtest

Ipv6 iperf3 tests - OK

[Iperf3_tcp_test] ; yes = enabled, no = disabled enabled: yes ; ; IP address of iperf3 server server_hostname: 2001:xxxx:xxxx:xxxx:dea6:32ff:fe5a:xxxx ; ; iperf server port port: 5201

2021-01-31 03:56:51,814 - Probe_Log - INFO - ########## iperf3 tcp test ##########
2021-01-31 03:56:51,815 - Probe_Log - INFO - Starting iperf3 tcp test (2001:xxxx:xxxx:xxxx:dea6:32ff:fe5a:xxxx)...
2021-01-31 03:56:52,842 - Probe_Log - INFO -   Checked interface route to : 2001:xxxx:xxxx:xxxx:dea6:32ff:fe5a:xxxx. Result: 2001:xxxx:xxxx:xxxx:dea6:32ff:fe5a:xxxx from :: dev eth0 proto kernel src 2001:818:e909:cf00:dea6:32ff:fe5b:2005 metric 256 pref medium
2021-01-31 03:56:52,844 - Probe_Log - WARNING - Unable to run tcp iperf test to 2001:xxxx:xxxx:xxxx:dea6:32ff:fe5a:xxxx as route to destination not over correct interface...injecting static route
2021-01-31 03:56:52,844 - Probe_Log - INFO -   [Route Injection] Checking probe mode: 'wireless'
2021-01-31 03:56:52,845 - Probe_Log - INFO -   [Route Injection] Attempting static route insertion to fix routing issue
2021-01-31 03:56:52,869 - Probe_Log - INFO -   [Route Injection] Adding new test traffic traffic route: 2001:xxxx:xxxx:xxxx:dea6:32ff:fe5a:xxxx dev wlan0
2021-01-31 03:56:52,870 - Probe_Log - INFO -   [Route Injection] Route injection (test traffic)complete
2021-01-31 03:56:52,891 - Probe_Log - INFO -   Checked interface route to : 2001:xxxx:xxxx:xxxx:dea6:32ff:fe5a:xxxx. Result: 2001:xxxx:xxxx:xxxx:dea6:32ff:fe5a:xxxx from :: dev wlan0 src 2001:xxx:e909:cf00:dea6:xxxx:fe5b:xxxx metric 1024 pref medium
2021-01-31 03:56:52,998 - Probe_Log - INFO - Starting tcp iperf3 test...
2021-01-31 03:57:03,064 - Probe_Log - INFO - Iperf3 tcp results - rx_mbps: 85.7, tx_mbps: 86.6, retransmits: 0, sent_bytes: 108250968, rec_bytes: 107211384
2021-01-31 03:57:03,064 - Probe_Log - INFO - Sending results to local file cache.
2021-01-31 03:57:03,070 - Probe_Log - INFO - InfluxDB update: wiperf-iperf3-tcp, source=iperf3_tcp

I have testes manually using iperf3 -6 -c 2001:xxxx:xxxx:xxxx:dea6:32ff:fe5a:xxxx

wifinigel commented 3 years ago

It looks initially as though many of the failures are due to name lookup issues. I wonder if your probe has DNS resolution issues?

I'm not an IPv6 expert, but I wonder if its not getting any IPv6 DNS servers via DHCP. Or, maybe you're using a static ipv6 address on the probe and you need to configure static DNS servers on the probe networking config?

I think the starting point is to make sure you can resolve ipv6.google.com and www.v6.facebook.com from the CLI of the probe (e.g. nslookup with IPv6 addresses returned). Then check they can be pinged. Once we are at that point, we can be sure the probe has good IPv6 connectivity and start looking at the probe tests in more detail.

I'd suggest the following from the CLI - we need these to all provide valid reponses:

# check name resolution works
nslookup ipv6.google.com
# check  IPv6 ping works (layer 3)
ping -6 ipv6.google.com
# check http works over ipv6
curl -6 ipv6.google.com

Unfortunately, my ISP does not provide me with IPv6 connectivity, so I cannot test this is my home environment :(

wifinigel commented 3 years ago

There are quite a few interesting considerations coming out of this.

If a hostname is specified for a test, there is a need to specify if the ipv4 or ipv6 address is used for the test. Many DNS queries return both IPv4 results and IP6, so we will likely need an additional field to specify a preference for each test (e.g. ipv4 or ipv6)

lealog commented 3 years ago

Hi @wifinigel

I'd suggest the following from the CLI - we need these to all provide valid responses:

# check name resolution works
nslookup ipv6.google.com
# check  IPv6 ping works (layer 3)
ping -6 ipv6.google.com
# check http works over ipv6
curl -6 ipv6.google.com

I did that test before to guarantee that Ipv6 was working as expected :) I tried again just now:


2021-01-31 15:28:40,022 - Probe_Log - ERROR -   Issue looking up host ipv6.google.com (DNS Issue?): [Errno -2] Name or service not known

pi@raspberrypiredewifi:~ $ pi@raspberrypiredewifi:~ $ pi@raspberrypiredewifi:~ $ pi@raspberrypiredewifi:~ $ pi@raspberrypiredewifi:~ $ pi@raspberrypiredewifi:~ $ ping ipv6.google.com PING ipv6.google.com(mad01s24-in-x0e.1e100.net (2a00:1450:4003:805::200e)) 56 data bytes 64 bytes from mad01s24-in-x0e.1e100.net (2a00:1450:4003:805::200e): icmp_seq=1 ttl=60 time=19.7 ms 64 bytes from mad01s24-in-x0e.1e100.net (2a00:1450:4003:805::200e): icmp_seq=2 ttl=60 time=19.8 ms 64 bytes from mad01s24-in-x0e.1e100.net (2a00:1450:4003:805::200e): icmp_seq=3 ttl=60 time=19.4 ms 64 bytes from mad01s24-in-x0e.1e100.net (2a00:1450:4003:805::200e): icmp_seq=4 ttl=60 time=19.4 ms 64 bytes from mad01s24-in-x0e.1e100.net (2a00:1450:4003:805::200e): icmp_seq=5 ttl=60 time=19.4 ms

--- ipv6.google.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 9ms rtt min/avg/max/mdev = 19.408/19.540/19.750/0.211 ms pi@raspberrypiredewifi:~ $ nslookup ipv6.google.com Server: 192.168.1.10 Address: 192.168.1.10#53

Non-authoritative answer: ipv6.google.com canonical name = ipv6.l.google.com. Name: ipv6.l.google.com Address: 2a00:1450:4003:805::200e

pi@raspberrypiredewifi:~ $ ping -6 ipv6.google.com PING ipv6.google.com(mad01s24-in-x0e.1e100.net (2a00:1450:4003:805::200e)) 56 data bytes 64 bytes from mad01s24-in-x0e.1e100.net (2a00:1450:4003:805::200e): icmp_seq=1 ttl=60 time=19.8 ms 64 bytes from mad01s24-in-x0e.1e100.net (2a00:1450:4003:805::200e): icmp_seq=2 ttl=60 time=19.7 ms 64 bytes from mad01s24-in-x0e.1e100.net (2a00:1450:4003:805::200e): icmp_seq=3 ttl=60 time=19.7 ms

--- ipv6.google.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 3ms rtt min/avg/max/mdev = 19.686/19.724/19.776/0.120 ms pi@raspberrypiredewifi:~ $


I can't understand why this is not working with wiperf.

> There are quite a few interesting considerations coming out of this.
> 
> If a hostname is specified for a test, there is a need to specify if the ipv4 or ipv6 address is used for the test. Many DNS queries return both IPv4 results and IP6, so we will likely need an additional field to specify a preference for each test (e.g. ipv4 or ipv6)

Yes. An approach could be using the same "logic" that you did to implement additional arguments for librespeed (Additional args to pass to Librespeed CLI command).

If you want to have IPv6 you can implement an IPv6 broker. You need to have a look on this - https://tunnelbroker.net/ (It's free and stable).

My ISP in Portugal is offering IPv6 and I don't need to have an IPv6 broker :)
wifinigel commented 3 years ago

Ping is hardcoded for IPv4 in wiperf, which is why it fails. I am fixiing it. :)

lealog commented 3 years ago

And what about DNS errors Issue looking up host ipv6.google.com (DNS Issue?): [Errno -2] Name or service not known?? Do you have DNS hardcoded for IPv4 only?

wifinigel commented 3 years ago

@lealog I haven't had much luck getting an IPv6 env going with a public Internet connection going. The suggested broker service wont work with my ISP due to ICMP being shutdown on my WAN link (and no way to enable it).

I think the dev code is working quite well now, but I need it testing out in an ipv6 env. The code is on the dev branch of the github repo. To download and test the code, follow these steps on your probe:

# install dev package
cd /usr/local/lib/python3.7/dist-packages/
sudo mv ./wiperf_poller ./wiperf_poller.orig
cd /tmp
sudo git clone --single-branch --branch dev https://github.com/wifinigel/wiperf_poller.git
cd wiperf_poller
sudo mv ./wiperf_poller /usr/local/lib/python3.7/dist-packages/

# restore old modules (after testing complete)
cd /usr/local/lib/python3.7/dist-packages/
sudo rm -rf wiperf_poller
sudo mv ./wiperf_poller.orig/ ./wiperf_poller

Some notes:

1. For ping hosts, if using hostnames rather than IP addresses, an IPv6 address resolution can be forced 
   using the "^v6" string at the end of the hostname, e.g.

    # Force IPv6 lookup
    ping_host2: cisco.com^v6

    # Force IPv4 lookup
    ping_host3: cisco.com^v4

    # Default IPv4 lookup with no qualifier added 
    ping_host4: google.com

2. For DNS lookup tests, same rules as above apply.
lealog commented 3 years ago

Feedback sent by email :)