Month: May 2013

Command Line Networking Tools

I’ve been using a pair of Raspberry Pi credit card sized computers to set up a basic Network Attached Storage device (NAS) and an XBMC media centre. I bought my Pi’s and cases from ModMyPi.

One Pi is running the standard Raspbian Wheezy Debian image with a large externally powered USB drive connected to it. This forms the NAS storage device. It has some Samba SMB shares set up on it. This means the shares are acessible from other computers on the same network. I can therefore back up to the USB drive on the NAS Pi and transfer media files to it.

The other Pi, the XBMC Pi, which is running Xbian, can access the Samba shares as media sources. Xbian is a stripped-down distro that boots straight to XBMC.

There are any number of tutorials on the web on how to do all of this, so I’m not going to rehash what has already been done elsewhere. But, because the XBMC Pi is connected to a wireless dongle (both systems are running headless, and I ssh onto them) I had to track down a few CLI networking commands to help me sort all of this out. I had a feeling that they might prove useful to others.

Of course, everyone knows about ifconfig. This enumerates the network interfaces and prints out a set of useful information about each one.

ifconfig

ifconfig

Another similar command is iwconfig. This concentrates on the wireless network interfaces and provides a different set of information.

iwconfig

iwconfig

To find your IP address quickly use ip addr.

ip addr

ip_addr

Another useful command to have up your sleeve is findsmb. This enumerates Samba shares on your network. The screenshot below was taken from my laptop in a public library, so there is not much information displayed in it. More details of this command can be found at the Samba.org website. It also shows example output.

findsmb

findsmb

Tags : , ,

Skype and a cheap Tesco Webcam

My niece is going to be working over seas for a while. I was asked to set up Skype on her Mum’s Kindle HD, and I put it on my wife’s and my own Android handsets. Being in the mood for global coverage, I also installed and configured it on my wife’s Nexus 7 tablet and her Windows 7 PC.

I then turned to my Ubuntu box (and put the bad thoughts of installing anything to do with Microsoft on my Linux box out of my head). Not having any real need for a webcam apart from this purpose, and a low-specced device being sufficient for my purposes, I bought a Tesco own-brand model. The store was handy and it was cheap. At £7.00 you can’t expect the Earth, and I didn’t hope for any more than a functional, cheap and cheerful camera. Which is lucky, because that’s exactly what it was. We’re talking no frills whatsoever.

To install Skype you must add the following repository, and then install Skype. In a terminal window, do the following:

sudo add-apt-repository “deb http://archive.canonical.com/ $(lsb_release -sc) partner”
sudo apt-get update && sudo apt-get install skype

With Skype installed I was able to enter my credentials and get on-line, but the webcam wasn’t being recognised. I Googled a bit and found some advice on the subject. Again at the command line, I had to perform the following steps to make sure I had the correct Video4Linux drivers installed:

sudo apt-get install libv4l-0

Once the drivers were installed, I installed a little application called Cheese, as a test. Skype doesn’t need Cheese, but I thought if I could get the camera working in another application it would let me know if the issue was related to the webcam or to the settings in Skype. I did this to install Cheese:

sudo apt-get install cheese

Cheese worked with the webcam without issue, so it was something to do with Skype. More Googling turned up more help. There are drivers that need to be pre-loaded before Skype is fired up. Specifically, these Video4Linux drivers need to be loaded: v4l1compat.so.

At the command line I did the following to see where the drivers were located on my hard disk:

locate v4l1compat.so

I made a note of the path that was returned, which in my case was: /usr/lib/i386-linux-gnu/libv4l/v4l1compat.so.

I needed to make a script to load these libraries, and then to load Skype. Back at the command line, I did the following:

sudo gedit /usr/local/bin/skype

and then entered the following two lines into the file:

#!/bin/bash
LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so /usr/bin/skype

Once that was saved I added the following line to my .bash_aliases file (which is where I keep all my aliases; you could add it to your .bashrc file if you hold your aliases in there):

alias sk=’/usr/local/bin/skype &’

Now I can type sk and hit enter and Skype loads and runs and the camera works just fine.

Tags : , ,