{"id":3,"date":"2019-12-20T10:51:14","date_gmt":"2019-12-20T09:51:14","guid":{"rendered":"https:\/\/blogg.uit.no\/anb043\/?p=3"},"modified":"2019-12-20T21:17:39","modified_gmt":"2019-12-20T20:17:39","slug":"wi-fi-extensions-to-speedtest","status":"publish","type":"post","link":"https:\/\/blogg.uit.no\/anb043\/2019\/12\/20\/wi-fi-extensions-to-speedtest\/","title":{"rendered":"Wi-Fi extensions to Speedtest"},"content":{"rendered":"<p>At <a href=\"https:\/\/www.youtube.com\/playlist?list=PLXJsNZqZEF9YfpDNPvLrLAP6sg0KIV5xR\">WLPC<\/a> in Prague\u00a0I presented some <a href=\"https:\/\/github.com\/abaard\/aptools\">scripts<\/a> I&#8217;ve written\u00a0to collect client data from Cisco WLCs via SNMP. A handful of people have asked for more details regarding one of my use cases: providing and logging connection data when a user runs <a href=\"https:\/\/github.com\/librespeed\/speedtest\">speedtest<\/a> from a Wi-Fi client.<\/p>\n<p><img fetchpriority=\"high\" fetchpriority=\"high\" decoding=\"async\" class=\"size-medium wp-image-7 aligncenter\" src=\"https:\/\/blogg.uit.no\/anb043\/wp-content\/uploads\/sites\/172\/2019\/12\/20191220-speedtest-mbpac-300x269.png\" alt=\"\" width=\"300\" height=\"269\" srcset=\"https:\/\/blogg.uit.no\/anb043\/wp-content\/uploads\/sites\/172\/2019\/12\/20191220-speedtest-mbpac-300x269.png 300w, https:\/\/blogg.uit.no\/anb043\/wp-content\/uploads\/sites\/172\/2019\/12\/20191220-speedtest-mbpac-768x689.png 768w, https:\/\/blogg.uit.no\/anb043\/wp-content\/uploads\/sites\/172\/2019\/12\/20191220-speedtest-mbpac-1024x918.png 1024w, https:\/\/blogg.uit.no\/anb043\/wp-content\/uploads\/sites\/172\/2019\/12\/20191220-speedtest-mbpac.png 2034w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3>How it&#8217;s done<\/h3>\n<p>When the user clicks the start button, the speedtest server picks up the client&#8217;s IP address and sends it in a UDP packet to a Wi-Fi lookup server, which uses my scripts to retrieve data from the wireless LAN controlllers. This data is returned to the speedtest server, and forwarded to the client browser as part of the normal speedtest response.<\/p>\n<p>There&#8217;s some additional details, like what happens if the client is connected via cable, and syslog&#8217;ing of test results, but I&#8217;ll assume that&#8217;s below the noise floor. Look it up in the code or try it out if you&#8217;re interested. Or ask.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-12 aligncenter\" src=\"https:\/\/blogg.uit.no\/anb043\/wp-content\/uploads\/sites\/172\/2019\/12\/20191220-speedtest-mbpac-closeup-300x280.png\" alt=\"\" width=\"300\" height=\"280\" srcset=\"https:\/\/blogg.uit.no\/anb043\/wp-content\/uploads\/sites\/172\/2019\/12\/20191220-speedtest-mbpac-closeup-300x280.png 300w, https:\/\/blogg.uit.no\/anb043\/wp-content\/uploads\/sites\/172\/2019\/12\/20191220-speedtest-mbpac-closeup.png 546w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<h3>The code<\/h3>\n<p>The speedtest server extension (PHP code) is written by an ex-colleague of mine (who can contact me if he wants his name here), and inherits its license from the speedtest application (GPL). The Wi-Fi lookup code in Perl is mine, and it&#8217;s GPL&#8217;ed too.<\/p>\n<p>The source code available <a href=\"https:\/\/github.com\/abaard\/speedtestSrvExt\">here<\/a>.<\/p>\n<h3>Installation<\/h3>\n<ol>\n<li>The APtools scripts must be installed\u00a0 and capable of retrieving data from Cisco WLCs. Copy the two additional Perl scripts into the same directory as aplist\/apuser\/apclients.<\/li>\n<li>Verify that lookups work locally, based on client IP address<\/li>\n<li>The PHP files are aligned with the speedtest version on the <a href=\"https:\/\/www.wlanpi.com\/\">WLAN Pi<\/a>. If that&#8217;s your speedtest server platform, copy them to \/var\/www\/html\/<\/li>\n<li>Adjust the speedtest files to your environment (see below).<\/li>\n<li>Adjust the Wi-Fi lookup files\u00a0to your environment (ditto).<\/li>\n<\/ol>\n<h3>Adjustments<\/h3>\n<p>Determine a UDP port which gets through from your speedtest server to the Wi-Fi lookup server. In my environment the default 23456\/udp is blocked by firewall\/ACL, so I settled for 53\/udp instead. Which is what DNS uses. Not very nice, I know.<\/p>\n<p>Also, to use a port &lt;1024 the Wi-Fi lookup server must be started as root. If that&#8217;s the case for you, change $suUser in speedtesterWiFiLookupSrv.pl from &#8216;wifimgr&#8217; to a user that actually exists on the host.<\/p>\n<p>conf_settings:php: change to the host and port of your Wi-Fi lookup server.<\/p>\n<p>speedtest_worker.js: you may want to change getIp_ispInfo from &#8216;true&#8217; to &#8216;false&#8217; in line 52.<\/p>\n<p>speedtesterWiFiLookupSrv.pl:<br \/>\n\u2013 in line 55-58 you may want to insert the paths as prefixes to the external programs<br \/>\n\u2013 change the reg.exp in line 65 (sub accessAllowed{&#8230;}) to the IP address of your speedtest server, i.e. \/^(MY.IP.ADD.RESS)$\/<\/p>\n<h3 class=\"p1\">And GO!<\/h3>\n<p>Start &#8220;speedtesterWiFiLookupSrv.pl\u00a0<span class=\"s1\">rcvPort=yourUDPport debug=on&#8221;, and b<\/span>egin by verifying that the UDP packets flow from the speedtest server host to Wi-Fi lookup server and back. To do that, determine the IP address of a Wi-Fi client and use nc(1) in a terminal window with your server and port:<br \/>\nwlanpi@wlanpi: echo WI.FI.CLIENT.IP |nc -u lookupSrv lookupPort<\/p>\n<p>If you get something back it should work with speedtest too.<\/p>\n<p>Good luck!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At WLPC in Prague\u00a0I presented some scripts I&#8217;ve written\u00a0to collect client data from Cisco WLCs via SNMP. A handful of people have asked for more details regarding one of my use cases: providing and logging connection data when a user runs speedtest from a Wi-Fi client. How it&#8217;s done When the user clicks the start &hellip; <a href=\"https:\/\/blogg.uit.no\/anb043\/2019\/12\/20\/wi-fi-extensions-to-speedtest\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Wi-Fi extensions to Speedtest<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":287,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-3","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"featured_image_src":"","featured_image_src_square":false,"author_info":{"display_name":"Anders Baardsgaard","author_link":"https:\/\/blogg.uit.no\/anb043\/author\/anders-baardsgaard\/"},"rbea_author_info":{"display_name":"Anders Baardsgaard","author_link":"https:\/\/blogg.uit.no\/anb043\/author\/anders-baardsgaard\/"},"rbea_excerpt_info":"At WLPC in Prague\u00a0I presented some scripts I&#8217;ve written\u00a0to collect client data from Cisco WLCs via SNMP. A handful of people have asked for more details regarding one of my use cases: providing and logging connection data when a user runs speedtest from a Wi-Fi client. How it&#8217;s done When the user clicks the start &hellip; <a href=\"https:\/\/blogg.uit.no\/anb043\/2019\/12\/20\/wi-fi-extensions-to-speedtest\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Wi-Fi extensions to Speedtest<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a>","category_list":"<a href=\"https:\/\/blogg.uit.no\/anb043\/category\/uncategorized\/\" rel=\"category tag\">Uncategorized<\/a>","comments_num":"1 comment","_links":{"self":[{"href":"https:\/\/blogg.uit.no\/anb043\/wp-json\/wp\/v2\/posts\/3","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogg.uit.no\/anb043\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogg.uit.no\/anb043\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogg.uit.no\/anb043\/wp-json\/wp\/v2\/users\/287"}],"replies":[{"embeddable":true,"href":"https:\/\/blogg.uit.no\/anb043\/wp-json\/wp\/v2\/comments?post=3"}],"version-history":[{"count":15,"href":"https:\/\/blogg.uit.no\/anb043\/wp-json\/wp\/v2\/posts\/3\/revisions"}],"predecessor-version":[{"id":21,"href":"https:\/\/blogg.uit.no\/anb043\/wp-json\/wp\/v2\/posts\/3\/revisions\/21"}],"wp:attachment":[{"href":"https:\/\/blogg.uit.no\/anb043\/wp-json\/wp\/v2\/media?parent=3"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogg.uit.no\/anb043\/wp-json\/wp\/v2\/categories?post=3"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogg.uit.no\/anb043\/wp-json\/wp\/v2\/tags?post=3"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}