3

Is there any way to check if an IP address is a real IP address or private IP address?

  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer. – Ron Maupin Aug 7 '17 at 22:11
5

First, private IP addresses are real IP addresses. I assume you mean which IP addresses can be routed on the public Internet vs. which IP addresses cannot.

Check to see if the IP address is in one of the ranges marked as False under Global in the IANA IPv4 Special-Purpose Address Registry. If it is, it cannot be routed on the public Internet. Also, multicast addresses (224.0.0.0/4) cannot be routed on the public Internet.

You can do the same thing for IPv6 with the IANA IPv6 Special-Purpose Address Registry. The globally routable IPv6 addresses all fall in the 2000::/3 range, but there are address ranges within that which are not routable on the public Internet, and any multicast IPv6 address (ff00::/8) is not routable on the public Internet.

| improve this answer | |
  • private IP addresses are real IP addresses ? How ? – Md. Emran Hosen Mar 24 '16 at 6:54
  • 1
    IP doesn't have any inherent capability to detect which addresses are artificially set aside as private addresses. The private addresses were set aside by RFC 1918, and the Internet carriers block them with access lists. There is nothing about the private addresses which otherwise keeps them from doing anything that public IP addresses can do. – Ron Maupin Mar 24 '16 at 6:58
  • 2
    There is one exception 2001:db8::/32 should be used for documentation and must not be routed on the Internet. – Jens Link Mar 24 '16 at 7:52
  • 2
    Also: even addresses that are not from RFC1918 can be put behind a NAT router and made private. What is "private" is just a matter of perspective – Sander Steffann Mar 24 '16 at 8:34
  • @JensLink, there are more ranges than the Documentation range in the IPv6 Global address range that can't be routed on the Internet: 2001::/23 IETF Protocol Assignments, 2001::/32 TEREDO, and 2001:2::/48 Benchmarking. – Ron Maupin Mar 24 '16 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.