How can I know an IP is a public IP or not?

How can I know an IP is a public IP or not?

To determine whether an IP address is public or private, you can compare it to a list of private IP address ranges specified in RFC 1918. If the IP address falls within one of these ranges, it is a private IP address and not accessible from the internet:

  • 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)

If the IP address does not fall within one of these ranges, it is a public IP address and is accessible from the internet. Note that there are some special IP address ranges that are reserved for other purposes, such as loopback addresses (127.0.0.0/8) and link-local addresses (169.254.0.0/16), but these should not be used for public internet communication.

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(10)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2022-03-28 炉石传说 佣兵战纪 装备
2022-03-28 What can be the reasons of connection refused errors?
2022-03-28 Big Data & Cloud Computing: The Roles & Relationships
2020-03-28 Why can two different enum enumeration-constants have the same integer value?
2019-03-28 Singleton Pattern单例模式
2016-03-28 T4 Templates and the Entity Framework
2016-03-28 Entity Framework Utility .ttinclude File
点击右上角即可分享
微信分享提示