Browsed by
Category: Uncategorized

Used LB4M – Finding the Management Interface

Used LB4M – Finding the Management Interface

I bought an LB4M on ebay. I did not have a USB to RJ45 console cable.

Power port – Green
Status port – Orange

I read online that by default the management port pulls an IP via DHCP but that wasn’t working. I cycled through several ports on the device connecting them to my network and actually missed that one port pulled an IP address.

I then connected my laptop to the management port and watched traffic with Wireshark. The LB4M was sending data using the CDP protocol (new to me).

So the firmware is 1.1.0.8. Understanding the span of features vs stability for LB4M firmware versions seems to be a minefield.

The packet data indicated that it had picked up (or statically held) an IP on some interface. As I plugged in ports I ran:

$sudo nmap -F 192.168.1.215
Nmap scan report for 192.168.1.215
Host is up (0.010s latency).
Not shown: 99 closed ports
PORT   STATE SERVICE
23/tcp open  telnet

I was in.
Username: admin
Password:

My first experience with this CLI, so lets poke around.
(type show ? for options)

(Switching) >show network

Interface Status............................... Up
IP Address..................................... 192.168.1.215
Subnet Mask.................................... 255.255.255.0
Default Gateway................................ 192.168.1.1
Burned In MAC Address.......................... XX:XX:XX:XX:XX:XX
Locally Administered MAC address............... 00:00:00:00:00:00
MAC Address Type............................... Burned In
Configured IPv4 Protocol....................... DHCP
Management VLAN ID............................. 1
(Switching) >show serviceport

Interface Status............................... Up
IP Address..................................... 0.0.0.0
Subnet Mask.................................... 0.0.0.0
Default Gateway................................ 0.0.0.0
Configured IPv4 Protocol....................... None
Burned In MAC Address.......................... XX:XX:XX:XX:XX:XX
libvirt – adding storage pools manually

libvirt – adding storage pools manually

I use direct disk pass-through for several of my KVM guests. I usually use Virt-Manager to set these up, but a bug in the latest version (1.2.1) made that impossible.

Fortunately it’s pretty easy to add drives using virsh. First check the existing storage pools:

$ virsh pool-list --all
Name State Autostart
-------------------------------------------
Backup active yes
BigParity inactive yes
default active yes
Parity active yes

Create a storage pool xml file. Look at the existing pools in  /etc/libvirt/storage/ for reference. Create the file locally:

$ cat Parity5TB.xml
<pool type='disk'>
<name>Parity5TB</name>
<uuid>8a4550e0-3bcf-4351-ad36-496b51737c</uuid>
<capacity unit='bytes'>0</capacity>
<allocation unit='bytes'>0</allocation>
<available unit='bytes'>0</available>
<source>
<device path='/dev/disk/by-id/ata-TOSHIBA_MD04ACA500_55F'/>
<format type='unknown'/>
</source>
<target>
<path>/dev/disk/by-id</path>
<permissions>
<mode>0711</mode>
<owner>-1</owner>
<group>-1</group>
</permissions>
</target>
</pool>

 

Note that I use /dev/disk/by-id. You can use any /dev/disk/by-* reference, but NEVER use /dev/sd* (you’ll undestand why after the first time you add or remove a drive).

Assuming it’s already formatted (I find it easiest to format on the host with gparted and pass through the pre-formatted disk) you can quickly get the uuid with blkid. Then either use /dev/disk/by-uuid, or lookup the symbolic links in the /dev/disk/by-X directory.

Add the pool to your definitions:

$ virsh pool-define Parity5TB.xml
$ virsh pool-list --all
Name State Autostart
-------------------------------------------
Backup active yes
BigParity inactive yes
default active yes
Parity active yes
Parity5TB active no

That’s it. This does not autostart the drive, or attach it to any guests, but you can still do this through virt-manager.

iperf for testing HDMI balun runs

iperf for testing HDMI balun runs

It seems reasonable that jitter will be a big factor in the performance of CAT5e/6 runs used for HDMI baluns. I ran two high quality unshielded CAT5e cables and two high quality shielded (but ungrounded by me) CAT6 cables.

They cross over multiple power lines and unfortunately run parallel to power lines for about 11 foot of the ~ 30 foot run.

Testing Jitter:

On the server:

<pre>iperf -s -w 128k -u</pre>

This means start iperf server with a 128KB buffer in UDP mode. UDP best reflects the nature of traffic of HDMI over ethernet.

On the client:

<pre>iperf -c serverip -u -b 1000m -w 128k -t 120</pre>

This means start the client and connect to serverip, use UDP and send traffic at gigabit speeds for 120 seconds. I needed to run the test for at least 120 seconds to get consistent jitter results.

First I tested with a 3 foot CAT5e cable connected directly to the switch, this represents ‘ideal’ performance. The same short cable was connected to the ends of the long CAT5e and CAT6 runs.

[table]
[ ID], Interval, Transfer, Bandwidth, Jitter, Lost/Total Datagrams
IDEAL, 0.0-120.0 sec, 9.65 GBytes, 691 Mbits/sec, 0.013 ms, 47713/7095556 (0.67%)
STP-CAT6, 0.0-120.0 sec, 9.62 GBytes, 689 Mbits/sec, 0.015 ms, 26399/7052134 (0.37%)
CAT5e, 0.0-120.0 sec, 9.57 GBytes, 685 Mbits/sec, 0.180 ms, 108956/7100704 (1.5%)
[/table]

So there we have it. From a simple bandwidth perspective the long CAT5e run offers basically the same performance as the STP-CAT6 run, however when it comes to jitter, the CAT6 cable is marginally worse than the ideal case, while the CAT5e run is an order of magnitude worse.

Very interesting! In the end I’m sure it’s the shielding rather than the CAT6 rating that makes the STP-CAT6 superior.

Enable Built-in Wifi on Pogoplug v3/Oxnas Running Debian Squeeze

Enable Built-in Wifi on Pogoplug v3/Oxnas Running Debian Squeeze

I’ve not had much luck with the Pogoplug lottery. With archlinux EOL on the oxnas Pogoplugs, I’ve been Debian Squeeze with the latest archlinuxarm kernel: 2.6.31.6_SMP_820

Turns out my Pogoplug Biz had a built in wifi, but getting it to work wasn’t straightforward.

These are the steps I remember off the top of my head.

It’s worth installing:

[email protected]:$ sudo apt-get install pciutils iw wireless-tools

Make sure you do indeed have a PCIe wireless card:

[email protected]:$ lspci
00:00.0 Network controller: RaLink RT3090 Wireless 802.11n 1T/1R PCIe

In my case the card wasn’t loaded correctly (it didn’t show in the output of ifconfig).

Although the device didn’t show in ifconfig, it did show in iwconfig as ra1.

ifconfig ra1 up gave me a controls permission error.

I followed these instructions:

mount -t ubifs -o ro ubi0:rootfs /tmp/ce
sudo mount -t ubifs -o ro ubi0:rootfs /tmp/ce
sudo mkdir /etc/Wireless
/bin/cp -rfv /tmp/ce/etc/Wireless/RT2860STA /etc/Wireless
sudo /bin/cp -rfv /tmp/ce/etc/Wireless/RT2860STA /etc/Wireless
sudo nano /etc/udev/rules.d/70-persistent-net.rules

Nothing was working so I restarted out of frustration.

[email protected]:$ lsmod
cfg80211 85932 1 rt3390sta

Looks good. Issued:
modprobe cfg80211

Now for the first time I think I could bring the interface up without errors:
sudo ifconfig ra1 up

And I could scan for networks:

iwlist ra1 scanning

Now the most painful part, actually getting it to connect to your wireless network!

ifconfig ra1 up
sleep 3
iwpriv ra1 set WpaSupport=0
iwpriv ra1 set WirelessMode=Managed
iwpriv ra1 set WirelessMode=7
iwpriv ra1 set AuthMode=WPA2PSK
iwpriv ra1 set EncrypType=AES
iwpriv ra1 set SSID="MySSID"
iwpriv ra1 set WPAPSK="MyPassword"

sleep 1
dhcpcd ra1

Here the most important line was the WpaSupport=0. Before that the interface would come up but not connect to the access point. Note, the SSID and Password are in quotes – I saw many places saying they should be unquoted but this worked for me.

Finally, the WirelessMode=7 refers to a mixed n/g network. I’m not sure this line is even needed.

Drive Performance Under KVM Using Virtio

Drive Performance Under KVM Using Virtio

Using KVM I was experiencing erratic performance from disk I/O on my OpenMediaVault guest. Aside from the OS volume (8GB on a Vertex Plus SSD) I had 4*3TB drives:

4 * Seagate ST3000DM001
2 * Toshiba DT01ACA300

I added all disks using virt-manager:

Add Storage-Pool->disk: Physical Disk Device->Source Path:/dev/disk/by-id/[DISK_ID]

The only subtle variation in adding the drives was that the 2 * Toshibas were blank, added with Format = auto and Build Pool: Unchecked.

The Seagates had existing, but unwanted partitions. An apparent bug in virt-manager meant I could not delete the pre-existing partitions so I had to add them with Format = gpt and Build Pool: Checked.

I was under the impression that in both cases the raw drive would be presented to the guest…. so let’s take a look at the resulting performance.

Read benchmark:
hdparm -t --direct
Write Benchmark:
dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync

On Host
[table]
Model, OCZ Vertex Plus[/dev/sda], TOSHIBA DT01ACA300[/dev/sdc], Seagate ST3000DM001[/dev/sde]
Read, 221.93MB/s, 186.89MB/s, 169.22MB/s, 179.48MB/s
Write, 158.67MB/s, N/A, N/A
[/table]

On Guest
[table]
Model, OCZ Vertex Plus[/dev/vda], TOSHIBA DT01ACA300[/dev/sdc], Seagate ST3000DM001[/dev/sde]
Read, 126.23MB/s, 185.86MB/s, 98.87MB/s
Write, 122MB/s, 117.67MB/s, 88.83MB/s
[/table]

That’s a huge difference in performance between the Toshiba and the Seagate. Not only that, but the read/write performance on the Seagates was extremely unstable.

Let’s take a look at the Storage Volume configurations for these drives.

Slow Drive

<pool type='disk'>
  <name>Media1</name>
  <uuid>2c5a4e7b-6d61-9644-4162-c97cf11185e4</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <device path='/dev/disk/by-id/ata-ST3000DM001-9YN166_S1F0T0Q6'/>
    <format type='gpt'/>
  </source>
  <target>
    <path>/dev/disk/by-id</path>
    <permissions>
      <mode>0711</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

Fast Drive

<pool type='disk'>
  <name>Backup</name>
  <uuid>b445343e-39e7-ff85-2c31-ba331ae10311</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <device path='/dev/disk/by-id/ata-TOSHIBA_DT01ACA300_Y3DBDBMGS'/>
    <format type='unknown'/>
  </source>
  <target>
    <path>/dev/disk/by-id</path>
    <permissions>
      <mode>0711</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

Due to the quirky behaviour of virt-manager, It had seemingly recreated a nested GPT volume inside my pre-existing partition, and this abstraction was causing the performance issues.

Poor CIFS/SMB performance on KVM Guest

Poor CIFS/SMB performance on KVM Guest

This is kind of stating the obvious. Running OpenMediaVault 0.5.48 as a KVM guest.

CIFS transfers from Windows 8.1 to OMV over gigabit ethernet maxed out at ~30MB/s.

Despite selecting Generic Kernel > 2.6 from within Virt-Manager, KVM defaulted to the virtual Realtek 8139 NIC.

Switching to the virtio driver mostly resolved the performance issues with CIFS transfers fluctuating from 60MB/s to 110MB/s.

Not sure what the source of the throughput fluctuation is, as it will be stable at 110MB/s for 10 minutes and suddenly drop.

I recommend using iftop on the KVM host to measure performance.

Your First Chome Extension

Your First Chome Extension

I made my first browser extension recently. Turns out that it is refreshingly easy.

I use Google Chrome. One of my favorite websites is SlickDeals.net, which I must admit to occasionally browsing at work. The problem is that SlickDeals makes its money via referrals. i.e. if I post a link to newegg.com, SlickDeals parses the URL and generates a redirect via a referral URL.

So:

http://www.newegg.com/Product/Product.aspx?Item=N82E16889005129

becomes:

http://slickdeals.net/?sdtid=2702819&sdfpid=47595&sdop=1&sdfid=9&u2=http://www.newegg.com/Product/....

This would be fine, however my work blocks all the intermediate sites the modified link redirects via, so it is necessary to copy the http://www.newegg.com/…. URL, which fortunately is in plaintext, from the modified URL and paste it into a new window.

After doing this 100 times or so I was pretty fed up so I wrote an extension to parse the modified URLs and return them to their original form.

Creating a Chrome extension to parse and modify page content

Android & SQLite – 1MB limit, IOException and general woes.

Android & SQLite – 1MB limit, IOException and general woes.

This long weekend I worked on an app: Scrabble For Anagrams. The UI took about 8 hours. The engine to generate and perform rapid lookups of character permutations took about 8 hours. After 2 days of hard work I believed the app was working great and was nearly ready to go on the market. The dictionary was converted into a SQLite DB outside of the android application and was included as an asset.

However, my original dictionary (found online) contained only 10K words and I pretty rapidly found some word combinations that were valid but weren’t in the dictionary – clearly unacceptable. No problem! I found a freely available 400K word dictionary, generated the new DB and placed it in the asset folder. Build, run and bam! IOException.

Dump, Split and Rebuild the DB

CamDDR

CamDDR

8 years ago a buddy introduced me to DDR. I went from ashamed, to bemused to loving it within about a year and I got pretty good. I full-combod Era at expert a couple of time.

With all the Kinect hype, I’ve been thinking it would be an excellent device for a virtual DDR pad. Unfortunately I don’t have a Kinect – but I do have a crappy cheap webcam and so CamDDR was born.

You can find instructions and download the beta here: CamDDR

I’m not out of ideas yet and I think I know how to make version 0.3 deal with back steps a whole lot better, so it will be interesting to see where this goes. If I can pass Era on the second level of difficulty I’ll be happy.