Thursday, January 28, 2010

Taking Back Control

With the purchase of my new router a week or so ago, I realized that now that I was able to actually forward my ports instead of just opening them, I could now run my site off of a home webserver thus giving me an infinite amount of control over the site, its server, and even access to the operating system itself. This was a tantalizing incentive, and more than enough motivation to devote the time and effort to get it working.

First off, the bandits over at Optimum Online block port 80, the default port for http traffic. In order to unlock it, you have to sign up for their upgrade package at an extra $10 a month. I realize this is a minuscule amount of money, but it's the principle of the matter. They are trying to extort money from their customers by purposely blocking ports that are used in conjunction with certain functionalities, a side effect of which is indirect control on the capabilities of a user's home set-up. I for one would like my overall functionality to be limited by the extent of my knowledge on computer technologies. I shouldn't start working with a new piece of software or a new protocol only to later discover it was fruitless as my ISP for some reason seems to disagree with the assumption that after already paying for an internet connection and all the hardware associated with it, I should have full and unmitigated access to the internet, over any and all of my ports as I see fit. You'd think that when a plumber connects a water line to your house, and you pay for the pipes and water, you'd be allowed to flow it out of whatever sink you wish... But I digress.

Bypassing Optimum's extortion scheme took a bit of resourceful thinking. I wound up daisy-chaining free domain names to manipulate a smooth redirection process. I had registered a second DNS name, and bound that to the webserver so that browsing to domain.com will redirect you to domain2.com:8080 which the server runs on.

While I was designing the site, I made the extra effort to make it conform to the XHTML 1.0 transitional web standards set out by the W3C (World Wide Web Consortium). However due to the rather unconventional redirection procedure, The W3C validation tool can not access my server, so I validated the site by copying and pasting the code into there validator's direct submission thing. I figure I'd let it be because the average visitor to the site won't care, and those who do could easily copy and paste the source code themselves, but rest assured it is web standard XHTML.

In other news, this web server is not currently hardwired into the router, it's wireless. For some reason my wireless PCI card is supported by Linux out of the box, while the integrated ethernet controller on the motherboard is not. Odd yes, but a cheap fix. Tomorrow I'll rummage through a garage full of old computers looking for a card, and if for some odd reason I don't find one, they run for around $10 at my local Microcenter. I figure the hard line has become a requirement at this point as there is so many things going on on this computer. It's a Bittorrent Dedi, a print-server, a web server, a samba server, and soon to be more. This is a lot of bandwidth to travel of a wireless G connection, so the card is imperative.

edit: W3C validation now fixed. The buttons successfully forward to page to the validation tool, which will tell you the code is web standard.

Thursday, January 21, 2010

New Router, New OS(s)

My Phenom II x4 (965 Black Edition=Unclocked Multiplier Goodness) has been giving me wireless problems since I built it. I tried a consortium of pci cards, and a menagerie of usb wireless devices but Windows 7 x64 couldn't do zip with them. All the devices worked fine under Linux, Windows must have been set to boot into useless-mode. There was something in my device list (in control panel) called "Teredo Tunnel Adapter Pseudo Interface" that was giving me a code 10 (device unable to start). After a quick bit of googling I learned that it had something to do with IPv6... undoubtedly Microsoft has found a way to screw that up too. I took it to the knowledge bar at my local Microcenter and after about an hour of troubleshooting we just did a clean install using a different OEM disk (theirs) than I had been using. Now it works just fine with my new D-Link DWA-552 PCI card.

So with a clean install of Win7 I went about configuring the system and downloading all the software I need. Firefox, Songbird, Pidgin, PuTTY, TightVNC, Zonealarm, AVG, about 25GB of games on Steam, et cetera. Having done all this fairly rapidly my NTFS partition was now fragmented pretty severely. After finally configuring all the programs, all my drivers, and everything else I set the machine up to defrag while I ate dinner. There's productivity for you.

So with the new computer fully functional, I set about throwing the obligatory Linux distro on it. I usually go with the latest version of Linux Mint, although I have been known to use Debian. This time I went with the newest incarnation of Backtrack and am liking it so far. It takes a bit of getting used to working in KDE as I've only used it briefly before but I do like the feel of it. After a rather lengthy installation (not ubiquity's fault, I botched up the math while partitioning) I booted into it from a rather flavorless grub compared to Mint's, but who cares? It's a bootloader.

While at Microcenter I also got a new router. My Trendnet router's been giving me nothing but problems ever since I bought it. It's a Netgear WNR3500 and I can conclusively say it's the best thing since sliced bread. Then again my opinion may be slightly biased on account of me being able to successfully forward ports seeming like a miracle. The Trendnet didn't forward ports, it just opened them. Ok for bittorrent, useless for ssh or VNC. So I set up the new router (breeze to configure), and promptly forwarded ports for VNC, SSH, and bittorrent to my torrent-slave/htpc/media-server after already assigning it a static IP address.

What wasn't so easy was installing the router. Previously my modem, router, and answering machine had been in the living room of my house. We have optimum online so the phone service comes out of the modem. The router and the phone were not playing nicely with each other and caused sever static on the cordless phones that made them unusable, and caused the router to randomly drop connections and have really poor signal strength, despite being wireless N. So the modem and router are now in my bedroom. I wanted to keep the answering machine in the living room so I had to run a 100ft phone cable up into my ceiling, through the attic, and into a newly drilled whole in the corner of the living room ceiling behind some furniture (so it's out of view. Kinda tacky to just have wires coming out of the ceiling in random spots).

Now everything is as it should be: Wireless networking on the computer on multiple OSes, New router up and running alongside the modem in the bedroom, and the phone in the living room. With any luck tomorrow I'll add "print-server" to the list of things my P4 box can do.

Tuesday, January 12, 2010

Fragmentation Hell

I've become so acclimated to the ext4 filesystem under Linux that I have all but forgotten disk fragmentation, a haunting memory of a more... unsophisticated past. So when I reinstalled Windows 7 on my desktop, I thought nothing of installing 20+ programs simultaneously, the thought just never crossed my mind. Congratulations Ballmer, you win again. Killing Floor, a game I play frequently was lagging and crashing uncontrollably and I couldn't figure out why. Later on when I went to reinstall Linux Mint 8 on the same disk, It wouldn't let me make any changes to the NTFS partition. After looking at the more detailed data, it was immediately apparent why. The NTFS file system on that partition was in a state of disarray of cosmic proportions. After finally convincing Windows that I do need to analyze that disk for fragmentation, It tells me that a whopping 17% of my data is afflicted. So I set chkdsk to run at Windows start-up, and I'm defragging the disk as I'm typing this. With any luck, I'll soon be able to install Mint and put this whole nightmare behind me.

In other news, my wireless card works beautifully under Linux, and acts like a recovering alcoholic who fell of the wagon under windows. It will not deal with any type of network protection (WPA2-TKIP, WPA2-AES, WPA-TKIP, all variations of WEP, et cetera). I'd never thought I'd see the day. My Linux-based operating system Mint is maintained by a handful of unpayed volunteer developers, and they managed to do what a multi-national billion dollar corporation could not. But then again this is not the first time. The only reason I continue to use Windows is for gaming, PC is still the best gaming platform out there. However multiplayer games begin to seem a little lackluster when you can't connect to the internet to play them. The second there's a viable Windows emulator for Linux, that is capable of allowing me to run steam and all of it's games I'm never going back. And no wine is not what I'm looking for. Spending 13 hours configuring all sorts of parameters so I can run an unplayably buggy Civilization 4 is not my idea of 'viable'.

I'm hoping that I will eventually be able to put the modem/router in my room so I can have direct access to it, thus cutting the number of network-related technical nightmares I face on a daily basis in half, If not more. I'd also then be able to distro-hop like a madman without having to spend hours finding the proper wireless drivers, though to be fair in light of this whole Winblows situation, the *nix Operating Systems are not a problem.

Disk Defrag is still taking place, I'll update when it's done.

Update: 1:30pm 1/13/2009

Defrag finished, performance is much much better. I was able to install Linux Mint 8 x64, however the wireless card is still all but useless under windows. I'm looking into getting the Xtreme N Desktop Adapter (DWA-552) as soon as I verify that it works out of the box on all of the distro's I use.

Sunday, January 10, 2010

A whole 'nother level of geekdom.

Two days ago, me and two friends spent about 8 hours in my 15 degree garage "linuxing". Box A was a server running the new dual core atom 330, and Box B was an old Pentium IV box. We'll start with Box A:

Debian 5 Lenny (i386) was actually a breeze to install, except when we went to install grub it defaulted to hd(0) which was a compact flash card on the motherboard, removed that, reinstalled (just goes quicker) and it was up and running. Since it had no wireless card, I had previously saved several debian packages to a flash drive for installation (such as openssh-server) and installed them after I spent an hour trying to figure out how to mount the drive. I feel a bit foolish actually, I tried pretty much every argument and every configuration of 'mount', but the reason it was not working was simply because I didn't specify a partition. I typed 'mount /dev/sdb /media/Lexar' when I should have typed '/dev/sdb1'. Got that mounted, installed the openssh-server and openssh-blacklist packages, and powered down the box. Then I took it upstairs and plugged it into the router, configured /etc/networking/interfaces to auto connect to an ethernet connection and removed all the peripherals leaving the server on.

We went back to the garage to work on Box B, which was to become a dedicated bittorrent box, and simultaneously worked on the Debian Box off of my laptop via ssh. The Debian box was to become a CSS (Counter Strike Source) server, so we configured that using the following sequence of commands (obtained from this guide:):

$ mkdir srcds
$ cd srcds
$ wget http://www.cstrike-planet.com/dls/hldsupdatetool.bin (usb)
$ chmod +x hldsupdatetool.bin
$ ./hldsupdatetool.bin
$ chmod +x steam
$ ./steam -command update -game "Counter-Strike Source" -dir .
$ ./srcds_run -game cstrike -autoupdate +maxplayers 20 +map de_aztec > srcds.log 2>&1 &

We then ran the server and checked the logs. Everything seemingly went fine except three textures were missing from the map. It was at this point we gave up for the night so I am unsure as to whether it was that particular map, or if there is a deeper problem at hand. We'll figure it out eventually.

While configuring the Debian CSS dedi over ssh, we also worked on the bittorrent box, which contains a rather ingenious little integration of mine that uses an aim client to add .torrents to Vuze's queue. We installed Mint 8 on the box which took about a year and a half running off the live CD, then installed the latest version of Vuze from their website (version in repos is really outdated. Using Pidgin's autoaccept plugin, we configured an aim account running on Pidgin that would autoaccept file transfers from my friend's screen name and save them in ~/Uploads. Firstly the plugin must be enabled, then on the buddy list you must right click the screename you want to authorize then go to autoaccept and always allow. Next, we configured Vuze to automatically scan that directory (~/Uploads) every 60 seconds for new .torrents, copy them to ~/Torrents, and add them to it's queue. Finally we set both Pidgin and Vuze to launch at login (During Mint 8 install we opted to not require login, ergo when the power button is pressed you are taken to the desktop, not the login window) and voila!

I eventually want to get vnc working on the bittorrent box, as well as actually play a game of CSS on the server but yesterday I was just too tired and wound up laying in bed all day watching a Law and Order: SVU marathon. I'll eventually write up a more complete (with pictures) guide on how to get the Pidgin/Vuze integration too.

Sunday, January 3, 2010

Adventures in Linux-land

I've really outdone myself this time. So many modifications have been made to my home's technological components in the past week I barely know where to begin, so bear with me if this post seems to be an incongruous wasteland of disorganized thought, I'll try to organize it the best I can.

First off, new computer:
AMD Phenom II x4 965 @ 3.4ghz
8GB (4 2GB modules) of OCZ DDR3 RAM 2 (1600)
Integrated Radeon HD 3300 Graphics (for now)
500 Watt PSU
Optical Drive/HDD/Card Reader/other unexciting peripherals

Now I also modified the computer I had prior to this one to be a home media server of sorts. Specs here:
Pentium IV @ 2.8ghz
2GB DDR2 RAM (800)
80GB IDE Drive (yeah I know, but it's only for the OS)
1.5TB Sata drive in a hot swap in one of the 5.25" bays.
256MB DDR2 8400 GS Nvidia GPU
other uninteresting peripherals.

The Phenom II box I built by hand with a few of my friends. I literally put my own blood and sweat into this machine (pin on the motherboard stabbed me under my thumbnail). After the build, it wouldn't POST. It didn't keep resetting either it just wouldn't post. It just stood there, powered on, mocking me. I tried swapping out the PCI-E graphics card and running it off of integrated, still wouldn't POST. Tried reducing RAM to one measly stick, still nothing. We took it apart and put it back together again with the same results. Then when I got home I completely disassembled it and put it back together again (in various configurations) TWICE, and still nothing. It sucked, $700 for parts on a machine that won't boot, yet has nothing apparently wrong with it.

Next day, I took it to Microcenter, where we basically tried the same thing. Of course now that I'm there it works. The knowledge bar attendant told me the PCI-E graphics card was shot, and managed to get into BIOS while using the integrated graphics. While in BIOS we noticed that my RAM was set to 1066, "Not on my watch" he said and promptly adjusted it to 1600. For some reason the board defaulted to that. I haven't had any problems with this machine since then but am still troubled by one thing: That graphics card works fine. I plugged it into the P4 box and it runs fine. I'm watching it work right now! At this point I'm hoping it was just a compatibility issue between the card and the new motherboard rather than the motherboard's PCI-E just being shot. We tried both sockets on the board too...

A brief segue: For a while, my router's been giving me issues on dual-boot machines. All the computers with only Linux on them ran fine, but my laptop which had Linux Mint 8 and Vista would act... for lack of a better term, 'iffy'. I would have to reset my router every time I booted into Windows because I would get a local only connection with a "limited connectivity" error. I thought the problem was limited to the laptop until I got the new computer (the Phenom II box) which exhibited the same problem. Long story short, after fighting with my router for the better part of an hour I got it to take to a firmware upgrade which rectified the problem, as well as added many new features. The router went from being a rather persistent pain in my ass to one of the most efficient and streamlined routing systems I've ever used. Good work Trendnet, I forgive you now.

Now here's what I did after the router's hiccup was cured: Installed Linux Mint 8 Helena on the P4 box, copying over my /home/steve/.azureus directory from a previous installation so I could keep my statistics/settings/et cetera. I then installed a new copy of Vuze from their website, as the version in synaptic's repositories is hopelessly outdated. I also got apache2 and php5 (from synaptic). Now... here's where things get fun. I set Apache's document root to be /media, several directories above my 1.5TB's mount point. In the /media directory there are several php scripts and an html form that will prompt a user for a username and password before forwarding you to the 1.5TB's directory. This was designed to keep out anyone who had already broke through my router's WPA2 level security.

Although this seems like a task much better left to MySQL, I'm way more familiar with php and was feeling adventurous. So now the P4 is serving everything on the 1.5 TB drive via httpd. This is fantastic for the computer illiterate. Mint 8 ships with Firefox configured with various media plugins, so by clicking a link to a media file, it will seamlessly start playing in the browser. Neat parlor trick for the grandparents, huh? Because quite frankly, my recounting of how I jerry-rigged a php script ignoring all conventions of proper syntax etiquette would be lost on them.

Now that the server is up and accessible, I need a way of remotely adding new content. My first thought is 'remote-desktop', but somehow that seemed a bit too bulky (in terms of bandwidth) for my needs. All I needed was to point Vuze to new content. So believe it or not, I wound up using pidgin, an open-source and cross-platform instant messenger client. Pidgin comes with a plugin to auto-accept transfers from pre-determined screennames, so I set it up to auto-accept transfers from mine and add the files to /home/mint/Uploads. I also set Vuze to auto add new content from that directory which it scans every 60 seconds. So Voila! By sending a .torrent via an instant message file transfer, I can remotely add content to Vuze's queue. And yes, I do have remote-desktop enabled as well in case I need to do anything more intensive from afar.

Now it doesn't end there. Suppose I want to watch the media on my 1.5TB on a television? I can do that too. The 8400 GS that is in the P4 media server has s-video out... Yeah, we don't have HD... Anyway, So I can use the TV as a monitor and watch movies that way. I also have a 3.5mm headphone jack (standard audio out on a computer) to RCA audio converter (the red and white plugs for sound on older televisions), so sound is a go as well.

I'm working with VLC as the player at the moment though I would prefer Boxee. VLC is by no means a shoddy player. In fact it's fantastic, just not ideal for a home media box outputting video to CRT television. Boxee's UI is fantastic for this purpose, but sadly they have not released the beta yet, and the alpha relies on packages in Jaunty's repositories which are outdated/incompatible with Mint 8 which is based of of Karmic. Boxee paired with an ATI Remote Wonder provides a UI simple enough even the biggest tech-tards can navigate their way through it. Once Boxee's beta is released, I'm going to start building boxes that will run it on start up and browse to the 1.5TB, and connect them to every television in the house.

I've also stumbled upon a nifty little media player called Songbird. I'm quite impressed. It can play the .mp3's on my server as if they were a playlist. For example, If I point it to "domain.com/songs/artist/album/" it will play everything in that directory as if it were local content. It's also open-source and cross-platform which is always a plus in my book (as per my love affair with Azureus, Pidgin, Firefox, et cetera).

I think that about sums up the past week. Again, sorry for the mess.