chore: add
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
你只需要知道一件事 —— IP 头里有一对 IP 地址,分别分别代表这个数据包从哪里来,到哪里去。
|
||||
|
||||
在组成一个比较大的网络前,我们需要给一个个孤立的IP地址分类。给 IP 分类可以让维护路由表变得更简单,CIDR(无类域间路由)是一种非常良好的分类方法。
|
||||
在组成一个比较大的网络前,我们需要给一个个孤立的 IP 地址分类。给 IP 分类可以让维护路由表变得更简单,CIDR(无类域间路由)是一种非常良好的分类方法。
|
||||
|
||||
## CIDR
|
||||
|
||||
@@ -70,31 +70,31 @@ baimeow@server:~$ ip addr
|
||||
|
||||
严格意义上说,上面提到的子网一部分应该改称呼为网段,简单起见不细究了。
|
||||
|
||||
## 常见保留IP
|
||||
## 常见保留 IP
|
||||
|
||||
了解一下常见的保留IP吧,这些保留 IP 不会出现在公网,而是被用于其他特殊用途。
|
||||
了解一下常见的保留 IP 吧,这些保留 IP 不会出现在公网,而是被用于其他特殊用途。
|
||||
|
||||
让我抄一下Wiki的表格。
|
||||
让我抄一下 Wiki 的表格。
|
||||
|
||||
| 地址块 ([CIDR](https://zh.wikipedia.org/wiki/无类别域间路由)) | 范围 | 地址数 | 效用域 | 用途 |
|
||||
| :----------------------------------------------------------: | :---------------------------: | :---------: | :------: | :----------------------------------------------------------: |
|
||||
| 0.0.0.0/8 | 0.0.0.0 – 0.255.255.255 | 16,777,216 | 软件 | 用于广播信息到当前主机。[[1\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-1) |
|
||||
| 10.0.0.0/8 | 10.0.0.0 – 10.255.255.255 | 16,777,216 | 专用网络 | 用于[专用网络](https://zh.wikipedia.org/wiki/专用网络)中的本地通信。[[2\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc1918-2) |
|
||||
| 100.64.0.0/10 | 100.64.0.0 – 100.127.255.255 | 4,194,304 | 专用网络 | 用于在[电信级NAT](https://zh.wikipedia.org/wiki/电信级NAT)环境中服务提供商与其用户通信。[[3\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-3) |
|
||||
| 127.0.0.0/8 | 127.0.0.0 – 127.255.255.255 | 16,777,216 | 主机 | 用于到本地主机的[环回地址](https://zh.wikipedia.org/wiki/IPv4#环回地址(Loopback_Address))。[[4\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-4) |
|
||||
| 169.254.0.0/16 | 169.254.0.0 – 169.254.255.255 | 65,536 | 链路 | 用于单链路的两个主机之间的[链路本地地址](https://zh.wikipedia.org/wiki/链路本地地址),而没有另外指定IP地址,例如通常从[DHCP](https://zh.wikipedia.org/wiki/动态主机设置协议)服务器所检索到的IP地址。[[5\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-5) |
|
||||
| 172.16.0.0/12 | 172.16.0.0 – 172.31.255.255 | 1,048,576 | 专用网络 | 用于[专用网络](https://zh.wikipedia.org/wiki/专用网络)中的本地通信。[[2\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc1918-2) |
|
||||
| 192.0.0.0/24 | 192.0.0.0 – 192.0.0.255 | 256 | 专用网络 | 用于IANA的IPv4特殊用途地址表。[[6\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc5736-6) |
|
||||
| 192.0.2.0/24 | 192.0.2.0 – 192.0.2.255 | 256 | 文档 | 分配为用于文档和示例中的“TEST-NET”(测试网),它不应该被公开使用。[[7\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc5737-7) |
|
||||
| 192.88.99.0/24 | 192.88.99.0 – 192.88.99.255 | 256 | 互联网 | 用于[6to4](https://zh.wikipedia.org/wiki/6to4)[任播](https://zh.wikipedia.org/wiki/任播)中继。[[8\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-8)(已废弃[[9\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc7526-9)) |
|
||||
| 192.168.0.0/16 | 192.168.0.0 – 192.168.255.255 | 65,536 | 专用网络 | 用于[专用网络](https://zh.wikipedia.org/wiki/专用网络)中的本地通信。[[2\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc1918-2) |
|
||||
| 198.18.0.0/15 | 198.18.0.0 – 198.19.255.255 | 131,072 | 专用网络 | 用于测试两个不同的子网的网间通信。[[10\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-10) |
|
||||
| 198.51.100.0/24 | 198.51.100.0 – 198.51.100.255 | 256 | 文档 | 分配为用于文档和示例中的“TEST-NET-2”(测试-网-2),它不应该被公开使用。[[7\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc5737-7) |
|
||||
| 203.0.113.0/24 | 203.0.113.0 – 203.0.113.255 | 256 | 文档 | 分配为用于文档和示例中的“TEST-NET-3”(测试-网-3),它不应该被公开使用。[[7\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc5737-7) |
|
||||
| 224.0.0.0/4 | 224.0.0.0 – 239.255.255.255 | 268,435,456 | 互联网 | 用于多播。[[11\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc1112-11) |
|
||||
| 0.0.0.0/8 | 0.0.0.0 – 0.255.255.255 | 16,777,216 | 软件 | 用于广播信息到当前主机。[[1]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-1) |
|
||||
| 10.0.0.0/8 | 10.0.0.0 – 10.255.255.255 | 16,777,216 | 专用网络 | 用于[专用网络](https://zh.wikipedia.org/wiki/专用网络)中的本地通信。[[2]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc1918-2) |
|
||||
| 100.64.0.0/10 | 100.64.0.0 – 100.127.255.255 | 4,194,304 | 专用网络 | 用于在[电信级 NAT](https://zh.wikipedia.org/wiki/电信级NAT)环境中服务提供商与其用户通信。[[3]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-3) |
|
||||
| 127.0.0.0/8 | 127.0.0.0 – 127.255.255.255 | 16,777,216 | 主机 | 用于到本地主机的[环回地址](https://zh.wikipedia.org/wiki/IPv4#环回地址(Loopback_Address))。[[4]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-4) |
|
||||
| 169.254.0.0/16 | 169.254.0.0 – 169.254.255.255 | 65,536 | 链路 | 用于单链路的两个主机之间的[链路本地地址](https://zh.wikipedia.org/wiki/链路本地地址),而没有另外指定 IP 地址,例如通常从[DHCP](https://zh.wikipedia.org/wiki/动态主机设置协议)服务器所检索到的 IP 地址。[[5]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-5) |
|
||||
| 172.16.0.0/12 | 172.16.0.0 – 172.31.255.255 | 1,048,576 | 专用网络 | 用于[专用网络](https://zh.wikipedia.org/wiki/专用网络)中的本地通信。[[2]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc1918-2) |
|
||||
| 192.0.0.0/24 | 192.0.0.0 – 192.0.0.255 | 256 | 专用网络 | 用于 IANA 的 IPv4 特殊用途地址表。[[6]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc5736-6) |
|
||||
| 192.0.2.0/24 | 192.0.2.0 – 192.0.2.255 | 256 | 文档 | 分配为用于文档和示例中的“TEST-NET”(测试网),它不应该被公开使用。[[7]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc5737-7) |
|
||||
| 192.88.99.0/24 | 192.88.99.0 – 192.88.99.255 | 256 | 互联网 | 用于[6to4](https://zh.wikipedia.org/wiki/6to4)[任播](https://zh.wikipedia.org/wiki/任播)中继。[[8]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-8)(已废弃[[9]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc7526-9)) |
|
||||
| 192.168.0.0/16 | 192.168.0.0 – 192.168.255.255 | 65,536 | 专用网络 | 用于[专用网络](https://zh.wikipedia.org/wiki/专用网络)中的本地通信。[[2]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc1918-2) |
|
||||
| 198.18.0.0/15 | 198.18.0.0 – 198.19.255.255 | 131,072 | 专用网络 | 用于测试两个不同的子网的网间通信。[[10]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-10) |
|
||||
| 198.51.100.0/24 | 198.51.100.0 – 198.51.100.255 | 256 | 文档 | 分配为用于文档和示例中的“TEST-NET-2”(测试 - 网 -2),它不应该被公开使用。[[7]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc5737-7) |
|
||||
| 203.0.113.0/24 | 203.0.113.0 – 203.0.113.255 | 256 | 文档 | 分配为用于文档和示例中的“TEST-NET-3”(测试 - 网 -3),它不应该被公开使用。[[7]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc5737-7) |
|
||||
| 224.0.0.0/4 | 224.0.0.0 – 239.255.255.255 | 268,435,456 | 互联网 | 用于多播。[[11]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc1112-11) |
|
||||
| 233.252.0.0/24 | 233.252.0.0 - 233.252.0.255 | 256 | 文档 | 分配为用于文档和示例中的“MCAST-TEST-NET”,它不应该被公开使用 |
|
||||
| 240.0.0.0/4 | 240.0.0.0 – 255.255.255.254 | 268,435,455 | 互联网 | 用于将来使用。[[12\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc6890-12) |
|
||||
| 255.255.255.255/32 | 255.255.255.255 | 1 | 子网 | 用于受限广播地址。[[12\]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc6890-12) |
|
||||
| 240.0.0.0/4 | 240.0.0.0 – 255.255.255.254 | 268,435,455 | 互联网 | 用于将来使用。[[12]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc6890-12) |
|
||||
| 255.255.255.255/32 | 255.255.255.255 | 1 | 子网 | 用于受限广播地址。[[12]](https://zh.wikipedia.org/wiki/保留IP地址#cite_note-rfc6890-12) |
|
||||
|
||||
如果需要搭建自己的比如说家庭网络,寝室网络,一般会选择
|
||||
|
||||
@@ -104,7 +104,7 @@ baimeow@server:~$ ip addr
|
||||
|
||||
此外另外了解一下其他的特殊地址,避免冲突吧
|
||||
|
||||
- `169.254.0.0/16` DHCP获取到 IP 前的临时 IP 地址
|
||||
- `169.254.0.0/16` DHCP 获取到 IP 前的临时 IP 地址
|
||||
- `192.18.0.0/16` 一些代理软件的透明代理模式会解析域名到这里
|
||||
- `172.17.0.0/16` Docker 默认网段
|
||||
|
||||
@@ -112,19 +112,19 @@ baimeow@server:~$ ip addr
|
||||
|
||||
很久很久以前,一群自大的人给 IP 随意地划分了 ABCDE 类。很遗憾,我们仍需要了解一下这个历史包袱。
|
||||
|
||||
- A类 0.0.0.0~126.255.255.255 大型网络
|
||||
- A 类 0.0.0.0~126.255.255.255 大型网络
|
||||
|
||||
- B类 128.0.0.0~191.255.255.255中型网络
|
||||
- B 类 128.0.0.0~191.255.255.255 中型网络
|
||||
|
||||
- C类 192.0.0.0~223.255.255.255 小型网络
|
||||
- C 类 192.0.0.0~223.255.255.255 小型网络
|
||||
|
||||
- D类 224.0.0.1-239.255.255.254 多播
|
||||
- D 类 224.0.0.1-239.255.255.254 多播
|
||||
|
||||
- E类 240.0.0.0---255.255.255.255 保留段与广播地址
|
||||
- E 类 240.0.0.0---255.255.255.255 保留段与广播地址
|
||||
|
||||
仅作了解,现今已经不具有实际意义了
|
||||
|
||||
## 正在消失的 —— 点分10进制掩码
|
||||
## 正在消失的 —— 点分 10 进制掩码
|
||||
|
||||
当你在 windows 的 cmd 里执行 `ipconfig /all` 时,你可以看到一个点分十进制的掩码。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user