by Steven
Sunday, February 13, 2011 @ 4:38:00 PM
I recently wanted to create a home theatre system for my girlfriend Jasmine, because she loves movies a lot. I wanted something that would be easy to use and impressive interface to make the process of browsing for movies enjoyable. I looked at several options for this, but I decided to go with XBMC for numerous reasons. It was free (always a good thing), it can run on Linux/Windows/Mac computers, it was lightweight, and with a dedicated development community, it had tons of additional features that could be added to it.
I purchased a Zotac N330 box that came without any OS which was on sale for less than $200. It is a tiny box, but it seemed to suit my needs perfectly (2 GB of RAM, wireless card, small form factor, 160 GB internal drive). Installing XBMC Live on it (with Ubuntu 10.04 as the underlying OS) went pretty smoothly for the most part (a small hiccup with getting it to install via a thumbdrive). However once I got everything up and running, I ran into one huge problem: internet connection wasn't working.
Trying to search for XBMC solutions didn't help much as it is based on the underlying OS. So I had to spend hours searching forums and finding solutions that worked for others but didn't help me at all. Even if it seemed like the exact same problem as I had. I wanted to keep my network as secure as possible, but it seemed quite difficult to set up WPA2 access via the command line. I called my friend Louis who is a Linux guru, and he mentioned a lot of issues he had with it as well. He pointed me in the right direction of using wpa_supplicant, which luckily was already a part of the Live distro I was using.
Hopefully these steps may help someone else having a similar Wifi connection issues with XBMC.
Open the interfaces file, which for me was located in /etc/network/interfaces:
sudo nano /etc/network/interfaces
And then add the following configuration options to the file:
# The loop back interface, leave this alone
auto lo
iface lo inet loopback
# The wireless interface, yours might be named differently than wlan0
auto wlan0
iface wlan0 inet dhcp
wireless-essid your_ssid
pre-up wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
pre-down killall -q wpa_supplicant
DHCP will give your box a dynamic IP address from the router. You can also use a static IP if you prefer. Replace "your_ssid" with the name of your wireless network that you want to connect to. "wext" is the wireless driver to use, it is generic but should work for most cases. The config file we will create shortly. If you don't know the name of your wireless card, you can run:
iwlist scan
This will show all the network devices, but most likely yours is called wlan0 as well.
Before we can create the config file, we need to convert the wireless network password from ASCII to the format that wpa_supplicant expects. There is a usefull utility for this:
wpa_passphrase your_ssid your_ascii_password
# To make the next step easier, you might as well pipe the output to the conf file:
sudo wpa_passphrase your_ssid your_ascii_password > /etc/wpa_supplicant.conf
Now to create the config file that will store our network settings:
sudo nano /etc/wpa_supplicant.conf
And copy this code into it:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="your_ssid"
scan_ssid=1
proto=WPA RSN
pairwise=CCMP TKIP
group=CCMP TKIP
psk=your_generated_password
}
scan_ssid = 1 to broadcast the ssid, 2 to stay silent
proto = The protocols used, WPA = WPA1, RSN = WPA2
pairwise = The encryption protocols used, CCMP = AES, TKIP = TKIP
group = Same as above
psk = The password generated from wpa_passphrase utility (this is important, ASCII password will not be recognized)
With all that set, we should be able to restart the networking service:
sudo /etc/init.d/networking restart
I hope that helps someone out there as I spent a couple days trying many solutions that didn't work for me.