Bypassing Three UK’s tethering block to use the iPhone Personal Hotspot

Bypassing Three UK’s tethering block to use the iPhone Personal Hotspot

Finally! It’s intricate, convoluted and definitely not worth the £5/month saving but it’s a victory none the less.

It appears Three uses layer 7 packet inspection to detect if you’re using a browser with a non-mobile user agent. Just change the damn user agent, I hear you cry. Sadly not. This does work for a few seconds before Windows sends some packets in the background that screw the whole thing up. Also, web pages show in mobile mode. During testing, I was blocked a few times. Turning Airplane mode on for a few moments and then off again cleared this.

Annoyingly, when Windows connects to a WiFi network it does some useful HTTP requests to see if you have access to the web. Once you do, it considers you fully connected. However, this lets Three know you’re tethering and they block you. The solution I have found is thus:

  1. Enable Windows firewall on your computer
  2. Use the “Windows firewall with advanced security” tool to block ALL outbound traffic from your computer. This doesn’t actually do what it says on the tin as DHCP requests and the suchlike still work
  3. Enable the personal hotspot on the iPhone and connect up to it via Wifi. Windows will say there’s “Limited connectivity”. This is ok.
  4. Browse the web using Safari on your iPhone and ensure you can flick from page to page fairly quickly. A slow connection won’t help your case here
  5. Have a VPN configured and on Standby on your computer. Ensure that, in the properties of the VPN, under Networking->IPv4->Advanced the “use default gateway on remote network” box is checked
  6. Disable the firewall rule you created. The quickest and least obtrusive way to do this is using the “Disable rule” button on the right of the firewall manager
  7. VERY QUICKLY! after this, connect up to your VPN. With any luck, you’ll connect up before Windows blabs on you. Once you’re connected, everything will go over the VPN and Three won’t be able to inspect your packets

If you fail, just try again. It’s all about getting the timing right. As I said, enable airplane mode, wait a few moments and enable it again. If you can browse the web on your phone then you’re all reset and ready to try again.

Happy to answer any questions if you leave a comment. I’m not going to hand-hold in getting or connecting to a VPN – I’m sure you can work this out yourselves 😉

Configuring Cisco IOS switches for Cisco VOIP phones

Some Cisco switches, such as our Catalyst 3560 series, have Smartports which can be configured via the switch’s web interface to have roles. These roles provide the ports with typical settings for network security and QOS. If your switch doesn’t have Smartports these are Cisco’s recommended settings for each switch interface which is supporting a Cisco VOIP phone. It is taken in the content of interface fa0/1

  1. interface FastEthernet0/1
  2. switchport access vlan 14
  3. switchport mode access
  4. switchport voice vlan 5
  5. switchport port-security maximum 2
  6. switchport port-security
  7. switchport port-security aging time 2
  8. switchport port-security violation restrict
  9. switchport port-security aging type inactivity
  10. macro description cisco-phone
  11. auto qos voip cisco-phone
  12. spanning-tree portfast
  13. spanning-tree bpduguard enable


You’ll need to change the access VLAN ID and voice VLAN ID to relate to your own PCs VLAN and voice VLAN.

PHP: Interfacing with HeatMiser WiFi thermostats

PHP: Interfacing with HeatMiser WiFi thermostats

I’m quite a big fan of writing code that interfaces with physical data. It somehow feels more fulfilling to see or feel the results.

On top of my repertoire of the Foscam FI8908W Recorder and TK110 GPS Tracker Server, comes a PHP interface for HeatMiser WiFi Thermostats. This too can be found on GitHub. The code is fairly self explanatory and the docs should point you in the right direction. The library will read from and write to HeatMiser WiFi thermostats. It’s tested on the PRT-TS but should probably work on others. If not, fix it up and submit a pull request on Github (or comment here).

If you came looking for an insight into this Theromstat’s binary network protocol, there’s a decent guide released by HeatMiser on the topic. This can be found on their website. The guide can be a lot to get your head around so hopefully my code will be enough to aid you in this area. Failing that, or if you’re more of a camel, there’s a good Perl implementation on Google Code. The Perl implementation is more of an example than an interface-able library but it’s a great starting point and provided a lot of inspiration for my PHP implementation.


PHP: Find number of weeks in a given month

The following function finds the number of weeks in a given month, assuming Monday as the first day of the week.

  1. <?php
  2. function weeks_in_month($month, $year) {
  3. // Start of month
  4. $start = mktime(0, 0, 0, $month, 1, $year);
  5. // End of month
  6. $end = mktime(0, 0, 0, $month, date('t', $start), $year);
  7. // Start week
  8. $start_week = date('W', $start);
  9. // End week
  10. $end_week = date('W', $end);
  12. if ($end_week < $start_week) { // Month wraps
  13. return ((52 + $end_week) - $start_week) + 1;
  14. }
  16. return ($end_week - $start_week) + 1;
  17. }