The easiest way to jailbreak iPhone 3G & 3Gs is following these step:
1: Download a custom firmware for your iPhone:
iPhone 3G Go to this link (http://www.megaupload.com/?d=9PYUA5EW)
iPhone 3Gs Go to this link (http://www.megaupload.com/?d=N7NJURW6)
2: After download this firmware, connect your iPhone to the computer in recovery mode
then restore it as usual. Once restoring is complete, your iPhone is also already jailbroken.
3: Open Cydia then go to Manage -> Sources -> edit -> add: repo666.ultrasn0w.com -> add
After adding this source, open it up and install Ultrasn0w 0.93 then reboot your phone that's all.
Finally you have your iPhone unlocked WOOO HOO Congratulation.