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
Did you mean that you want to change the IP address of an interface? This
can be done, but you don't want to change it to something arbitrary. The IP
address has to be appropriate for the network it's on, and the network needs
to agree that this is so.