I don't know how to do it, but I can give you a warning.
My brother tried to do this once, and received a message from our host server telling him to desist in his illegal activities or he'll be taken to court.
I'm not sure exactly what the law is on this, but from the gist of the letter it seems that tracing IPs is only legal from a server you own, or if you have explicit permission from your host to do so.
This letter got mailed not only to my brother, but to me and my dad as well (every email address that was on the account doing the "illegal activity").
Just a heads up.