I'm pretty much pasting my response to a similar question posted after yours:
That is not possible via code unless you have a lookup database to verify IP
addresses against. Even then your results cannot be that accurate. You can
probably buy the lookup data from a third party or you can also use a third
party software that processes your web logs and provide you with the reports
you need.
You may also use a third party webservice to get the information. This I
know is available through
http://www.dnsstuff.com
Good luck.