Category: Uncategorized


After moving from my home office to a real office I decided to downgrade my premium 80/20 business fttc connection (from claranet) to a residential 40/10 service from sky.

Yesterday, the connection was changed over and I found myself with no internet. I initially thought it was because the pppoe username and password needed updating (tail /var/log/messages was showing a CHAP authentication error message) but I don’t recall ever being sent a username/password. It was then I had a flashback to many years ago having to extract the details from a router/modem in order to use them in another device. A bit of googling backed this up, but also suggested the connection doesn’t use pppoe but MPoA and was going to be even more challenging to setup; http://www.skyuser.co.uk/forum/sky-broadband-fibre-help/51550-ubiquiti-edgerouter-lite.html

But this article was written in 2013, surely someone has documented the process more recently? Fortunately, before starting the long-winded process I stumbled across another aritcle; https://community.ubnt.com/t5/EdgeMAX/Sky-Fibre-DHCP-client-option-61/td-p/1172347. However, this seemed to point to needing a different modem (such as the Draytek Vigor 13) to achieve the MPoA connection.

Before I went and bought a new modem, I thought i’d try the BT Openreach/Huawei Echolife HG12. I deleted the pppoe interface from the Edgerouter and set the address on eth0 (connected to the modem) to DHCP. Still nothing… welll both of the previous articles did state the need to add the DHCP option; send dhcp-client-identifier "user|pass"; so I guess it’s time to unbox the Sky router and do some packet sniffing?

I must be in luck… 2 weeks ago, a post suggested you no longer need to use logon credentials, passing anything in the dhcp-client-identifier will do the trick. The example given was;

 client-option "send dhcp-client-identifier "bacons";"

So I gave it a try, but still no dice. Worth a reboot I guess? Power cycled the modem and voila, we have internet! Well, that was simpler than anticipated.

edgerouter_sky_fttc

I flashed 5 of these phones back 6 months ago with some difficulty (after trying different methods/firmware versions/network cables/switches etc I finally got them all working), unfortunately I failed to record my findings! Time to resurrect the blog!

Last week I found myself with a few more Cisco CP-7906G IP phones to convert from old SCCP firmware to SIP. Rather than using the xml.conf method I chose to hard reset (I could remember this is how I did it last time);

  • Hold the # key while powering on the phone (either by POE or mains)
  • Once the red indicator on the handset start flashing release #
  • Key 3491672850*#

As my FreePBX (Asterisk PBX) is running and has the firmware ready I hoped everything would just work… Unfortunately not. All of the phones got stuck trying to pull term06.default.loads. I spent countless hours trying to figure out the problem, including;

  • Trying different DHCP servers (tftpd32, tftpd64, pumpkin & solarwinds TFTP server)
  • Trying different switches, network patch leads and even a direct connection between my laptop and the phones
  • Trying different IP ranges and network configurations

But still the phones repeatedly searched for term06.default.loads;

Dec 30 10:15:32 localhost in.tftpd[24929]: RRQ from 192.168.0.224 filename term06.default.loads
Dec 30 10:15:33 localhost in.tftpd[24950]: RRQ from 192.168.0.224 filename term06.default.loads
Dec 30 10:18:00 localhost in.tftpd[25093]: RRQ from 192.168.0.224 filename term06.default.loads
Dec 30 10:18:00 localhost in.tftpd[25094]: RRQ from 192.168.0.224 filename term06.default.loads
Dec 30 10:19:33 localhost in.tftpd[25151]: RRQ from 192.168.0.224 filename term06.default.loads
Dec 30 10:19:34 localhost in.tftpd[25152]: RRQ from 192.168.0.224 filename term06.default.loads

Eventually I decided to try a few different firmware versions “just in case”. Initially none worked (and they are hard to come by because I don’t have an active Cisco subscription and without one, you cannot download them directly from Cisco).

After almost giving up, I figured out that many of the firmware images I was previously unable to open (.cop or .cop.sgn) were in fact just zip files which can be opened in 7-zip. I recall when using the old technique to upgrade the firmware you need to start with a version around 8.5 then slowly incrementally patch. I didn’t think this was necessary with the “hard reset” technique, but found cmterm-7911_7906-sccp.8-5-2.cop.sgn and gave it a whirl….

Dec 30 10:44:41 localhost in.tftpd[26016]: RRQ from 192.168.0.245 filename term06.default.loads
Dec 30 10:44:42 localhost in.tftpd[26017]: RRQ from 192.168.0.245 filename jar11sccp.8-5-2TH1-9.sbn
Dec 30 10:44:49 localhost in.tftpd[26018]: RRQ from 192.168.0.245 filename cnu11.8-5-2TH1-9.sbn
Dec 30 10:44:51 localhost in.tftpd[26019]: RRQ from 192.168.0.245 filename apps11.8-5-2TH1-9.sbn
Dec 30 10:45:03 localhost in.tftpd[26024]: RRQ from 192.168.0.245 filename dsp11.8-5-2TH1-9.sbn
Dec 30 10:45:05 localhost in.tftpd[26025]: RRQ from 192.168.0.245 filename cvm11sccp.8-5-2TH1-9.sbn

Instantly the phone picked up term06.default.loads and proceeded to pickup the other files!

Once the phone booted, it clearly wasn’t going to register against my PBX (as it’s still running SCCP firmware). So I placed the SIP firmware cmterm-7911_7906-sip.9-4-2SR1-1.cop.sgn back on the TFTP. Carried out another hard reset and again, the phone instantly picked up the new files;

Dec 30 11:01:20 localhost in.tftpd[26726]: RRQ from 192.168.0.224 filename term06.default.loads
Dec 30 11:01:21 localhost in.tftpd[26727]: RRQ from 192.168.0.224 filename jar11sip.9-4-2ES9.sbn
Dec 30 11:01:28 localhost in.tftpd[26729]: RRQ from 192.168.0.224 filename cnu11.9-4-2ES9.sbn
Dec 30 11:01:31 localhost in.tftpd[26730]: RRQ from 192.168.0.224 filename apps11.9-4-2ES9.sbn
Dec 30 11:01:44 localhost in.tftpd[26736]: RRQ from 192.168.0.224 filename dsp11.9-4-2ES9.sbn
Dec 30 11:01:46 localhost in.tftpd[26737]: RRQ from 192.168.0.224 filename cvm11sip.9-4-2ES9.sbn

I provisioned the phones in FreePBX but they seemed to get stuck in a cycle registering/updating locale/rebooting. Fortunately I recalled having this issue previously and determined that the 7906 phones have a relatively short maximum password length which the default FreePBX passwords exceed. I was able to confirm this by looking at the Asterisk log;

[root@localhost ~]# tail /var/log/asterisk/full
[2015-12-30 02:06:30] NOTICE[1915] chan_sip.c: Registration from '<sip:1006@192.168.0.195>' failed for '192.168.0.198:51838' - Wrong password
[2015-12-30 02:08:07] NOTICE[1915] chan_sip.c: Registration from '<sip:1006@192.168.0.195>' failed for '192.168.0.198:51978' - Wrong password
[2015-12-30 02:08:54] NOTICE[1915] chan_sip.c: Registration from '<sip:1006@192.168.0.195>' failed for '192.168.0.198:49878' - Wrong password

Once I changed the password and rebuilt the configs in Endpoint manager the phones registered straight away.

In conclusion, I think the bootloader on the phones needed to be upgraded to enable them to be capable of loading the 9.x firmware. Flashing them with the 8.x firmware first upgraded the bootloader and from there it was plane sailing! I have attached the two firmwares for reference;

As a sidenote; I have never had luck with using DHCP option 150 (in either pfSense or tftpd32). Entering an IP address in it’s normal format has definitely never worked (when I do a wireshark trace I can confirm this). I believe you’re supposed to use some hex format, but having tried this in several different formats i’ve still never managed to get it working. The preferable route seems to be using DHCP option 66 (I believe this supports either a hostname or IP). In tftpd32 you don’t actually need to configure this option, the built in DHCP server automatically configures it to the hostname of the interface running the service.

For our helpdesk/support/ticketing system we have a screen mounted on the wall with key stats (still a work in progress);

tel_dash

90% of the data is pulling from a SQL database- simple stuff! However, we wanted to pull in the number of unanswered e-mails currently sitting in our support mailbox (circled in red).

Retreiving Data From the Inbox

The first challenge was to find a way to pull the number of e-mails. A small .NET app seemed like the way to go (we could then push the data into SQL and pull it into SSRS).

The first attempt used Microsoft.Office.Interop.Outlook;

var app = new Microsoft.Office.Interop.Outlook.Application();
var ns = app.GetNamespace("MAPI");
ns.Logon(null, null, false, false);
Outlook.Recipient recipient;
recipient = ns.CreateRecipient("Tickett Enterprises Support");
var inbox = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
var subfolder = inbox.Folders[1];
var shared = ns.GetSharedDefaultFolder(recipient ,Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
return shared.Items.Count.ToString();

This was straightforward but assumes the application is being run on a machine with outlook installed and configured with the Inbox setup etc. As our e-mail is provided by Exchange (Office 365) the recommended approach appeared to be utilising the Exchange Web Services Managed API (EWS). Writing this code took considerably longer. I got stuck troubleshooting “Autodiscover service couldn’t be located” error… I decided to point the API directly at the EWS URL but that failed with 401 Unauthorized Exception.

I’m not 100% sure of the cause, but it seems that my windows credentials were either not being passed or were not being recognised/interpreted correctly. Microsoft’s sample code uses

service.UseDefaultCredentials = true;

…but changing this to false fixed the 401. My end code was;

            
try
{
  ExchangeService service = new ExchangeService();
  service.Credentials = new WebCredentials("user@domain", "password", "");
  service.UseDefaultCredentials = false;
  service.Url = new Uri("https://pod51047.outlook.com/ews/exchange.asmx");
  Mailbox mb = new Mailbox("support@domain");
  return Folder.Bind(service, new FolderId(WellKnownFolderName.Inbox, mb)).TotalCount.ToString();
}
  catch (Exception ex)
{
  return ex.Message;
}

A colleague then suggested calling this code directly from SSRS instead of pushing/pulling to/from SQL. So… the .NET project was compiled as a class library and the rest should be easy?

Loading/Calling the DLL in SSRS

I expected this to be straightforward, but let’s face it- it never is! Fortunately, google saved the day.

In my development environment (local machine) I had to;

  • Reference my custom dll (in BIDS / Visual Studio, on the report menu, under report properties, references)
  • Copy my custom dll to C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies (This is for Visual Studio 2010, your path may differ slightly)
  • Copy any additional dlls your dll references to C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies (for me, this was Microsoft.Exchange.WebServices.dll)
  • Modify C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\RSPreviewPolicy.config (under each Codegroup node, set the PermissionSetName to FullTrust)

This had me up and running! I was hoping the same process would be true for deployment to the reporting service, think again! It turns out SSRS 2012 only supports .net 3.5 and earlier (my code was compiled as 4). Fortunately I was able to recompile my dll in .net 3.5 without any drama.

Then roughly the same process in my production environment (ssrs 2012);

  • Copy my custom dll and dependencies to c:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\bin (for SQL Server Reporting Services 2012)
  • Modify c:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\rssrvpolicy.config (under each Codegroup node, set the PermissionSetName to FullTrust)

Further to https://tickett.wordpress.com/2014/04/17/new-lab-nas/ I have now received my new hardware and had time to think and experiment.

My first experiment was iSCSI vs NFS. I created 2x 2-disk RAID0 Volumes on the Synology DS 1813+ (using the 4x Samsung EVO 840 SSD) and attached them to my new ESXi host. I then installed a clean Windows 7 VM on each volume. After installing windows I did some file copies and made a few notes.

Image

The graph above (along with the figures in the table) do a great job of showing the results. NFS cam out over 20% faster. You can see the max read speed recorded as 93 MB/s (only 71 MB/s for iSCSI) and write rate recorded as 77 MB/s (only 62 MB/s for iSCSI).

I then ran Crystal Disk Mark on the iSCSI VM:

Image

And the NFS VM:

Image

Here some of the results are less of an improvements, but others are more than doubled. All of the above ruled iSCSI out for me.

But I then got thinking about local storage. I only run one ESXi host these days (I have a spare host ready to swap out if I need to, but to save electricity I only run one at a time), so the benefit of networked/shared storage is almost non-existent (I will be backing up snapshots to the NAS).

I couldn’t initially create a 2 disk RAID0 array because ESXi doesn’t support my motherboard’s onboard raid, so I stuck with a single local disk (the Samsung EVO 840 SSD again); Installed Windows 7 and ran the Crystal Disk Mark benchmark:

Image

I then found an old PCIe SSD (OCZ Revodrive x3) and thought i’d give that a try more out of interest:

Image

Nice! Unfortunately the PCIe SSD isn’t directly supported in ESXi so I had to create a normal VM and connect the SSD using passthrough. This would essentially mean it could only be connected to one VM (which wouldn’t be a huge problem as I’d want to connect it to my SQL VM) but the stability isn’t great either.

I picked up a cheap LSI SAS3041E raid card from eBay and went about setting up the local 2 disk RAID0 array. The results were very surprising:

Image

These are all below the speeds seen using a single SSD. See the below table to easily compare:

I’m not sure whether this is because the raid card, or the lack of TRIM support or some other obscure reason. I decided i’m happier running 2 separate SSDs anyway (I can split SQL db & logs between the two discs to see a performance boost) and if something goes wrong I will only have to restore half my VMs from nightly backup.

iSCSI NFS Local Single SSD Passthrough PCIe SSD Local RAID0 2x SSD
Seq Read 96.74 101.4 238.7 1371 233.4
Seq Write 30.61 72.91 229.1 1089 219.9
512K Read 74.77 74.48 228.3 1051 210.1
512K Write 45.46 66.23 223.8 1010 208.2
4K Read 4.138 5.213 22.92 30.36 18.31
4K Write 4.337 4.781 52.73 68.65 23.59
4K QD32 Read 6.575 8.661 212.8 281.1 62.26
4K QE32 Write 5.582 8.791 199.7 240.9 92.81

Screen Shot 2014-04-25 at 16.20.55

 

 

And another without the PCIe SSD to make it a little easier to compare:

Screen Shot 2014-04-25 at 16.26.58

So, in conclusion- I will be running 2 of the 250GB Samsung EVO 840 SSDs locally in the ESXi host. This will provide optimal performance and hugely reduce my dependance on the network and NAS (currently the VMs live on the NAS and I can’t take it or the network down without powering everything down first; my pfSense software router resides in a VM too, so I lose internet connectivity!). I will continue to use Veem to take nightly backups should anything go wrong with the ESXi host.

I hope to migrate everything over the weekend- fingers crossed.

Solar Update

I posted some details back in October when I had my solar panels installed https://tickett.wordpress.com/2013/10/25/solar-kwh-meters-new-fuse-box-flukso/

I thought i’d provide a little update to show how much i’m getting out of them;

Image

 

This shows my best day so far.

Image

This shows a daily summary for the last 40 days.

Image

And for the last 12 weeks.

To give you an idea, i’m on a feed-in-tariff paying roughly 17.5p/kWh so on my best day 23kWh earnt me £4. Not to mention that based on the estimation that i’m consuming 50% @ 13.5p that’s another £1.50.

Image

And one last screen showing average daily generation through the winter months. Making a mere 50p/day :)

New Lab / NAS

Far too long since the last post. Let’s hope this will be the start of them picking back up again!

I have been experiencing some performance issues and need to have a bit of a re-shuffle of the servers/network (my vCenter appliance has stopped working, SQL is being slow etc). I have some production stuff running and don’t want to take everything offline for long so decided to build a new environment then migrate stuff.

I wont be changing much; 

Old NAS; Synology DiskStation 1812+ w/
-4x 3TB WD Green in Synology Hybrid Raid (SHR) : Main data store for Movies, PVR Recordings, ISOs, Photos etc (CIFS & NFS)
-2x 256GB OCZ Vertex4 SSD in RAID0 : Virtual machine storage (NFS)
-2x1gbit LACP to switch
Old ESXi Host; SuperMicro X8SIL-F w/ Xeon X3470 & 16GB RAM running VMWare ESXi v5.1
Old switch; Linksys SRW2024W

New NAS; Snology DiskStation 1813+ w/
-3x 4TB WD Red in Synology Hybrid Raid (SHR) : Main data store for Movies, PVR Recordings, ISOs, Photos etc (CIFS & NFS)
-3/4?x 250GB Samsung EVO 840 SSD in RAID0? : Virtual machine storage (NFS/iSCSI?)
-3x1gbit LACP to switch dedicated to main data store
-1gbit to switch dedicated to VM storage
New ESXi Host; SuperMicro X8SIL-F w/ Xeon X3470 & 32GB RAM running VMWare ESXi v5.5
New switch; Cisco SG200-26 (separate vm storage traffic on it’s own VLAN/subnet)

You’ll notice a bunch of questions marks around the new Virtual machine storage volume. I’m currently debating which disk configuration to use and which storage protocol. I’ve always used NFS as it seems much simpler but understood iSCSI to be the better option (especially with the Synology supporting VAAI hardware acceleration). But despite this, i’ve been reading that NFS seems to outperform iSCSI.

Additionally, if I go iSCSI I will try using 2x1gbit ports and enabling multipathing / round-robin. If I go down the NFS route I don’t think LACP will provide any benefit as the IP hash from a single ESXi host to the single DiskStation will always use the same link?

I have 4 of the EVO SSD so am initially creating a 2 disk RAID0 volume using NFS and an identical volume using iSCSI. I can then try running some like for like comparisons/benchmarks to determine which configuration to use going forward.

I will provide an update shortly.

Further 433Mhz RF Hacking

Further to https://tickett.wordpress.com/2012/06/27/more-433mhz-rf-hacking/

I noticed some referral traffic coming from Erlands blog: http://fedmow349.blogspot.co.uk/2013/05/hacking-433mhz-rf-link-home-automation.html

He used https://code.google.com/p/rc-switch/ on his arduino to receive/interpret the 433Mhz traffic and it works a treat for the cheapo PIR, door/window sensors, smoke alarms etc

4f77d093 1440 4530 b3c1 283ec01a57f9

Here is a sample output from one of the door sensors. It quite rightly identifies the state 0/1/F of each jumper:

Decimal: 1398131 (24Bit) Binary: 000101010101010101110011 Tri-State: 0FFFFFFFF101 PulseLength: 525 microseconds Protocol: 1
Raw data: 16344,540,1560,544,1564,544,1560,1588,508,540,1568,1584,516,540,1564,1588,512,528,1576,1580,524,536,1576,1576,524,528,1584,1580,524,528,1584,1576,528,524,1588,1576,540,1572,544,1572,544,520,1604,520,1604,1572,544,1568,552,

I'm in the process of firing up a new Raspberry Pi DomitiGa server. I will use a JeeNode connected via USB Serial to receive 433Mhz traffic alongside 868Mhz JeeNode traffic. I guess I can probably get rid of my RFXCom 433Mhz transceiver now?

Despite still having a handful of unfinished projects I decided to take the plunge and have some solar panels installed. I found a local MCS accredited installer MAH Solar Solutions and in no time had the kit up and running. My house faces east/west so I have 8 panels on each side.

Image

The panels are Canadian Solar 250W, total 16 to form a 4KW system fed into a Aurora ONE/PVI 3.6 inverter in the loft.

Image

The solar install was the perfect opportunity to finally replace my ancient fusewire consumer unit. Which got me to thinking of ways I may be able to better monitor my energy consumption. I hoped to find “a magical fuse box” but hours, days, weeks of research and the best solution I could come up with were DIN rail mount KWH meters.

Unfortunately no amount of searching could find a single image of the KWH meters in use or a diagram of how to wire them in a consumer unit. Instinct told me to have each meter mounted alongside each breaker, but this would prevent me from using the busbar. Then I thought about mounting them upside down, but this would cause similar issues and mean running the neutral far too close to the busbar! The next idea was to either mount 2 consumer units side by side, having the breakers in one and the meters in the other… Then I found some information about twin/dual rail consumer units which seemed like a winning idea.

MAH Solar Solutions were to be installing the new consumer unit and despite having never seen or used the KWH meters before they were more than happy to install them. They came up with the idea of mounting the meters at the end of each block of breakers. With a big enough consumer unit this meant the busbar could still be used. I will try and add some diagrams and more images at a later date.

Image

I’m still working the best way to read so many pulse counters simultaneously and log/process the data. Currently http://openenergymonitor.org/emon/buildingblocks/12-input-pulse-counting looks like one of the most promising, but I will need to start from scratch with a way to count, store, transmit etc. So for the time being I decided on the fluksometer which can handle 4 pulse inputs- which will do for now: mains, solar, oven & gas meter.

Image

The flukso service itself provides quite nice graphing- you can see here my mains consumption (blue), oven consumption (green), solar pv generation (red) and gas consumption (orange).

Image

Which feeds nicely to pvoutput.org.

Image

You can see the rj11 cable coming out of the gas meter (to the fluksometer). The purple cable runs from the RS485 port on the inverter in the loft. I am waiting on a USB to RS485 device so I can start pulling some detailed data using Aurora Monitor or similar.

Image

I understand the fluksometer has an onboard RFM12B configured on the 868Mhz band to understand communication from jeelabs devices- which is ideal as I meter my water using jeenodes.

Image

I just don’t know how to get them talking… yet!

Arcade Cabinet Update

A quick train update…

Whilst gutting the cabs I collected last week I thought I’d try booting one that still contained most of it’s parts:

To my amazement it worked. There was a rather worrying hissing sound coming from the power supply unit but I proceeded none-the-less:

Several minutes later with a rather spectacular bang everything went black! I have dumped the hard drive to have a little look around at a later date:

I started playing with emulators and front ends- I think hyperspin is the one I want. Here’s a little sample video on my MacBook Pro:

I will most probably repurpose my old Acer Revo R3610 now it has been succeeded by one of my raspberry pis.

One of the controllers arrived:

Rather grubby:

But that was soon taken care of:

Watch this space.

L

Multi-Tasking!

As usual- I have far too many projects on the go, but here’s a sneak peak of one that’s currently edged to the top of "the list":

My intention is to try and fit:

  • At least one with a raspberry pi and some for of MAME style emulator and 2 sets of joystick/arcade controllers
  • At least one with a touchscreen running some form of SWP / itbox style pub quiz machine software (monopoly, bullseye, spot the difference etc)
  • Possibly one with a console xbox/playstation as I seem to recall having a fairly successful emulator disc with a ton of games already working without any real work required

Firstly I will be ripping the CRT screen / monitor out of them all, and all/most of the wiring. I have ordered a few different 19" 4:3 flat panel LCD monitors to try fitting, a few different video adapters and a few "arcade style" controllers I hope to be able to re-use. I have only opened one up so far and was pleasantly surprised how accessible everything was:

Also there appears to be a relatively common looking motherboard/hard-drive combination with relatively standard VGA ports etc- so I may even try hooking it up and see if the old thing has any life in it? No idea what operating system/software might be on there (I picked them up as non-working for parts).

There’s a thread on the Raspberry Pi forum I’ve been following: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=35&t=6813 so hopefully it won’t be long before Raspbian has a nice compiled MAME binary and frontend. I have also been playing with some itbox style swp emulators and roms with quite a high level of success (unfortunately they appear to all be for winxp/7):

Who wants to be a millionaire. And:

Spot the difference :)

I eagerly await delivery of my various eBay purchases!

L

%d bloggers like this: