[network] IPv4 vs. IPv6 address pool

news/2025/11/12 18:46:02/文章来源:https://www.cnblogs.com/profesor/p/19215000

 

===============

let’s expand on that precisely.


1. IPv4 address space size

Each IPv4 address is 32 bits long.
Therefore, the total number of possible combinations is:

[
2^{32} = 4,294,967,296
]

That’s roughly 4.29 billion unique addresses.


2. Why we don’t actually have 4.29 billion usable public addresses

A large portion of that space is reserved for special uses.
Examples:

RangePurposeNotes
0.0.0.0/8 “This network” Used in routing contexts.
10.0.0.0/8 Private networks (RFC 1918) Not publicly routable.
127.0.0.0/8 Loopback 127.0.0.1 = localhost.
169.254.0.0/16 Link-local (APIPA) Used when no DHCP server.
172.16.0.0/12 Private networks Not routable.
192.168.0.0/16 Private networks Not routable.
224.0.0.0/4 Multicast Not unicast.
240.0.0.0/4 Reserved for future use Historically unused.
255.255.255.255 Broadcast Special all-hosts address.

After subtracting all of those, the number of publicly routable IPv4 addresses is closer to ~3.7 billion.


3. The consequence: IPv4 exhaustion

Because of this limited pool, IPv4 addresses began running out.
Regional Internet Registries (RIRs) officially exhausted their free pools between 2011 and 2019.
The world has since relied on:

  • NAT (Network Address Translation) — allowing thousands of devices to share a single public address.

  • CIDR (Classless Inter-Domain Routing) — to allocate space more efficiently.

  • IPv6 — the successor protocol, with 2¹²⁸ addresses, effectively inexhaustible for the foreseeable future.


4. Quick comparison

ProtocolAddress bitsTotal addressesExample
IPv4 32 4,294,967,296 192.168.1.100
IPv6 128 340,282,366,920,938,463,463,374,607,431,768,211,456 2001:0db8::1

IPv6 has about 7.9×10²⁸ times as many addresses as IPv4.


So yes — (2^{32}) defines the theoretical IPv4 address space, but in practice, only a fraction of that is globally usable.

 

 

==================================

 

let’s write out 2001:0db8::1 in binary form step by step.


1. IPv6 address structure

An IPv6 address has 128 bits, written as 8 groups of 16-bit hexadecimal blocks, separated by colons:

2001:0db8::1

The :: means a run of zero blocks has been compressed.
Let’s first expand it fully.


2. Expand the compressed form

2001:0db8::1 expands to:

2001:0db8:0000:0000:0000:0000:0000:0001

Now we have 8 groups (each 16 bits = 4 hex digits).


3. Convert each group to binary

Each hexadecimal digit → 4 binary bits.

GroupHexBinary
1 2001 0010 0000 0000 0001
2 0db8 0000 1101 1011 1000
3 0000 0000 0000 0000 0000
4 0000 0000 0000 0000 0000
5 0000 0000 0000 0000 0000
6 0000 0000 0000 0000 0000
7 0000 0000 0000 0000 0000
8 0001 0000 0000 0000 0001

4. Concatenate them all

The full 128-bit binary form is:

0010000000000001 0000110110111000 0000000000000000 0000000000000000
0000000000000000 0000000000000000 0000000000000000 0000000000000001

Or, without spaces:

00100000000000010000110110111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001

5. Verification

  • 8 × 16 bits = 128 bits

  • Each group corresponds exactly to its hex block ✅

So in binary,
2001:0db8::1 = 0010 0000 0000 0001 0000 1101 1011 1000 … (rest all zero) … 0000 0000 0000 0001.

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/963676.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

详细介绍:微信小程序开发实战指南(三)-- Webview访问总结

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

[Network] subnet mask

Q: ip address: 192.168.1.100subnet mask 255.255.255.0why is 192.168.x.x so special?what does this subnet mask mean? 192 in binary form is 11000000168 in binary form is 10101000why these two number ar…

flask: 用flask-cors解决跨域问题

一,安装第三方库 $ pip install flask-cors 二,代码: from flask_cors import CORSapp = Flask(__name__)# 解决存在跨域的问题 CORS(app)

Linux小课堂: 用户管理与权限控制机制详解 - 实践

Linux小课堂: 用户管理与权限控制机制详解 - 实践2025-11-12 18:36 tlnshuju 阅读(0) 评论(0) 收藏 举报pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; displa…

linux版本微信打开关闭快捷键

安装相关依赖: sudo apt install libx11-dev libdbus-1-dev wmctrl 复制源代码,编译: g++ -std=c++11 -o wechat wechat.cpp deepin系统设置全局快捷键源码: //g++ -std=c++11 -o wechat wechat.cpp //这是一个通过…

如何在 .NET 中使用 SIMD

目录什么是 SIMDSIMD 基础 APISystem.Runtime.Intrinsics 命名空间如何理解向量的大小跨平台实现方式SIMD 指令集的使用System.Numerics 命名空间中的 SIMD 支持Vector<T> 结构体Vector2、Vector3 和 Vector4 结…

Linux shell映射表(变量的变量)

前言全局说明一、说明 1.1 环境: Ubuntu 22.04二、映射表 declare -A ARCH_MAP=(["arm"]="arm-linux-gnueabihf"["aarch64"]="aarch64-linux-gnu"["mips"]="m…

前端 GIT 使用技巧

Hello World本文来自博客园,作者:南宫影,转载请注明原文链接:https://www.cnblogs.com/nangongying/p/19214917

详细介绍:显卡算力过高导致PyTorch不兼容的救赎指南

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

2025/11/13

2025/11/13循环不变量原则: 循环不变量原则是算法设计与证明中用于确保循环逻辑正确性的核心思想,指在循环执行的每一轮前后,都保持一个固定的、为真的命题(不变量)。 这个命题明确了循环变量、数据结构或窗口的核…

Linux《网络基础》 - 教程

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

《程序员修炼之道》阅读笔记4

按合约设计 按合约设计(Design by Contract,DBC)是一种基于合约的软件开发方法,它借鉴了现实世界中合约的概念,明确模块之间的权利与责任。在软件系统中,每个函数或方法都有其特定的职责,DBC通过定义前条件、后…

记一次 .NET 某医联体管理系统 崩溃分析

一:背景 1. 讲故事 这段时间都在跑外卖,感觉好久都没写文章了,今天继续给大家带来一篇崩溃类的生产事故,这是微信上有位老朋友找到我的,让我帮忙看下为啥崩溃了,dump也在手,接下来就可以一顿分析。 二:崩溃分析…

如何构建可信智能 Data Agent?推荐 Aloudata Agent 分析决策智能体

企业构建可信智能的 Data Agent 需以强大的数据底座为支撑,统一指标语义层和 NoETL 数据工程成为关键摘要: 在 AI 与大数据深度融合的当下,数据分析民主化日渐火热。Aloudata Agent 分析决策智能体依托于统一的指标…

Java 集合-Set

Java 集合 - Set 详解 集合(Set)是用于存储和处理无重复元素的高效数据结构,映射表(Map)则类似目录,支持通过键值快速查询和获取对应值。例如检验某人是否在论文答辩名单中,用 Set 实现比线性表更高效;若需存储…

#题解#牛客:牛牛的构造#DP#构造#

传送门 分析 1.容易发现的一件事,当n,n-1,n-2......2,1排列时是满足条件的(i,j)对最多的n排列 2.我们用递推的想法求每一个n的最大(i,j)对数ans[n] ans[0] = 0;int pre = 0;int x = 0;for (int i = 1; i <= …

Machine Learning - SVM Part 2: The Radial Kernel

Machine Learning - SVM Part 2: The Radial Kernel

2025-11-12 ZYZ28-NOIP-aoao round 2 hetao1733837的record

2025-11-12 ZYZ28-NOIP-aoao round 2 hetao1733837的record比赛链接:比赛详情 - ZYZ28-NOIP-aoao round 2 - ZYZOJ 比赛背景 昨天双十一,ZYZ著名NOI Cu选手@[TaoRan](用户详情 - TaoRan - ZYZOJ)爆出了惊天大瓜——…

2025/11/12

2025/11/12滑动窗口的核心是通过维护一个动态调整的 “窗口”(连续子区间),用 O (n) 时间复杂度替代暴力枚举的 O (n),避免重复计算。 其核心逻辑是用左右指针界定窗口范围,根据问题条件移动指针收缩或扩展窗口,…

redis stream介绍

介绍 redis stream是一种类似日志追加的数据结构。可用来记录和实时处理事件。适用场景:事件溯源 传感器监控 通知性能 新增 O(1) 访问单个节点是O(n),n是ID的长度 redis stream使用radix trees实现 基础 XADD 新增条…