问题
How can I find out whether a given IP address is an official internet address or an internal intranet IP address?
回答1:
Intranet IP's are often in the private IP range:
10.0.0.0 through 10.255.255.255
172.16.0.0 through 172.31.255.255
192.168.0.0 through 192.168.255.255
These are not usable for internet IP addresses.
See also http://compnetworking.about.com/od/workingwithipaddresses/f/privateipaddr.htm
回答2:
10.0.0.0 - 10.255.255.255` (10.0.0.0/8, former Class A)
172.16.0.0 - 172.31.255.255` (172.16.0.0/12, former Class B)
192.168.0.0 - 192.168.255.255` (192.168.0.0/24, former Class C)
Founding out that given IP belongs to that, depends in what form do you have given IP. The best way to use bytes.
回答3:
RFC 1918 defines some IP address ranges which can't exist on the internet, and are therefore suitable for intranet use (i.e. 10/8, 172.16/12, 192.168/16).
Apart from that, what do you mean? Are you trying to find out which IPs are on the same subnet as your own machine, or on some other 3rd party network?
See also http://en.wikipedia.org/wiki/Private_network
回答4:
The Internet Assigned Numbers Authority (IANA) has reserved the following three blocks of the IP address space for private internets:
10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
source
回答5:
Besides those A,B,C intranet classes, there are other reserved addresses not used as public internet IPs, especially:
- 127.x.y.z (loopback)
- 0.x.y.z (reserved broadcast)
- 224-255.x.y.z (multicast & future use)
There are also many wasted IP addresses (legacy from stupid ages). You won't see most addresses in range
- cca 3-40.x.y.z (i.e. 17.x.y.z wasted for Apple Computers)
来源:https://stackoverflow.com/questions/601602/distinguish-the-between-intranet-and-official-ip-addresses