{"id":3110,"date":"2020-10-17T12:59:22","date_gmt":"2020-10-17T11:59:22","guid":{"rendered":"https:\/\/kudzia.eu\/b\/?p=3110"},"modified":"2023-03-22T08:56:13","modified_gmt":"2023-03-22T07:56:13","slug":"getting-upc-wifree-to-work-with-mikrotik-and-openwrt","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2020\/10\/getting-upc-wifree-to-work-with-mikrotik-and-openwrt\/","title":{"rendered":"UPC WiFree on Mikrotik and OpenWRT"},"content":{"rendered":"<p>UPC turns your cable modem into WiFi hot-spot available for others. outrageous! and i&#8217;ve been using it for quite a while &#8211; it generally works. below &#8211; how to connect OpenWRT or Mikrotik to such connection.<br \/>\n<!--more--><\/p>\n<h2>OpenWRT 22.03.0-rc6<\/h2>\n<p>on <a href=\"https:\/\/eko.one.pl\">Polish OpenWRT forum<\/a> &#8211; eko.one.pl &#8211; i&#8217;ve found a <a href=\"https:\/\/eko.one.pl\/forum\/viewtopic.php?pid=242066#p242066\">fully functional example<\/a>. i&#8217;ve tesed it on Netgear WNDR4300 and R6220. it works fine for me.<br \/>\nssh to the router, and there:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nopkg update\r\nopkg remove wpad*\r\nopkg install wpad-openssl libopenssl ca-bundle wget \r\nwget -O \/etc\/ssl\/certs\/LGI_Root_CA.cer https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2020\/10\/LGI_Root_CA.cer\r\n\r\nreboot\r\n\r\n# ssh again\r\nuci set wireless.radio0.disabled='0'\r\nuci set wireless.radio0.txpower='20'\r\nuci set wireless.radio0.htmode='HT40'\r\nuci set wireless.radio0.channel='auto'\r\nuci set wireless.radio0.country='PL'\r\nuci set wireless.default_radio0=wifi-iface\r\nuci set wireless.default_radio0.device='radio0'\r\nuci set wireless.default_radio0.mode='sta'\r\nuci set wireless.default_radio0.network='upcwifree'\r\nuci set wireless.default_radio0.ssid='Wi-Free #InternetUPCNajszybszy'\r\nuci set wireless.default_radio0.encryption='wpa2+ccmp'\r\nuci set wireless.default_radio0.eap_type='ttls'\r\nuci set wireless.default_radio0.phase1='peaplabel=1'\r\nuci set wireless.default_radio0.phase2='auth=MSCHAPV2'\r\nuci set wireless.default_radio0.ca_cert='\/etc\/ssl\/certs\/LGI_Root_CA.cer'\r\nuci set wireless.default_radio0.wps_pushbutton='0'\r\n# below enter your actual login for UPC WiFree\r\nuci set wireless.default_radio0.identity='my upc wifree login'\r\n# below enter your actual password for UPC WiFree\r\nuci set wireless.default_radio0.password='my password'\r\nuci set wireless.default_radio0.disabled='0'\r\nuci set wireless.default_radio0.ifname='wlan0'\r\nuci set wireless.default_radio0.auth='MSCHAPV2'\r\nuci commit wireless\r\n\r\nuci set network.upcwifree=interface \r\nuci set network.upcwifree.proto='dhcp'\r\nuci set network.upcwifree.auto='1'\r\nuci set network.upcwifree.ipv6='0'\r\nuci commit network\r\n\r\nuci set firewall.@zone&#x5B;1].network=''wan' 'wan6' 'upcwifree''\r\n<\/pre>\n<p>sometimes, some of the neighboring routers no longer provide connectivity [ or even IP address via DHCP ] for this wlan. to find out all available neighbors &#8211; run:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\niwinfo wlan0 scan\r\n# you might need to first install it - opkg update; opkg install iwinfo\r\n<\/pre>\n<p>in the output &#8211; find few candidates with highest possible value of Signal &#8211; e.g.:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nCell 07 - Address: 92:xx:xx:xx:xx:xx\r\n          ESSID: &quot;Wi-Free #InternetUPCNajszybszy&quot;\r\n          Mode: Master  Channel: 11\r\n          Signal: -61 dBm  Quality: 49\/70\r\n          Encryption: WPA2 802.1X (TKIP, CCMP)\r\n...\r\nCell 09 - Address: AE:xx:xx:xx:xx:xx\r\n          ESSID: &quot;Wi-Free #InternetUPCNajszybszy&quot;\r\n          Mode: Master  Channel: 1\r\n          Signal: -62 dBm  Quality: 48\/70\r\n          Encryption: WPA2 802.1X (CCMP)\r\n<\/pre>\n<p>take the MAC address and run:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nuci set wireless.default_radio0.bssid=&quot;AE:xx:xx:xx:xx:xx&quot;\r\nuci commit network\r\nreboot\r\n<\/pre>\n<p>iterate it few times until you find a neighboring device that works.<\/p>\n<h2>OpenWRT 19.07.4<\/h2>\n<p>install needed packages:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nopkg update\r\nopkg remove wpad*\r\nopkg install wpad-openssl libopenssl ca-bundle\r\n\r\nuci set wireless.radio0.disabled='0'\r\nuci set wireless.radio0.txpower='20'\r\nuci set wireless.radio0.htmode='HT40'\r\nuci set wireless.radio0.channel='auto'\r\nuci set wireless.radio0.country='PL'\r\nuci set wireless.default_radio0=wifi-iface\r\nuci set wireless.default_radio0.device='radio0'\r\nuci set wireless.default_radio0.mode='sta'\r\nuci set wireless.default_radio0.network='upcwifree'\r\nuci set wireless.default_radio0.ssid='UPC Wi-Free #SprawdzUPCMobile!'\r\nuci set wireless.default_radio0.encryption='wpa2+ccmp'\r\nuci set wireless.default_radio0.eap_type='ttls'\r\nuci set wireless.default_radio0.phase1='peaplabel=1'\r\nuci set wireless.default_radio0.phase2='auth=MSCHAPV2'\r\nuci set wireless.default_radio0.ca_cert='\/etc\/ssl\/certs\/LGI_Root_CA.cer'\r\nuci set wireless.default_radio0.wps_pushbutton='0'\r\n# below enter your actual login for UPC WiFree\r\nuci set wireless.default_radio0.identity='my upc wifree login'\r\n# below enter your actual password for UPC WiFree\r\nuci set wireless.default_radio0.password='my password'\r\nuci set wireless.default_radio0.disabled='0'\r\nuci set wireless.default_radio0.ifname='wlan0'\r\nuci set wireless.default_radio0.auth='MSCHAPV2'\r\nuci commit wireless\r\n\r\nuci set network.upcwifree=interface \r\nuci set network.upcwifree.proto='dhcp'\r\nuci set network.upcwifree.auto='1'\r\nuci set network.upcwifree.ipv6='0'\r\nuci commit network\r\n\r\nuci set firewall.@zone&#x5B;1].network=''wan' 'wan6' 'upcwifree''\r\nuci commit firewall\r\n\r\n<\/pre>\n<p>download <a href=\"\/b\/wp-content\/uploads\/2020\/10\/LGI_Root_CA.cer\">LGI_Root_CA.cer<\/a> and save it in \/etc\/ssl\/certs\/<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nopkg install libustream-openssl20150806 ca-bundle ca-certificates wget libustream-openssl20150806\r\nwget -O \/etc\/ssl\/certs\/LGI_Root_CA.cer https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2020\/10\/LGI_Root_CA.cer\r\n<\/pre>\n<p>reconfigure your 2.4GHz wifi interface [ WiFree only works on that band, not surprisingly since wall penetration of 5GHz is much worse ]:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nuci set wireless.radio0.disabled='0'\r\nuci set wireless.radio0.txpower='20'\r\nuci set wireless.radio0.htmode='HT40'\r\nuci set wireless.radio0.channel='auto'\r\nuci set wireless.radio0.country='PL'\r\nuci set wireless.default_radio0=wifi-iface\r\nuci set wireless.default_radio0.device='radio0'\r\nuci set wireless.default_radio0.mode='sta'\r\nuci set wireless.default_radio0.network='upcwifree'\r\nuci set wireless.default_radio0.ssid='UPC Wi-Free #SprawdzUPCMobile!'\r\nuci set wireless.default_radio0.encryption='wpa2+ccmp'\r\nuci set wireless.default_radio0.eap_type='ttls'\r\nuci set wireless.default_radio0.phase1='peaplabel=1'\r\nuci set wireless.default_radio0.phase2='auth=MSCHAPV2'\r\nuci set wireless.default_radio0.ca_cert='\/etc\/ssl\/certs\/LGI_Root_CA.cer'\r\nuci set wireless.default_radio0.wps_pushbutton='0'\r\n# below enter your actual login for UPC WiFree\r\nuci set wireless.default_radio0.identity='my upc wifree login'\r\n# below enter your actual password for UPC WiFree\r\nuci set wireless.default_radio0.password='my password'\r\nuci set wireless.default_radio0.disabled='0'\r\nuci set wireless.default_radio0.ifname='wlan0'\r\nuci set wireless.default_radio0.auth='MSCHAPV2'\r\nuci commit wireless\r\n\r\nuci set network.upcwifree=interface \r\nuci set network.upcwifree.proto='dhcp'\r\nuci set network.upcwifree.auto='1'\r\nuci set network.upcwifree.ipv6='0'\r\nuci commit network\r\n\r\nuci set firewall.@zone&#x5B;1].network=''wan' 'wan6' 'upcwifree''\r\nuci commit firewall\r\n<\/pre>\n<h2>Mikrotik 7.1.beta2<\/h2>\n<p>i&#8217;m using this on 751G-2HnD with development firmware, although it should work on other software too.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\/interface wireless security-profiles\r\nset &#x5B; find default=yes ] supplicant-identity=MikroTik\r\nadd authentication-types=wpa2-eap eap-methods=peap group-ciphers=tkip,aes-ccm management-protection=allowed mode=dynamic-keys mschapv2-password=my-upc-password mschapv2-username=my-upc-login name=UPC supplicant-identity=my-upc-login tls-mode=dont-verify-certificate unicast-ciphers=tkip,aes-ccm\r\n\/interface wireless\r\nset &#x5B; find default-name=wlan1 ] band=2ghz-b\/g\/n country=poland default-authentication=no disabled=no frequency=2437 installation=indoor security-profile=UPC ssid=&quot;UPC Wi-Free #SprawdzUPCMobile!&quot; wireless-protocol=802.11\r\n\r\n\/interface wireless connect-list\r\nadd interface=wlan1 mac-address=92:5C:14:AB:8F:57 security-profile=UPC ssid=&quot;UPC Wi-Free #SprawdzUPCMobile!&quot; wireless-protocol=802.11\r\n# above is not strictly needed but i wanted mikrotik to always choose device that i know is closest to me.\r\n\r\n\/ip dhcp-client\r\nadd disabled=no interface=wlan1\r\n<\/pre>\n<p>on both devices i&#8217;m also running WireGuard VPN &#8211; so i can reach both from anywhere in the internet, despite the fact that neither has public IP address. both routers establish VPN to my VPS. OpenWRT gave me a bit of headache &#8211; VPN would not re-establish after short drops of the WiFi acts as WAN. after each such episode wg0 would disappear and to reinstantiate it i had to either run <i>\/etc\/init.d\/network restart<\/i> or reboot router. i&#8217;ve searched for help on <a href=\"https:\/\/forum.openwrt.org\/t\/wireguard-disappears-after-each-episode-of-wan-disconnect\/77378\/2\">the OpenWRT forum<\/a>. this did not help:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nuci set network.wg0.tunlink='upcwifree'\r\n<\/pre>\n<p>so i ended up doing this:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\necho &quot;* * * * * root ping -c 5 172.16.1.1 ; if &#x5B; $? -ne 0 ] ; then \/etc\/init.d\/network restart ; fi&quot; &gt;&gt; \/etc\/crontab\/root\r\n\/etc\/init.d\/cron restart\r\n<\/pre>\n<p>where 172.16.1.1 is remote end of the VPN. yes, it&#8217;s rather crude measure.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPC turns your cable modem into WiFi hot-spot available for others. outrageous! and i&#8217;ve been using it for quite a while &#8211; it generally works. below &#8211; how to connect OpenWRT or Mikrotik to such connection.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3110","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=3110"}],"version-history":[{"count":24,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3110\/revisions"}],"predecessor-version":[{"id":3442,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3110\/revisions\/3442"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=3110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=3110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=3110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}