This is a step-by-step tutorial. If you have iPhone 3G this guide will help you jailbreak and activate the device. For iPhone 2G it will also perform the unlock.
I recommend using 2.2 firmware, because iPhone 3G . But you can use it with old v2.1, v2.0.1 and v2.0.2.