Linux Benchmark, IO statistics and system statistics with dstat

September 27th, 2008

There are a number of common command line tools that we can use to monitor system resources. We have df for disk space, free for RAM usage, top for processes, bmon for network usage, etc. Quite often though, I find it useful to monitor them all simultaneously, and constantly switching commands or using ‘watch’ with free/df is annoying.

I came across dstat recently that gives a nice colorful overview of a choice of statistics. Here are some useful command line options from the man page:

-c [Show CPU stats]
-d [Show disk stats]
-l [Show load stats]
-m [Show memory stats]
-n [Show network stats]
-s [Show swap stats]
-t [Show time stats]
-y [Show system stats]
-a [All stats (-cdngy1)
-C[0,1,2,3,4,5,6,7,total] [Show individual CPU usage]

You can also output to CSV with –csv and disable color with –nocolor.
Read the rest of this entry »

Wireless Hacking, Problems with WEP, Wireless Security and WPA

September 22nd, 2008

Unfortunately today there are still a huge range of wireless OEM equipment being shipped with WEP as standard. WEP has been known as vulnerable for a long time. This HOWTO assumes Linux familiarity, compatible hardware, the ability to read and troubleshoot, and a brain.

Hacking your wireless network is not difficult, and here’s a procedure you can use to test:

You’ll need:
1. A PC and wireless network.
2. A linux PC/laptop with a wireless networking device

1. Boot your (debian) pc
2. wget
3. tar -xzf aircrack-ng-1.0-rc1.tar.gz
4. cd aircrack-ng-1.0-rc1
5. ./configure
6. make
7. make install

Read the rest of this entry »

95th percentile billing explaination

September 17th, 2008

95th percentile billing commonly misspelled as “percential” is a method used by some NOCs to change for bandwidth.

The system is simple and essentially discards the top 5% of your traffic peaks, and then uses the next value down as your bandwidth rate. 5% of a month is 36 hours. This might sound like a bit of a scam, because you’re being billed for bandwidth consumption that you may not have used, but it’s not difficult to get it to work for you.

If you’re hosting a site where a lot of content is downloaded, it may be better to go for bandwidth billing. A client’s content server uses about 8,000GB transfer per month and shows a 95th percentile of 34mbit/sec. It’s certainly cheaper to pay for 8,000GB transfer over 30+mbit/sec dedicated.
Read the rest of this entry »

Adam’s Custom Kernel

September 16th, 2008

I haven’t been doing much custom kernel building lately. I find that the only kernels I change are those on my VM host machines, and/or using apt-get for a general upgrade.

Nevertheless, here’s how I go about building my custom kernels for VM host machines running debian etch, using 2.6.18 of course:

apt-get install linux-source-2.6.18

Read the rest of this entry »

Going Green, PC Hibernation, Saving Money & Common Sense

September 16th, 2008

After receiving a rather large quarterly power bill for my flat about 4 months ago, I decided that it was time to look in to my careless power consumption.

I purchased a good power usage meter: as I wanted to find out exactly what was consuming what.

– TV’s and other standby-capable devices do use a large amount of power when in standby, almost close to what they use when fully active.
– Lights on dimmer switches usually use full power regardless of how bright they are set, when they’re dimmed, the remaining power is often just sunk into a large resistance coil.
– PC’s also use a ton of power on standby.
– AC to DC adapters found everywhere in the modern home, wireless access points, speakers, game consoles, phones, chargers, cameras, routers, switches, PC peripherals, laptops, the list goes on.. These all combined will consume a lot of power, just from being left on.

My solution:
Read the rest of this entry »

NetCat tutorial for Linux & Windows, HOWTO, nc

September 16th, 2008

I wrote this article some time ago, but thought I’d publish it here for reference.

This text is dual licenced under the GFDL and GPL

There are two known versions of netcat. The version of netcat used here is the original Avian Research version. Not the newer GNU release


– Netcat Basics – 1

– What is Netcat? – 1

– Netcat Syntax – 2

– Netcat Installation – 3

– What are the most basic uses? – 4

– Simple File Transfer – 4

– Tar – 5

– UDP – 6

Read the rest of this entry »

Using picolcd on linux, lcdproc, routerboard, liblcdusb

September 15th, 2008

I’ve posted previously about my embedded device and picolcd. I wanted to put some thoughts down about using picolcd.

The easiest way to drive your picolcd is with lcdproc I’ve found. The device doesn’t require any special drivers which is great, as long as you have USB support working you’re fine. Make sure uhci-hcd and usbcore are loaded, you should be able to use ehci-hcd as well as it supports USB 1.1 and 2.0 but I haven’t tested that.

Use lsusb to make sure that the device is shown and recognised. If you see:

    Bus 002 Device 003: ID 04d8:0002 Microchip Technology, Inc.

then great. Your device is connected, working and your machine supports USB.
Read the rest of this entry »

Quick Linux and Windows OpenVPN HOWTO and tutorial, including VPN routing

September 15th, 2008

OpenVPN is a popular Windows/Linux VPN Server/Client pair. I think there’s a separate GUI available for it if you’re so minded. This howto will cover command line usage only.

I’ll provide example configuration based on a Linux server and a Windows client, however the same applies pretty easily if you wanted to mix and match.

On Debian, apt-get install openvpn. On any other linux distro, use your own package manager or alternatively download from source and compile.
Read the rest of this entry »

Linux virtualization, vmware, xen, hosting, and squeezing the most out of your resources

September 14th, 2008

I’d guess that 90% of hosting providers ‘oversell’. This essentially means that should they have 1,000GB allocated, they might offer 15 packages of 100Gb to 15 of their customers, banking on the fact that no one will fully use their 100GB allocation – Selling 5 Virtual Machines with 256MB RAM on a 1GB host, assuming that no one will use their full RAM allocation. This is bad, because you’ll generally be able to confirm that you’ve been allocated the resources, but nonetheless benchmark tests will show that you’re just not getting them, and your environment will be sluggish and unresponsive. This is the same as airlines selling 110 seats on a 100 seat plane. When that 101st paying customer does show up to claim his seat, he’s stuck without a flight.

The general consensus is that a VPS is a cheaper and lower-grade option than a dedicated service, however VPSs have a number of indisputable advantages over dedicated servers and I’m going to discuss why almost all the dedicated machines I manage are hosts for a range of VPSs.
Read the rest of this entry »

Extending tc and iproute2. Linux routing split access multiple uplinks multiple isps iptables masquerading

September 14th, 2008

It’s been a while since the last post, so I thought I’d post a followup article to which focused on bandwidth limiting in a datacenter environment using tc and iproute2.

I’ve taken the same script but tweaked IPs and bandwith values into my office. Previously I was on a 24mbit down 2.5mbit up DSL connection courtesy of The office is only about 800m from the closest exchange which is quite nice – I generally find I get 18+mbit down and 1.5+mbit up. Not only great bandwidth, but latency is also very small and responsiveness is great, especially as a regular [constant] SSH use. Recently, despite having no business justification whatsoever, I ordered the same again for the same office. This one clocks in at about 19mbit up and 1.7mbit down – even better! Some ISPs support line bonding – I dont believe that many in the UK do, and seeing as at the time of writing, bethere were the only ISP to support anywhere close to 24mbit, I wasn’t going to try and find another.
Read the rest of this entry »