Sunday, July 27, 2014

Hacking the Pogoplug v4 (Series 4 and Mobile) with Linux (Debian or Arch)

This is a quick publish tutorial on hacking the Pogoplug V4 - Series 4 or Mobile - with Deban or Arch Linux ARM.

Major credit to @bodhi on the Jeff Doozan Forum for the uBoot, Debian rootfs, instructions and support. Note that I re-hosted some of @bodhi's files for a easier install.

This tutorial assumes you're starting with a brand new, never modified Pogoplug Mobile/Series4. At the end of this tutorial your Pogoplug will be booting Debian (or ALARM) from either a USB flash drive or SD Card. Note that a USB flash drive is required temporarily to setup SD Card booting.

WARNING: You can potentially brick your Pogoplug following this tutorial. Proceed at your own risk.


Requirement:
Outline of Steps:
  1. Enable SSH access to Pogoplug
  2. SSH/Putty into Pogoplug V4 and Perform Installation
    • Flash uBoot and Setup Default uBoot Env Settings
    • Setup Netconsole (optional but highly recommended)
  3. Setup USB Flash Drive with Debian rootfs
  4. Setup CD Card with Debian rootfs

Enable SSH access to Pogoplug

Power on the Pogoplug and connect it to you network. Do not attach the USB flash drive yet.
Log into http://my.pogoplug.com and activate your Pogoplug and then enable SSH access. - http://support.pogoplug.com/hc/en-us/articles/202307860-How-do-I-enable-SSH-

Note that if you don't see the "Enabler SSH Access" option, try power cycling the Pogoplug.

SSH/Putty into Pogoplug V4 and Perform Installation

Check your router for the IP Address assigned to your Pogoplug and SSH into it using root and the password setup in the previous step. The rest of the tutorial will be done via SSH console.

#stop my.pogoplug.com service
killall hbwd

#download utilities

cd /tmp
wget http://download.doozan.com/uboot/nanddump
wget http://download.doozan.com/uboot/nandwrite
wget http://download.doozan.com/uboot/flash_erase
wget http://download.doozan.com/uboot/fw_printenv

#make execuable
chmod +x flash_erase fw_printenv nanddump nandwrite

#printenv and setenv are normally symbolic links
cp fw_printenv fw_setenv

#remount '/' as read/write
mount -o remount,rw /

#setup fw_env.config
echo "/dev/mtd0 0xc0000 0x20000 0x20000">/etc/fw_env.config

#remount '/' as read only
mount -o remount,ro /


Flash uBoot and Setup Default uBoot Env Settings


#download uboot and md5
wget http://download.qnology.com/pogoplug/v4/uboot.2014.07-tld-1.pogo_v4.bodhi.tar
wget http://download.qnology.com/pogoplug/v4/uboot.2014.07-tld-1.pogo_v4.bodhi.md5

#check md5 sum
md5sum uboot.2014.07-tld-1.pogo_v4.bodhi.tar
cat uboot.2014.07-tld-1.pogo_v4.bodhi.md5

#extract uboot
tar -xf uboot.2014.07-tld-1.pogo_v4.bodhi.tar

#BE EXTRA CAREFUL WITH THE NEXT TWO COMMANDS. NO TYPOS! 


#flash uboot
/tmp/flash_erase /dev/mtd0 0 4
/tmp/nandwrite /dev/mtd0 /tmp/uboot.2014.07-tld-1.pogo_v4.mtd0.kwb


#download default uboot env settings and md5
wget http://download.qnology.com/pogoplug/v4/uboot.2014.07-tld-1.environment.img.bodhi.tar
wget http://download.qnology.com/pogoplug/v4/uboot.2014.07-tld-1.environment.img.bodhi.md5

#check md5 sum
md5sum uboot.2014.07-tld-1.environment.img.bodhi.tar
cat uboot.2014.07-tld-1.environment.img.bodhi.md5

#extract uboot env settings
tar -xf uboot.2014.07-tld-1.environment.img.bodhi.tar

#BE EXTRA CAREFUL WITH THE NEXT TWO COMMANDS. NO TYPOS!

#flash default uboot env setting
/tmp/flash_erase /dev/mtd0 0xc0000 1
/tmp/nandwrite -s 786432 /dev/mtd0 uboot.2014.07-tld-1.environment.img

#Update uboot env setting

#SET MACADDRESS
/tmp/fw_setenv ethaddr "$(cat /sys/class/net/eth0/address)"

#SET archNumber and machid (for LED)
/tmp/fw_setenv arcNumber 3960
/tmp/fw_setenv machid F78

#SET rootfs file system type
/tmp/fw_setenv usb_rootfstype ext3

#set to original mtd partition
/tmp/fw_setenv mtdparts 'mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)'
/tmp/fw_printenv mtdparts


Setup Netconsole (Optional but highly recommended)
More info here - http://forum.doozan.com/read.php?3,14,14

#Update IP Addresses as needed
/tmp/fw_setenv serverip 192.168.1.100

/tmp/fw_setenv ipaddr 192.168.1.10
/tmp/fw_setenv if_netconsole 'ping $serverip'
/tmp/fw_setenv start_netconsole 'setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;'
/tmp/fw_setenv preboot 'run if_netconsole start_netconsole'


Setup USB flash drive with Debian rootfs

For Arch Linux ARM, download and extract the ALARM rootfs instead.

#Plug in USB Flash Drive and setup Debian rootfs

#partition USB flash drive
/sbin/fdisk /dev/sda

#format USB flash drive

cd /tmp
wget http://archlinuxarm.org/os/pogoplug/mke2fs
chmod +x mke2fs

#format USB flash with label of rootfs
/tmp/mke2fs -L rootfs -j /dev/sda1

#mount USB drive
mkdir /tmp/usb
mount /dev/sda1 /tmp/usb

#download Debian rootfs and md5
cd /tmp/usb
wget http://download.qnology.com/pogoplug/v4/Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2
wget http://download.qnology.com/pogoplug/v4/Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.md5

#check md5
md5sum Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2
cat Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.md5

#extract rootfs

tar -xjf Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2

rm Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2
sync
cd ..
umount /tmp/usb
busybox reboot


At this point, your Pogoplug should boot back up into Debian. Login with username of root and password of root.

Setup SD Card with Debian rootfs
I wasn't able to figure out how to partition and mount the SD Card from the Pogoplug OS, so this section assumes you've successfully booted Debian (or ALARM) from a USB Drive. 

#partition sd card
fdisk /dev/mmcblk0

#format sd card with label of rootfs
mke2fs -L rootfs -j /dev/mmcblk0p1

#mount sd card
mkdir /tmp/mmc
mount /dev/mmcblk0p1 /tmp/mmc

#download and extract Debian rootfs
cd /tmp/mmc
wget http://download.qnology.com/pogoplug/v4/Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2
wget http://download.qnology.com/pogoplug/v4/Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.md5

#check md5
md5sum Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2
cat Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.md5

#extract rootfs

tar -xjf Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2
rm Debian-3.14.0-kirkwood-tld-1-rootfs-bodhi.tar.*
sync
cd ..
umount /tmp/mmc
poweroff

#Disconnect USB drive. Your Pogoplug should boot up from SD Card now. Boot order is USB, SDCARD then SATA (Series 4)


Initial Debian Setup

#Initial update
apt-get update
apt-get upgrade

#SAMBA3

Plug in your USB Hard Drive and partition and format the drive as ext3. Mount the USB Drive to /media/usb/share:

mkdir -p /media/usb/share
mount /dev/sda1 /media/usb/share


apt-get install samba
cd /etc/samba
mv smb.conf smb.conf.bak

#download example smb.conf for public share
#no authentication require, everyone has
#read/write access to / (root$) and usb (/media/usb/share)
wget --no-check-certificate https://dl.dropboxusercontent.com/u/42238/pogoplug/debian/smb.conf
/etc/init.d/samba restart


More details to come, such as - AirPlay, AirPrint, Logitech Media Server, Squeezelite, WebCam via mjpg_streamer.

Monday, March 31, 2014

DIY Portable AirPlay Speaker System

DIY Portable AirPlay Speaker System:



This is something I've been working off/on for over a year now. Originally inspired by the Boominator. However, I lack the carpentry skills and tools, so I decided to build this instead. I believe it's fairly unique in that it's totally portable (battery operated) and supports AirPlay.

Another photo of the back with captions on Amazon

YouTube Video:
Features:


  • AirPlay support provided by AirEnabler - broadcast it's own Wi-Fi network and allows iOS device to automatically maintain 3G/LTE connection for internet radio streaming from Pandora or iTunes Radio.
  • Battery operated; 6-8 hours on low-medium volume.
  • Runs off battery or AC wall charger and support charging while playing
  • Expandable to stereo (add 2nd speaker)
  • Switch out li-ion battery for 12v motorcycle battery for extended play (camping).








Friday, December 27, 2013

iPhone/Android VPN to PPTP VPN Server on TomatoUSB Router

iPhone/Android Phone Home - PPTP VPN Server for iPhone or Android on TomatoUSB Router

This is a quick tutorial on how to setup a PPTP VPN Server on your TomatoUSB Router. A PPTP VPN is ideal because it's fairly secure, simple to setup and both Android and iOS has built in PPTP VPN Clients which makes it convenient.

A VPN is a secure way for an iPhone or Android device to access local network resources such as internal web sites (SSL not required for secure access), samba shares, and SqueezeBox Server without the need to open up additional network ports on the router.

If you're looking for a router for this project, check out my [Tutorial] Apple AirPlay on TomatoUSB Router.

Assumptions:

1) You're running Shibby's BIG-VPN build of TomatoUSB
2) Dynamic DNS is setup (Required for Client Setup). See my
[Tutorial - 30 Minutes or Less] Site to Site VPN with TomatoUSB and OpenVPN post for instructions on setting up Dynamic DNS Address.

Steps:

1) Configure PPTP Server
2) Configure iPhone (iOS 7) VPN Client and Connect
3) Configure Android VPN Client and Connect - In Progress

Configure PPTP Server

Log into your TomatoUSB Router and go to VPN Tunneling->PPTP Server.

On the PPTP Server Configuration Page:

- Check Enable
- For Remote IP Address Range, pick a small IP Address range that is outside the scope of your DHCP Server but on the same network segment. For instance, I'm using 192.168.200.X as my network segment. My DHCP Server IP Adddress Range is 192.168.200.101-151. So I used 192.168.200.10-11 (outside the DHCP Range), giving me two IP Addresses (for two incoming iPhone).
- Set Broadcast Relay Mode to Both
- Set Encryption to MPPE-128
- Leave DNS Servers, WINS Servers, MTU and MRU at the default values.
- Under PPTP User List, add a user and set a password. You will need this info during the next step, Configure iPhone VPN Client.
- Save


Configure iPhone VPN Client and Connect

On your iPhone, go to Settings->General->VPN->Add VPN Configuration.
Select PPTP
Fill in the Description
For Server use your Dynamic DNS Address
Account name ("pptpuser" in this tutorial) and password.
Leave everything else as default.
Save.


Settings->General->VPN->Add VPN Configuration

Turn on VPN by going to Settings and sliding on "VPN". Note the "VPN" icon next to the clock when connected to VPN.

Turn iPhone VPN on by going to Settings and sliding on VPN

Configure Android VPN Client and Connect

Go to "Wireless and network" settings -> VPN settings.
Select "Add PPTP VPN"
Set VPN server name
Enable Encryption


Wednesday, November 6, 2013

How to Install Optware and SAMBA on the Pogoplug

In this tutorial, I'm going to show you how to install optware and samba on your Pogoplug to create a cheap and simple NAS.

What is optware? Optware is a package manager that allows you to install additional software on your embedded linux device such as the Pogoplug (think of it as a free little "App Store"), while maintaining the stock my.pogoplug.com functionality.

Requirements:

1) Pogoplug - V2 such as the E02, V3 (oxnas) such as the Pogoplug P21/P22/Pro or the V4, also known as the Series 4 and Mobile. Pretty much any existing Pogoplug model is supported.
2) USB Hard Drive - 2TB or less recommended.

Outline of Steps:

1) SSH into Pogoplug
2) Partition and Format USB Hard Drive
3) Install Optware
4) Install SAMBA
5) Make sure everything works after a reboot

SSH into Pogoplug

If you haven't activated your Pogoplug (new out of the box), you should be able to SSH into it using root/ceadmin as the username/password. If you have activated it, you'll need to enable SSH via my.pogoplug.com.

SSH into Pogoplug using Putty or similar app

Partition and Format USB Hard Drive

Plug in your USB Hard Drive to your Pogoplug.

#stop my.pogoplug.com service
killall hbwd

#partition drive
#create two partitions, a small 4GB partition
#for optware and the rest for your data
busybox fdisk /dev/sda

# Type in the following commands to erase
# and re-partition the USB Hard Drive 
#(WARNING - USB HARD DRIVE WILL BE COMPLETELY WIPED)

# p # list current partitions
# o # to delete all partitions
#
# Create 1st Partition for Optware
#
# n # new partition
# p # primary partition
# 1 (one) # first partition
# <enter> # default start block
# +4G # to create a 4GB partition

# Create 2nd Partition for Data
#
# n       # new partition
# p       # primary partition
# <enter> # default to second partition
# <enter> # default start block
# <enter> # default end block #use the whole flash drive
# w       # write new partition to disk

#download mke2fs to format partition
cd /tmp
chmod +x mke2fs

#format and label partition
./mke2fs -L optware -j /dev/sda1
./mke2fs -L data -j /dev/sda2

#remount root to be writable
mount -o remount,rw /

#create /opt folder
mkdir /opt

#mount usb drive as /opt
mount /dev/sda1 /opt


Install Optware

###########################################
# Install optware ipkg (package manager)
# Assumes /opt is mounted at this point
###########################################

#download ipkg
cd /opt
tar -xzvf plug.tar.gz
rm plug.tar.gz

#Pogoplug Pro requires an updated wget
#Not needed for other models
#skip this section if not using Pro
cd /usr/bin 
mv wget wget.old
ln -s /opt/bin/wget /usr/bin/wget

# Setup profile
cd /etc
chmod 755 profile
source /etc/profile

#update available packages
ipkg update


Install Samba

ipkg install samba36 libnsl nano

#download example smb.conf
cd /opt/etc/samba

#Edit smb.conf (optional)
#to add additional samba shares
#nano /opt/etc/samba/smb.conf

#Start SAMBA
/opt/etc/init.d/S08samba start

You should now be able to access your Pogoplug's USB Hard Drive by \\pogoplug\usb


Make sure everything works after a reboot

#backup original rcS startup file
#restore the rcS.original file to revert
cp /etc/init.d/rcS /etc/init.d/rcS.original

#download mount script and make it executable
cd /etc/init.d
chmod +x mount_optext3

#add mount script to rcS file so it 
#runs automatically after a reboot
#this script will mount /opt
#the data partition is automatically mounted by the pogoplug software
echo "/etc/init.d/mount_optext3" >> /etc/init.d/rcS

#start samba on reboot
echo "/opt/etc/init.d/S08samba start" >>  /etc/init.d/rcS

reboot

Adding an Additional/Second USB Hard Drive

1) Attach additional USB Drive to Pogoplug.

2) Partition additional USB Drive. See "Partition and Format USB Hard Drive" section, but just create one partition.

  busybox fdisk /dev/sdb

3) Format and Label additional USB Drive

    ./mke2fs -L data2 -j /dev/sdb1

4) Remount root to be writable

   mount -o remount,rw /

4) Edit the smb.conf file and add an additional section that is similar to the "[usb]" section.

   nano /opt/etc/samba/smb.conf

[usb2]
  path = /tmp/.cemnt/mnt_sdb1/
  read only = no
  public = yes
  writable = yes
  guest ok = yes

5) Reboot. You should now be able to access the additional drive as \\pogoplug\usb2


Miscellaneous Notes

On the Pogoplug V2 (E02) and V4, you can actually use one of the internal flash partition for /opt. This is a fairly small partition (<75MB), but will be enough if only plan to run a simple NAS using SAMBA.

Using the internal flash partition is also a great way to avoid issues with using multiple USB hard drives.

Only recommended for more advanced users (don't email me for support unless you plan to send me a bitcoin/litecoin!).


####################################
# Pogoplug V2/V4 - Use internal flash partition for /opt
####################################
#remount root to be writable
mount -o remount,rw /

#create /opt folder
mkdir /opt

#erase mtdblock3
flash_eraseall /dev/mtd3

#mount internal flash partition as /opt
mount /dev/mtdblock3 /opt



Changes to above instructions if using internal flash for /opt
- only one partition needed on your USB hard drive
- "Install Optware" and "Install Samba" instructions unchanged
- modify the smb.conf file for correct partition
     path = /tmp/.cemnt/mnt_sda1/
- In the "Make sure everything works after a reboot" section, you don't need the mount_optext3 script
- Add the "mount /dev/mtdblock3 /opt" command before the "/opt/etc/init.d/S08samba start" command in the /etc/init.d/rcS file.

Troubleshooting

/opt not mounting - check the content of the /etc/init.d/rcS file and make sure /etc/init.d/mount_optext3 is called. Also double check that the /etc/init.d/mount_optext3 file exist and is executable. Minimize the number of attached USB drives

samba not working (\\pogoplug\usb not accessible) - double check that /opt is mounted correctly. Make sure that "/opt/etc/init.d/S08samba start" is the last line in the /etc/init.d/rcS file. Verify that the /opt/etc/samba/smb.conf exist.

data partition not mounted - the data partition is automatically mounted by the pogoplug software to something like /tmp/.cemnt/mnt_sda2. Run the "df -h" command to see what's mounted. Check the /etc/init.d/rcS file to make sure the pogoplug software start command ("/etc/init.d/hbmgr.sh start") isn't commented out (begins with #).


Future Updates

I'll be flushing this tutorial with additional howtos in the near future. Please leave a comment and what you would like to see added.


Tuesday, October 8, 2013

Pogoplug V2 and V3 Serial Connection - E02, P21/P22, Pro

This is a quick how to tutorial on setting up a serial console connection to the Pogoplug E02 (V2) or P21/P22 (V3 oxnas).

Instructions for the Pogoplug V4 here.

A serial console connection is useful for recovering from a corrupt uboot environment or for troubleshooting general boot up issues.

You should be able to add a serial connection to your Pogoplug for less than $10 and in under 30 minutes.

Requirements:

1) USB to TTL Converter - I have a couple cheap USB to TTL converters based on the PL-2303HX chipset. Note that this chipset is not supported under Windows 8 and most PL-2303HX being sold on Amazon and Ebay are using fake chips which are not supported by the official drivers on Prolific's website. I'm using the drivers found here.

Ebay is another good source the the USB to TTL Converter.

Prolific PL-2303HX USB to TTL Converter

2) CD-ROM Audio Cable (Sound Blaster/MPC-2) - you need the one with a white connector (Sound Blaster plug) at one end and a black connector (MPC-2) at the other end. I got mine from a old computer. You can pick one up on Amazon for less than $5 otherwise Ebay is another good source.



3) Safety pin - used to modify the CD-ROM Audio Cable.


4) Small flat head screwdriver (optional)

Outline of Steps:

1) Opening up the Pogoplug
2) Modify CD-ROM Audio Cable
3) Connect the USB to TTL Converter to the Pogoplug
3) Install Drivers and Connect via Putty

Lets get started.

Opening up the Pogoplug

This part is pretty easy. You actually don't even need any tools, just a little force. 

Pull off the black feet, starting from the bottom. Clear plastic slides back.
The shell is held together by small plastic clips. This is where a small flat head screwdriver may be helpful. 

Modify CD-ROM Audio Cable

On the end with the black connector, use the safety pin to push out the the wires as shown below.
  


If you want a permanent serial connection, at this point (before reinserting the wires) you can drill a small hole on the back of your Pogoplug for the CD-ROM audio cable.

Now, reinsert the wires with the white wire on the edge, red in the middle and then yellow as shown below. Use electrical tape to tape up the black wire (not used). In the picture below, white will be GND.



Connect the USB to TTL Converter to Pogoplug

The CD-ROM Audio Cable that we modified will work for both Pogoplug V2 and Pogoplug V3.

Here is how everything should connect up. The white end of the CD-ROM audio cable can be plugged directly into the serial port of the Pogoplug. The black end of the CD-ROM audio cable can be plugged directly into the USB to TTL converter.

Pogoplug V2 (E02) Serial Console Connection

Pogoplug V3 Serial Console Connection
Make sure GND on the Pogoplug is connected to GND on the USB to TTL converter.
TXD on the Pogoplug should connect to RXD on the USB to TTL converter.
RXD on the Pogoplug should connect to TXD on the USB to TTL converter.
VCC and the 3.3v is not needed and should not be connected.


Install Drivers and Connect via Putty

Download drivers and install it. I'm using the drivers found here.

Plug in the USB to TTL converter and open up Device Manager and verify that Windows detected the USB to TTL converter correctly. Note the COM port number (COM4 in the example below).



Download putty from here and start it up.

Change the Connection type to Serial.



Under Category, click on Serial and change the serial line configuration settings to the following:

Speed: 115200
Data bits: 8
Stop bits: 1
Parity: None
Flow control: None

Change the COM port to the correct one found in Device Manager. Click Open.



Now power up your Pogoplug. You should see something like the following in your Putty Serial Console.


That's it.

Addendum (7/1/2014)

For some reason one of my Pogoplugs had a corrupted (or incorrect) uboot environment variable setting so I had a use a serial connection to recover it. The issue was, all my computers at home are now running Windows 8 and as mentioned above, the PL-2303HX USB TTL converter isn't compatible with Windows 8. What I ended up doing was using another Pogoplug which was already running Arch Linux ARM to connect to the problematic Pogoplug. These instructions will also work for other Linux systems.

On the working Pogoplug running ALARM:

1) Plug in USB to TTL adapter.
2) Install Screen

pacman -Sy screen

3) Start screen serial console session. The follow command will start the screen serial console with the appropriate settings for the Pogoplug (baud 115200, Data bits: 8, Stop bits: 1,Parity: None, Flow control: None).

screen /dev/ttyUSB0 115200 cs8 -cstopb -parenb

4) Some quick Screen commands:

Control + a and then ":quit" to exit
Control + a and then 'd' to detach

A couple of good post on resetting the uboot env on your Pogoplug:

Help, Pogogplug E02 , No LED,serial cable connected ,what next?

 

Sunday, July 14, 2013

DIY AirPlay Speaker System using a Asus WL-520gu Router



In this tutorial, I'm going to show you how to re-purpose a Asus WL-520gu router into an Apple AirPlay Speaker System. I have a custom built OpenWRT image already fully configured with AirPlay so all you have to do is flash and go.

Major kudos to the Wifi Radio project on MightyOhm.com which introduced me to OpenWRT and a major inspiration for this project.

Requirements

- Asus WL-520gu Router (Stock Firmware, Tomato, DD-WRT or OpenWRT)
- Compatible USB Sound Card (USD DAC - Digital Audio Converter). See below.
- Speakers/Stereo System (or Headphones).

Flashing the OpenWRT AirPlay Firmware

Download my OpenWRT image pre-configured with AirPlay (aka ShairPort). Note that this firmware is specifically designed for the Asus WL-520gu router. If you use this firmware on any other router, you will brick it.

If you are already running Tomato, DD-WRT or OpenWRT (with Luci) on your router, you can flash directly from the web interface.

If you are running OpenWRT without a web interface, here are the commands to flash via command line:

cd tmp
wget http://goo.gl/MNkAm
mv MNkAm openwrt-brcm47xx-squashfs.trx
mtd -r write openwrt-brcm47xx-squashfs.trx linux

Otherwise if you are running the Asus stock firmware or need to recover from a bad flash, follow these instructions - Asus WL-520UG: Loving Tomato Firmware. Obviously, flash with the OpenWRT AirPlay image above.

Enjoy some Music

Plug in your USB Sound Card to the router and connect it to your speakers. Then power cycle the router.

On your iOS device, connect to the open/unencrypted 'AirPlay520gu' wireless network.

Important Note: Wireless is enabled by default within the image. However, the router requires one extra reboot after being flashed before wireless will start properly (Don't ask me why, I don't know). So basically, if you don't see the 'AirPlay520gu' wireless network, give the router a reboot/power cycle.

You should now be able to AirPlay music from your iOS device to the 'AirPlay520gu' AirPlay Speakers.

iOS 7 Beta - AirPlay to WL-520gu router from iTunes Radio


Different Modes and Use Cases

Standalone Mode (Default, no configuration needed) - Broadcast unencrypted/open SSID of "AirPlay520gu". DHCP Server enabled with no default route or DNS server to allow iPhone to maintain connection to LTE/4G network for internet radio streaming.

Wireless Client Mode - Connects to existing wireless network similar to how your iphone/ipad connects to your network. This is how most commercial AirPlay Speaker System work. HowTo: Switch to 'STA' mode

AP (Access Point) Mode - Connects to existing network via a wired Ethernet cable (or Ethernet over Powerline). Broadcast additional SSID to extend your wireless network coverage - add AirPlay and get better wireless coverage too! HowTo: Disable DHCP, change IP Address, Set SSID/Encryption type

Check the OpenWRT forums or Wiki for help on re-configuring your new AirPlay router!

Compatible/Recommended USB Sound Cards (Plug and Play)
Some additional USB DACs that I haven't tested personally, but should also work:
Note: The cheap "3D Sound" USB audio adapter may work, but there is at least two versions - one that works (C-Media chipset) and one that doesn't (6911 Chipset, JMTek, LLC 48Khz Only). My recommendation is to avoid them unless you're 100% positive you'll get the one with the C-Media chipset or to keep things simple, pick up the Syba SD-CM-UAUD USB Stereo Audio Adapter if you're on a tight budget or prefer the form factor.

DIY AirPlay Sound System for under $100

A great sounding AirPlay speaker system can easily be put together on a very limited budget and blow away anything sold at the Apple Store costing twice or three times as much. As an example, a LP-2020A+ Lepai Tripath Amplifier paired with the Dayton Audio B652 bookshelf speakers will give you awesome sound on a tight budget.

Syba USB Audio Adapter - $7
Lepai 2020A+ Amp - $23
Dayton Audio B652 Bookshelf Speakers - $52

Total cost $82 + router

What if I don't have a Asus WL-520GU Router?

Definitely do not buy one (unless you can get it super cheap, ~$10). This router has really dated hardware and is no longer manufactured.

Instead consider picking up a TomatoUSB compatible router or Pogoplug and following my other DIY AirPlay tutorials:
[Tutorial] - Pogoplug E02/V4 with Arch Linux ARM

Another option would be my Apple AirPlay AirEnabler Adapter Kit, which is a totally plug and play solution that allows you to add Apple AirPlay to any existing home stereo, car stereo, pc speaker system, ammo box portable speaker systemstereo cooler or my favorite the Boominator, "the ultimate party machine".

Friday, March 29, 2013

[Tutorial] CentOS 6 OpenVPN Client - Connecting to Existing Site to Site VPN (TomatoUSB)

In this tutorial, I'm going to show you how to add a CentOS 6 server as a OpenVPN client to your existing Site to Site VPN.

This is an extension of my [Tutorial - 30 Minutes or Less] Site to Site VPN with TomatoUSB and OpenVPN and assumes you already have your Site to Site VPN operational. However, you should be able to follow this tutorial and connect to any existing OpenVPN Server.

At the end of this tutorial, your CentOS server will be able to securely access your LAN resources (i.e, computers, printers) on both sites and vice versa (you will also be able to seamlessly access your CentOS server).

Overview of the Steps:

1) Generate Certs and Keys
2) Copy/Transfer over Certs and Keys to Client VPS
3) Install OpenVPN (client)
4) Configure OpenVPN Client
5) Connect


Generate cert/keys for VPS (CentOS 6 32-bit OpenVPN Client)

SSH into your TomatoUSB OpenVPN Server.

#Setup and initialize environment
cd /opt/openvpn-easy-rsa
source ./vars


#myvps_client is the Common Name
./build-key myvps_client


Copy/Transfer over Certs and Keys to Client VPS

Since my CentOS server is running SSH, I'm going to use SSH and SCP (secure copy) to transfer over the certificates and key. You can also transfer over the keys via SFTP or a USB drive.


#create the /etc/openvpn/keys folder on my centos server
ssh root@myvps.qnology.com mkdir -p /etc/openvpn/keys 

#copy over the certificates and keys
#all one line
cd /opt/openvpn-easy-rsa
scp keys/ca.crt keys/myvps_client.crt keys/myvps_client.key root@myvps.qnology.com:/etc/openvpn/keys

Install OpenVPN on CentOS 6

#Bring everything up to date
yum -y update

#Add EPEL (Extra Packages for Enterprise Linux) Repo
# RHEL/CentOS 6 32-Bit ##
cd /tmp 


wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm

yum --enablerepo=epel install openvpn.i686

Configure OpenVPN Client

#copy sample client.conf to /etc/openvpn
cp /usr/share/doc/openvpn-2.2.2/sample-config-files/client.conf /etc/openvpn


#edit openvpn client.conf
nano /etc/openvpn/client.conf

Update the following lines
#remote OpenVPNServer.ADynamicDNSAddress.com 1194
#ca /etc/openvpn/keys/ca.crt
#cert /etc/openvpn/keys/myvps_client.crt
#key /etc/openvpn/keys/myvps_client.key

#start VPN manually to test
openvpn --config /etc/openvpn/client.conf


#test starting VPN as a service
service openvpn start

#autostart at OpenvPN client on reboot
chkconfig openvpn on