Determine whether the local IP address is a public IP address or a private IP address.

Source: Internet
Author: User
Tags ranges

Many articles have described whether the IP address is a public IP address. But I cannot remember it every time. I always need to find it again. So I decided to record it here to facilitate future query :)

There are five types of IP addresses. Class E is reserved for future use, and Class D is the multicast address. The host network addresses are Class A, Class B, and class C.

The IP addresses of these five categories have the following ranges:

 

In TCP/IP protocol, three IP address regions are reserved as private addresses. The address ranges are as follows:

 

10.0.0.0/8:10. 0.0.0 ~ 10.20.255.255

172.16.0.0/12: 172.16.0.0 ~ 172.31.255.255

192.168.0.0/16: 192.168.0.0 ~ 192.168.255.255

Networks with reserved addresses can only communicate internally, but cannot communicate with other networks. Because the reserved addresses in the Network may also be used by other networks, if the network is connected, the problem may occur because the address is not unique when looking for a route. However, these networks that use reserved addresses can interconnect with external networks by translating the reserved addresses in the network into public addresses. This is also an important way to ensure network security.

However, although some broadband carriers use non-private addresses for user use, other users on the Internet cannot access these IP addresses due to route settings.

In these two cases, the IP address of the application is called the Intranet IP address.

If the IP address of the network interface on your machine falls within the reserved IP address range, you can be sure that you are in Intranet mode.

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/huanghongbo/archive/2006/06/23/825942.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.