by anserkk » Mon Nov 08, 2010 4:39 am
The Internet Assigned Numbers Authority (IANA) has reserved the following three blocks of the IP address space for private internets (local networks):
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
Also, IP addresses in the range of 169.254.0.0 -169.254.255.255 are reserved for Automatic Private IP Addressing.
These IP's should not be used on the Internet.
If you know the above range of IP's, you can easily write a function to grab your system's IP and then compare whether the IP address of your system falls in any of the above given three IP ranges or not. If it belongs to the above given IP blocks, it is a private/LAN IP else it is a WAN IP.
Regards
Anser