Make a printer wireless using a router with USB running OpenWRT

Many recent printers have wifi capability built in for wireless printing. Older printers or even some recent printers do not have this feature, but one could purchase a wireless adapter to turn the printer wireless. The adapters aren’t cheap, and a search for a cheap adapter led me to configuring the TP-Link WR-703N with OpenWRT as an affordable alternative (plug printer into router with a usb cable and print to router via a usb print server).

First, flash the router to OpenWRT by logging into the router at tplinklogin.net using the username/password admin/admin; follow this guide for pictures in navigating the default Chinese interface. Once flashed, the router will have wifi disabled and the ethernet port could be used to log onto the LAN network. Log into the router using a web browser at the destination 192.168.1.1. Set up wifi and turn the ethernet port to WAN by following these instructions; I changed my default router IP address to 192.168.94.1 to avoid clashing with my default “home” network when I plug it into my home network for internet access. Plug the current router into another router with internet access via ethernet. Then ssh into the TP-Link router on its network: root@192.168.94.1. Install the usb printer:

opkg update
opkg install p910nd kmod-usb-printer

Start the print server:

/etc/init.d/p910nd start
/etc/init.d/p910nd enable

Now, on a laptop or computer, connect to the same wifi network as this mini router and add a printer at the router’s ip with port 9100 after plugging a printer into the usb port. Install the necessary printer driver on the laptop or computer.

This setup creates a separate network for usb wireless printing. If we want to have the printer join an existing wifi network, then just set up the router as the first post I referenced.

Parental control on home network

I recently looked into ways to block content on the home network. To protect the entire network, it seems like the filter should be placed on the router. This article on Lifehacker lists a few popular methods. I think using OpenDNS to filter is easy enough to get started. However, it’s quite easy to configure your connected computer to use a different DNS provider. However, one could set a static DNS on their tomato router.

Remotely access files on your home Windows computer

Most of my home computers/servers run Linux, so accessing them remotely is quite easy via the ssh protocol. Even the Windows machines I own have an ssh server installed via Cygwin.

Now, for those not familiar with Linux, one could

  • Install freeSSHd and set up an ssh server on Windows.
  • Configure an account and have freeSSHd initiate at startup.
  • Forward port 22 on the home router to port 22 on the machine with freeSSHd (assign it a static ip from the router); or, use a different external port for safety reasons (eg, 1022 -> 22).
  • Use the portable executable of WinSCP to access your files on any other Windows computer with internet access.

MKV on PS3 using Showtime

I’ve described how one could play MKV files on the PS3 before. Another method is to play them using Showtime, a media player that can be installed on a jailbroken PS3; it supports MKV natively. This method is better than my previous solution because on-the-fly transcoding is not necessary and hence, the fast forward and rewind capabilities of the video are not lost.

To convert my previous solution to this method, I had to install Showtime on the ps3 of course and edit my /etc/mediatomb/config.xml file (change the transcode line for mkv files back to x-matroska). In addition, I did a forced rescan of my files (removed directory and re-added it to database using the web interface) so that the new rules can be applied.

Strong (long) passwords

REMINDER: PASSHPHRASE SHOULD BE 24+ (42+) CHARACTERS LONG TO BE EQUIVALENT TO A 128 (256) BIT KEY.

This xkcd comic brought forth a lot of discussion on the internet regarding how to choose your password. What I took away from it: it’s better to have really long passwords than to have short, complicated passwords. This post describes a reasonable system on how to set up your passwords. Basically, group your services into tiers that require different levels of security. Then set up long passwords that you can remember. Thanks to the comic and the aforementioined, I’ve come up with my own system of secure passwords. I won’t describe it due to security reasons =].

VPN service for an anonymous or untraceable internet presence

I recently considered the use a paid VPN service to connect myself to the internet. Why? The internet is a whole other world out there, and you just don’t know how much privacy you lose with all the connections you make on your computer. I see myself and the average user at a disadvantage when it comes to privacy because we aren’t savvy enough to know the underlying workings of the internet. The transmission of data packets from one device to another gives rise to the opportunity for a knowledgeable person (not me, of course ;) to decipher private information in that transmission. I’m not even referring to people stealing my password. It’s just scary to know people can find out what sites you’ve visited, what services you use, etc. Your privacy can be compromised without you even knowing it. People can figure out your daily habits and make judgment on the kind of person you are. This is quite scary. For example, your internet service provider (ISP) knows exactly what files (unencrypted) you are transporting on the internet: the source, the destination, the timing, duration, frequency, etc. However, if your connection between two devices are encrypted, for example, using SSL, then all the ISP (and other snoopers) see is a stream of data that have no idea what it is without the proper key.

When connected to a VPN, all the connections made between you and the internet is channeled through the VPN server. Thus, your footprint on the internet is that VPN server. What your ISP would see is a bunch of encrypted data that is passed from the VPN server and to your computer. I feel my personal freedom (privacy) is more guarded using such a service.

This site offers some reviews for the major services available. I ultimately tried HideMyAss due to their pricing (their yearly price ends up being like $6.55/month), the number of servers and ip addresses available, the location of these servers (30+ countries), the use of OpenVPN, their non-censoriship of connections (e.g., torrent), and the data they collect (the time you log on and the time you log off).

My original plan was to set the certificates and credentials working with an OpenVPN client on my Asus RT-N16 router running Tomato firmware. However, before getting there, I tried the service on my Ubuntu laptop using the OpenVPN and the provided scripts. I have to say, I was disappointed in the difference in speed. Without the VPN service, I download at 2+ Mbps. With it, I was downloading at 1.3 Mbps. I understand that speed loss is inevitable due to the encryption and data outing through one more server before it reaches my computer, but I was expecting 1.9 Mbps. I tried a few other servers but the speed didn’t improve. As a statistician, I should try it many, many more times. However, I didn’t have the time for it, and besides, I will only commit to the service if I get consistent speed that’s near my official bandwidth, and this obviously wasn’t the case. HideMyAss’s customer service suggested I use their “Speed Guide” functionality in their software to select the fastest server for me, but it wasn’t available for Linux. Moreover, if I were to want use the VPN service on my router, I would want to stick with a single server and forget about it, not “shop” around for the right server each time it got slow to get the best speed. Now if somehow the server selection was automatic or that they limit only a certain number of users per server to give the best speed to the users, then I think I would like the service more.

Not only did I want consistent speed, I also wanted no abrupt in service since I would run it on my router where all my internet-enabled devices depend on for the internet. I use VoIP for phone service, and I do not want to have an abrupt phone service due to the VPN service having issues. HideMyAss claims to have a 99.8% uptime rate. I assume this is really good because Google claims to have a 99.9% uptime rate.

I ultimately cancelled HideMyAss and got a refund. However, I’m still on the lookout for THE vpn service that has all the features of HideMyAss, but with negligible difference in speed. I’m sure as time goes by internet speed will only get faster, and maybe by then I wouldn’t mind not downloading at 3 Mbps if I can download at 2.5 Mbps and retain privacy.

If you have any suggestions for me, do let me know!

For now, I just have to stick with SSL-enabled sites for the exchange of private information (email, newsgroup, etc.). For the exchange of important data, I always use ssh anyways.

UPDATE: wanted to share this recent article on Lifehacker, and this useful comparison of vpn speed test that’s done periodically. I guess HideMyAss is the fastest out there, and what the speed I was observing is typical of the encryption overhead.

UPDATE – Using my Playstation 3 (PS3) as a media player (play mkv files and more)

I’ve been using mediatomb as a media server for UPnP devices such as the PS3. I definitely prefer XBMC to be on any device I use as a media player since I can play practically ANY media format (if the hardware can handle them, e.g., xbox can’t handle HD content) and I can stream from local computers via a Samba mount. However, it is not currently available on the PS3 and it might NEVER be available; see this post. With recent advances in the PS3 Hacking scene, I’m sure the Linux OS can be installed on my PS3, and some advance media player will come into fruition (XBMC? GeeXbox?). In the mean time, I’m stuck with Sony’s media player capabilities.

The Mediatomb + UPnP route for the PS3 is fine except for two major pitfalls:

  1. MKV files are not supported on the PS3, and
  2. New files in my “watched” folder might not immediately available since metadata are stored in a database.

Playing MKV files

Let’s attack the first issue first. After some searches and playing around, I found this post that outlines how one can remux MKV files into m2ts or mp4 files that can be played on the PS3. NOTE: On my Ubuntu 10.04 NAS, only the MP4 method worked for me (I don’t like this method though since AC3 to AAC conversion takes a few minutes; I also ran into a libfaac issue, and installing the extra libraries fixed it per this post). However, after updating FFMPEG following these instructions, the remuxed m2ts files can be played on the PS3. The m2kv2m2ts script makes this process as easy as mkv2m2ts video.mkv.

Before I figured out the previous method (fixed by using the latest version of FFMPEG), I hopped over to #mediatomb on the freenode to get help. “Alver” pointed me to this post, which is an update of this post. Basically, Alver wrote a script to transcode any media file on the fly so that they can be playable on the PS3. The drawback is that the video just plays (no fast forward, scene select, etc.) and that it can be CPU-intensive. Luckily, for MKV files, there is no real transcoding (only remuxing). The streaming of MKV files wasn’t an issue even on my 1.6G atom-based NAS. This will be my current method of streaming MKV files on the PS3 for now.

Setup:

  1. Make sure the latest FFMPEG is installed per these instructions.
  2. Copy the script from this page into /usr/local/bin/mediatomb-multifunctional.sh and make it executable.
  3. Clear out the entire database using the configuration website http://mediatomb:49152/ (replace mediatomb with the hostname or ip address).
  4. Backup /etc/mediatomb/config.xml (I use the daemon) and update it per this page. My config.xml is modified from this since Mediatomb 0.12.0 does not support version 2 of the config and I only want transcoding done on MKV files (my NAS is weak so I don’t want it to transcode everything, especially AVI files).
  5. Restart mediatomb (sudo /etc/init.d/mediatomb restart) and my directory to the database on http://mediatomb:49152/.

Here is my config.xml file:









MediaTomb
uuid:e099cf89-ce17-4558-8847-fea3393cf517
/var/lib/mediatomb
/usr/share/mediatomb/web


mediatomb.db


localhost
mediatomb
mediatomb





128
5
yes
no


*




UTF-8
ISO-8859-15

/usr/share/mediatomb/js/common.js
/usr/share/mediatomb/js/playlists.js

/usr/share/mediatomb/js/import.js
/usr/share/mediatomb/js/import-dvd.js



























































video/mpeg
yes






Add new files to database automatically

When adding a folder to be “watched” in mediatomb, use the “inotify” so that new files get added automatically. The files need to be world readable. I wrote a short script (MakeWorldReadable.sh) to do so:

#! /bin/bash

## Usage: MakeWorldReadable.sh /path/to/directory
for directory in "$@"
do
find "$directory" -type d -exec chmod 755 {} ;
find "$directory" -type f -exec chmod 644 {} ;
done

Added the following entry to crontab to have it updated every 30 minutes (20 and 50 minutes after the hour):

20,50 * * * * find /path/to/folder -type d -exec chmod 755 {} ;
21,51 * * * * find /path/to/folder -type f -exec chmod 644 {} ;

PS3 Media Server

I have not mentioned ps3mediaserver. It’s probably the most popular media server application to stream to the PS3 (or maybe even all UPnP devices). It’s based upon mencoder and FFMPEG (good), but written using JAVA to be cross-platform. It supposedly can stream and transcode any kind of media files. I don’t think it’s too appropriate since my NAS is atom-based; may be good for a more powerful server. I ran into issues trying to install it; didn’t give it more than 20 minutes though. I might try it some day.

UPDATE 12/31/2010

Just installed ps3mediaserver based on this and this. Assuming I pulled the latest sources from here and is in the the ps3mediaserver directory, I did:

sudo apt-get install mencoder ffmpeg mplayer vlc sun-java6-jre
JAVA_HOME=/usr/lib/jvm/java-6-sun ant
bash ./PMS.sh

The crappy thing about ps3mediaserver (to me) is that it is GUI-based. For server applications, I prefer daemons. See this post for how to make it a daemon.