天津的大伙伴 发表于 2020-2-6 19:34:04

网际协议版本4缩写:IPv4又称互联网通信协议第四版

<h1 id="firstHeading" class="firstHeading" style="color: rgb(0, 0, 0); margin: 0px 0px 0.25em; padding: 0px; overflow: visible; border-bottom: 1px solid rgb(162, 169, 177); font-size: 1.8em; font-weight: normal; user-select: text !important; font-family: &quot;Linux Libertine&quot;, Georgia, Times, serif; line-height: 1.3; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang="zh-Hans-CN">IPv4<span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important;"></span></span></h1><h1 id="firstHeading" class="firstHeading" style="color: rgb(0, 0, 0); margin: 0px 0px 0.25em; padding: 0px; overflow: visible; border-bottom: 1px solid rgb(162, 169, 177); font-size: 1.8em; font-weight: normal; user-select: text !important; font-family: &quot;Linux Libertine&quot;, Georgia, Times, serif; line-height: 1.3; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" lang="zh-Hans-CN"><font size="3"><b style="user-select: text !important;">网际协议版本4</b>(英语:<span style="user-select: text !important;" lang="en"><b style="user-select: text !important;">I</b>nternet<span>&nbsp;</span><b style="user-select: text !important;">P</b>rotocol<span>&nbsp;</span><b style="user-select: text !important;">v</b>ersion<span>&nbsp;</span><b style="user-select: text !important;">4</b></span>,缩写:<b style="user-select: text !important;">IPv4</b>,又称<b style="user-select: text !important;">互联网通信协议第四版</b>)是<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">网际协议</span>开发过程中的第四个修订版本,也是此协议第一个被广泛部署和使用的版本。其后继版本为<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">IPv6</span>,直到2011年,<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">IANA</span><span>&nbsp;</span>IPv4位址完全用尽时,IPv6仍处在部署的初期。<font color="Red">目前2020年9月止,中华人民共和国大部分网络仍在使用IPv4。</font></font></h1><div id="bodyContent" class="mw-body-content" style="position: relative; z-index: 0; font-size: 0.938em; line-height: 1.6; user-select: text !important; color: rgb(32, 33, 34); font-family: sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><div id="mw-content-text" dir="ltr" class="mw-content-ltr" style="direction: ltr; user-select: text !important;" lang="zh-Hans-CN"><div class="mw-parser-output" style="user-select: text !important;"><p style="margin: 0.5em 0px; user-select: text !important;">IPv4在<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">IETF</span>于1981年9月发布的<span>&nbsp;</span><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 791</span><span>&nbsp;</span>中被描述,此RFC替换了于1980年1月发布的<span>&nbsp;</span><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 760</span>。</p><p style="margin: 0.5em 0px; user-select: text !important;">IPv4是一种<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">无连接</span>的协议,操作在使用<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">分组交换</span>的链路层(如<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">以太网</span>)上。此协议会尽最大努力交付数据包,意即它不保证任何数据包均能送达目的地,也不保证所有数据包均按照正确的顺序无重复地到达。这些方面是由上层的传输协议(如<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">传输控制协议</span>)处理的。</p><div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading" style="border: 1px solid rgb(162, 169, 177); background-color: rgb(248, 249, 250); padding: 7px; font-size: 14.2576px; display: table; user-select: text !important;"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="user-select: text !important; direction: ltr; position: absolute; opacity: 0; z-index: -1; display: none;"><div class="toctitle" dir="ltr" style="user-select: text !important; text-align: center; direction: ltr;" lang="zh-Hans-CN"><h2 id="mw-toc-heading" style="color: rgb(0, 0, 0); margin: 1em 0px 0.25em; padding: 0px; overflow: hidden; border: 0px; font-size: 14.2576px; font-weight: bold; user-select: text !important; font-family: sans-serif; line-height: 1.3; display: inline;">目录</h2><span class="toctogglespan" style="font-size: 13.4021px; user-select: text !important;"><label class="toctogglelabel" for="toctogglecheckbox" style="cursor: pointer; color: rgb(6, 69, 173); user-select: text !important;"></label></span></div><ul style="list-style-image: none; margin: 0.3em 0px; padding: 0px; user-select: text !important; list-style-type: none; text-align: left;"><li class="toclevel-1 tocsection-1" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">地址</span></span><ul style="list-style-image: none; margin: 0px 0px 0px 2em; padding: 0px; user-select: text !important; list-style-type: none; text-align: left;"><li class="toclevel-2 tocsection-2" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1.1</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">地址格式</span></span></li><li class="toclevel-2 tocsection-3" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1.2</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">常规分类</span></span></li><li class="toclevel-2 tocsection-4" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1.3</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">分配</span></span></li><li class="toclevel-2 tocsection-5" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1.4</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">特殊用途的地址</span></span></li><li class="toclevel-2 tocsection-6" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1.5</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">专用网络</span></span><ul style="list-style-image: none; margin: 0px 0px 0px 2em; padding: 0px; user-select: text !important; list-style-type: none; text-align: left;"><li class="toclevel-3 tocsection-7" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1.5.1</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">虚拟专用网络</span></span></li></ul></li><li class="toclevel-2 tocsection-8" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1.6</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">链路本地地址</span></span></li><li class="toclevel-2 tocsection-9" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1.7</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">环回地址(Loopback Address)</span></span></li><li class="toclevel-2 tocsection-10" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1.8</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">以0或255结尾的地址</span></span></li><li class="toclevel-2 tocsection-11" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">1.9</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">地址解析</span></span></li></ul></li><li class="toclevel-1 tocsection-12" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">2</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">地址空间枯竭</span></span></li><li class="toclevel-1 tocsection-13" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">3</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">网络地址转换</span></span></li><li class="toclevel-1 tocsection-14" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">4</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">报文结构</span></span><ul style="list-style-image: none; margin: 0px 0px 0px 2em; padding: 0px; user-select: text !important; list-style-type: none; text-align: left;"><li class="toclevel-2 tocsection-15" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">4.1</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">首部</span></span></li><li class="toclevel-2 tocsection-16" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">4.2</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">数据</span></span></li></ul></li><li class="toclevel-1 tocsection-17" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">5</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">分片和组装</span></span><ul style="list-style-image: none; margin: 0px 0px 0px 2em; padding: 0px; user-select: text !important; list-style-type: none; text-align: left;"><li class="toclevel-2 tocsection-18" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">5.1</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">分片</span></span></li><li class="toclevel-2 tocsection-19" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">5.2</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">重组</span></span></li></ul></li><li class="toclevel-1 tocsection-20" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">6</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">辅助协议</span></span></li><li class="toclevel-1 tocsection-21" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">7</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">参见</span></span></li><li class="toclevel-1 tocsection-22" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">8</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">参考文献</span></span></li><li class="toclevel-1 tocsection-23" style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;"><span class="tocnumber" style="display: table-cell; text-decoration: inherit; color: rgb(32, 33, 34); padding-left: 0px; padding-right: 0.5em; user-select: text !important;">9</span><span class="toctext" style="display: table-cell; text-decoration: inherit; user-select: text !important;">外部链接</span></span></li></ul></div><h2 style="color: rgb(0, 0, 0); margin: 1em 0px 0.25em; padding: 0px; overflow: hidden; border-bottom: 1px solid rgb(162, 169, 177); font-size: 1.5em; font-weight: normal; user-select: text !important; font-family: &quot;Linux Libertine&quot;, Georgia, Times, serif; line-height: 1.3;"><span id=".E5.9C.B0.E5.9D.80" style="user-select: text !important;"></span><span class="mw-headline" id="地址" style="user-select: text !important;">地址</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h2><p style="margin: 0.5em 0px; user-select: text !important;">IPv4使用32位(4字节)地址,因此<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">地址空间</span>中只有4,294,967,296(2<sup style="line-height: 1; user-select: text !important;">32</sup>)个地址。不过,一些地址是为特殊用途所保留的,如<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">专用网络</span>(约1800万个地址)和<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">多播</span>地址(约2.7亿个地址),这减少了可在互联网上路由的地址数量。随着地址不断被分配给最终用户,<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">IPv4地址枯竭问题</span>也在随之产生。基于<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">分类网络</span>、<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">无类别域间路由</span>和<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">网络地址转换</span>的地址结构重构显著地减少了地址枯竭的速度。但在2011年2月3日,在最后5个地址块被分配给5个<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">区域互联网注册管理机构</span>之后,IANA的主要地址池已经用尽。</p><p style="margin: 0.5em 0px; user-select: text !important;">这些限制刺激了仍在开发早期的作为目前唯一的长期解决方案的<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">IPv6</span>的部署。</p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E5.9C.B0.E5.9D.80.E6.A0.BC.E5.BC.8F" style="user-select: text !important;"></span><span class="mw-headline" id="地址格式" style="user-select: text !important;">地址格式</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><p style="margin: 0.5em 0px; user-select: text !important;">IPv4地址可被写作任何表示一个32位整数值的形式,但为了方便人类阅读和分析<sup id="cite_ref-1" class="reference" style="line-height: 1; user-select: text !important; unicode-bidi: isolate; white-space: nowrap; font-weight: normal; font-style: normal;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;"></span></sup>,它通常被写作<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">点分十进制</span>的形式,即四个字节被分开用<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">十进制</span>写出,中间用点分隔。</p><p style="margin: 0.5em 0px; user-select: text !important;">下表展示了几种不同的格式:</p><table class="wikitable" style="font-size: 15.008px; background-color: rgb(248, 249, 250); color: rgb(32, 33, 34); margin: 1em 0px; border: 1px solid rgb(162, 169, 177); border-collapse: collapse; user-select: text !important;"><tbody style="user-select: text !important;"><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">格式</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">值</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">从点分十进制转换</th></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">点分十进制</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><tt style="font-family: monospace, monospace; user-select: text !important;">192.0.2.235</tt></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">不适用</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">点分十六进制<sup id="cite_ref-inet_2-0" class="reference" style="line-height: 1; user-select: text !important; unicode-bidi: isolate; white-space: nowrap; font-weight: normal; font-style: normal;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;"></span></sup></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><tt style="font-family: monospace, monospace; user-select: text !important;">0xC0.0x00.0x02.0xEB</tt></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">每个字节被单独转换为十六进制</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">点分八进制<sup id="cite_ref-inet_2-1" class="reference" style="line-height: 1; user-select: text !important; unicode-bidi: isolate; white-space: nowrap; font-weight: normal; font-style: normal;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;"></span></sup></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><tt style="font-family: monospace, monospace; user-select: text !important;">0300.0000.0002.0353</tt></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">每个字节被单独转换为八进制</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">十六进制</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><tt style="font-family: monospace, monospace; user-select: text !important;">0xC00002EB</tt></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">将点分十六进制连在一起</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">十进制</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><tt style="font-family: monospace, monospace; user-select: text !important;">3221226219</tt></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">用十进制写出的32位整数</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">八进制</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><tt style="font-family: monospace, monospace; user-select: text !important;">030000001353</tt></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">用八进制写出的32位整数</td></tr></tbody></table><p style="margin: 0.5em 0px; user-select: text !important;">此外,在点分格式中,每个字节都可用任意的进制表达。如,<tt style="font-family: monospace, monospace; user-select: text !important;">192.0x00.0002.235</tt>是一种合法(但不常用)的表示。</p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E5.B8.B8.E8.A7.84.E5.88.86.E7.B1.BB" style="user-select: text !important;"></span><span class="mw-headline" id="常规分类" style="user-select: text !important;">常规分类</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><table class="wikitable mw-collapsible mw-made-collapsible" style="font-size: 15.008px; background-color: rgb(248, 249, 250); color: rgb(32, 33, 34); margin: 1em 0px; border: 1px solid rgb(162, 169, 177); border-collapse: collapse; user-select: text !important;"><caption style="user-select: text !important; font-weight: bold;">IPv4地址分类<span>&nbsp;</span><span class="mw-collapsible-toggle mw-collapsible-toggle-default" role="button" tabindex="0" aria-expanded="true" style="float: none; user-select: text !important; cursor: pointer;"><a class="mw-collapsible-text" style="text-decoration: none; color: rgb(6, 69, 173); background: none; user-select: text !important; cursor: pointer;">折叠</a></span></caption><tbody style="user-select: text !important;"><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><br></th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">A类IPv4地址</b></th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">B类IPv4地址</b></th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">C类IPv4地址</b></th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">D类IPv4地址</b></th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">E类IPv4地址</b></th></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">网络标志位</b></th><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">10</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">110</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1110</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">11110</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">IP地址范围</b></th><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1.0.0.0~127.255.255.255</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">128.0.0.0~191.255.255.255</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">192.0.0.0~223.255.255.255</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">224.0.0.0~239.255.255.255</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">240.0.0.0~247.255.255.255</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">可用IP地址范围</b></th><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1.0.0.1~127.255.255.254</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">128.0.0.1~191.255.255.254</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">192.0.0.1~223.255.255.254</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><br></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><br></td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">是否可以分配给主机使用</b></th><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">是</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">是</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">是</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">否</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">否</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">网络数量(个)</b></th><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">126 (27-2)</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">16384 (214)</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">2097152 (221)</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">---</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">---</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">每个网络中可容纳主机数(个)</b></th><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">16777214 (224-2)</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">65534 (216-2)</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">254 (28-2)</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">---</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">---</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;"><b style="user-select: text !important;">适用范围</b></th><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">大量主机的大型网络</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">中等规模主机数的网络</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">小型局域网</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">留给Internet体系结构委员会(IAB)使用<p style="margin: 0.5em 0px; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">组播</span>地址</p></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">保留,仅作为搜索、Internet的实验和开发用</td></tr></tbody></table><p style="margin: 0.5em 0px; user-select: text !important;"><b style="user-select: text !important;">说明:D类与E类IPv4地址不区分网络地址与主机地址</b></p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E5.88.86.E9.85.8D" style="user-select: text !important;"></span><span class="mw-headline" id="分配" style="user-select: text !important;">分配</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><p style="margin: 0.5em 0px; user-select: text !important;">最初,一个IP地址被分成两部分:网络标识符在地址的高位字节中,主机标识符在剩下的部分中。</p><p style="margin: 0.5em 0px; user-select: text !important;">为了克服这个限制,在随后出现的<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">分类网络</span>中,地址的高位字节被重定义为网络的<i style="user-select: text !important;">类</i>(Class)。这个系统定义了五个类别:A、B、C、D和E。A、B和C类有不同的网络类别长度,剩余的部分被用来识别网络内的主机,这就意味着每个网络类别有着不同的给主机编址的能力。D类被用于<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">多播</span>地址,E类被留作将来使用。</p><table class="wikitable" style="font-size: 15.008px; background-color: rgb(248, 249, 250); color: rgb(32, 33, 34); margin: 1em 0px; border: 1px solid rgb(162, 169, 177); border-collapse: collapse; user-select: text !important;"><caption style="user-select: text !important; font-weight: bold;">IPv4地址空间分类<sup id="cite_ref-3" class="reference" style="line-height: 1; user-select: text !important; unicode-bidi: isolate; white-space: nowrap; font-weight: normal; font-style: normal;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;"></span></sup></caption><tbody style="user-select: text !important;"><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">前8位地址范围</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">类</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">路由形式</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">占地址总空间的比例</th></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0-127</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">A</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">单播</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1/2</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">128-191</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">B</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">单播</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1/4</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">192-223</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">C</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">单播</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1/8</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">224-239</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">D</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">多播</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1/16</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">240-255</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">E</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">-</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1/16</td></tr></tbody></table><p style="margin: 0.5em 0px; user-select: text !important;">1993年,<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">无类别域间路由</span>(CIDR)正式地取代了<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">分类网络</span>,后者也因此被称为“有类别”的。</p><p style="margin: 0.5em 0px; user-select: text !important;">CIDR被设计为可以重新划分地址空间,因此小的或大的地址块均可以分配给用户。CIDR创建的分层架构由<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">互联网号码分配局</span>(IANA)和<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">区域互联网注册管理机构</span>(RIR)进行管理,每个RIR均维护着一个公共的<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">WHOIS</span>数据库,以此提供IP地址分配的详情。</p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E7.89.B9.E6.AE.8A.E7.94.A8.E9.80.94.E7.9A.84.E5.9C.B0.E5.9D.80" style="user-select: text !important;"></span><span class="mw-headline" id="特殊用途的地址" style="user-select: text !important;">特殊用途的地址</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><table class="wikitable sortable jquery-tablesorter" style="font-size: 15.008px; background-color: rgb(248, 249, 250); color: rgb(32, 33, 34); margin: 1em 0px; border: 1px solid rgb(162, 169, 177); border-collapse: collapse; user-select: text !important;"><caption style="user-select: text !important; font-weight: bold;">保留的地址块</caption><thead style="user-select: text !important;"><tr style="user-select: text !important;"><th class="headerSort" tabindex="0" role="columnheader button" title="升序排列" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 21px 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center; background-image: url(&quot;/w/resources/src/jquery.tablesorter.styles/images/sort_both.svg?6b5ca&quot;); cursor: pointer; background-repeat: no-repeat; background-position: right center;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">CIDR</span>地址块</th><th class="headerSort" tabindex="0" role="columnheader button" title="升序排列" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 21px 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center; background-image: url(&quot;/w/resources/src/jquery.tablesorter.styles/images/sort_both.svg?6b5ca&quot;); cursor: pointer; background-repeat: no-repeat; background-position: right center;">描述</th><th class="headerSort" tabindex="0" role="columnheader button" title="升序排列" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 21px 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center; background-image: url(&quot;/w/resources/src/jquery.tablesorter.styles/images/sort_both.svg?6b5ca&quot;); cursor: pointer; background-repeat: no-repeat; background-position: right center;">参考资料</th></tr></thead><tbody style="user-select: text !important;"><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0.0.0.0/8</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">本网络(仅作为源地址时合法)</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 6890</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">10.0.0.0/8</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">专用网络</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 1918</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">100.64.0.0/10</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">电信级NAT</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 6598</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">127.0.0.0/8</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">环回</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 5735</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">169.254.0.0/16</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">链路本地</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 3927</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">172.16.0.0/12</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">专用网络</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 1918</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">192.0.0.0/24</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">保留(IANA)</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 5735</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">192.0.2.0/24</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">TEST-NET-1,文档和示例</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 5735</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">192.88.99.0/24</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">6to4</span>中继</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 3068</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">192.168.0.0/16</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">专用网络</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 1918</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">198.18.0.0/15</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">网络基准测试</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 2544</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">198.51.100.0/24</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">TEST-NET-2,文档和示例</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 5737</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">203.0.113.0/24</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">TEST-NET-3,文档和示例</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 5737</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">224.0.0.0/4</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">多播</span>(之前的D类网络)</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 3171</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">240.0.0.0/4</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">保留(之前的E类网络)</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 1700</span></td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">255.255.255.255/32</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">受限广播</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 919</span></td></tr></tbody><tfoot style="user-select: text !important;"></tfoot></table><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E4.B8.93.E7.94.A8.E7.BD.91.E7.BB.9C" style="user-select: text !important;"></span><span class="mw-headline" id="专用网络" style="user-select: text !important;">专用网络</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><div role="note" class="hatnote navigation-not-searchable" style="font-size: small; user-select: text !important; padding-left: 2em; margin-bottom: 0.8em; margin-top: 0.8em;">主条目:<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">专用网络</span></div><p style="margin: 0.5em 0px; user-select: text !important;">在IPv4所允许的大约四十亿地址中,三个地址块被保留作<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">专用网络</span>。这些地址块在专用网络之外不可路由,专用网络之内的主机也不能直接与公共网络通信。但通过<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">网络地址转换</span>(NAT),使用这些地址的主机可以像拥有共有地址的主机在互联网上通信。</p><p style="margin: 0.5em 0px; user-select: text !important;">下表展示了三个被保留作专用网络的地址块(<span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 1918</span>):</p><table class="wikitable" style="font-size: 15.008px; background-color: rgb(248, 249, 250); color: rgb(32, 33, 34); margin: 1em 0px; border: 1px solid rgb(162, 169, 177); border-collapse: collapse; user-select: text !important;"><tbody style="user-select: text !important;"><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">名字</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">地址范围</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">地址数量</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">有类别的描述</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">最大的<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">CIDR</span>地址块</th></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">24位块</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">10.0.0.0–10.255.255.255</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">16,777,216</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">一个A类</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">10.0.0.0/8</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">20位块</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">172.16.0.0–172.31.255.255</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1,048,576</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">连续的16个B类</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">172.16.0.0/12</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">16位块</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">192.168.0.0–192.168.255.255</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">65,536</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">连续的256个C类</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">192.168.0.0/16</td></tr></tbody></table><h4 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 15.008px; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E8.99.9A.E6.8B.9F.E4.B8.93.E7.94.A8.E7.BD.91.E7.BB.9C" style="user-select: text !important;"></span><span class="mw-headline" id="虚拟专用网络" style="user-select: text !important;">虚拟专用网络</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h4><div role="note" class="hatnote navigation-not-searchable" style="font-size: small; user-select: text !important; padding-left: 2em; margin-bottom: 0.8em; margin-top: 0.8em;">主条目:<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">虚拟专用网</span></div><p style="margin: 0.5em 0px; user-select: text !important;">通常情况下,路由器根据数据报文的目的地址决定转发数据报文的下一跳地址。使用专用网络地址作为目的地址的数据包通常无法被公共路由器正确送达,因为公共路由器没有相应的路由信息,即无法得知如何才能转发到该IP地址。因此,这就需要通过一种方法,将指引数据报文转发的下一跳地址和真正要传输的目的地址分离开。于是就使用<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">虚拟专用网</span>,将IP报文封装在其他报文内,以便于通过公网上的公共路由器,达到能处理该报文内层数据的网络设备上解除报文后,该数据包可以被继续转发到目的地址。</p><p style="margin: 0.5em 0px; user-select: text !important;">将数据报文封装的过程中,可以将数据报文封装于IP报文中,也可以使用<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">多协议标签交换</span>协议等,通过其他协议引导数据报文转发。也可以封装同时加密数据,以保护数据内容。</p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E9.93.BE.E8.B7.AF.E6.9C.AC.E5.9C.B0.E5.9C.B0.E5.9D.80" style="user-select: text !important;"></span><span class="mw-headline" id="链路本地地址" style="user-select: text !important;">链路本地地址</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><div role="note" class="hatnote navigation-not-searchable" style="font-size: small; user-select: text !important; padding-left: 2em; margin-bottom: 0.8em; margin-top: 0.8em;">主条目:<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">链路本地地址</span></div><p style="margin: 0.5em 0px; user-select: text !important;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 5735</span>中将地址块169.254.0.0/16保留为特殊用于链路本地地址,这些地址仅在链路上有效(如一段本地网络或一个端到端连接)。这些地址与专用网络地址一样不可路由,也不可作为公共网络上报文的源或目的地址。链路本地地址主要被用于地址自动配置:当主机不能从DHCP服务器处获得IP地址时,它会用这种方法生成一个。</p><p style="margin: 0.5em 0px; user-select: text !important;">当这个地址块最初被保留时,地址自动配置尚没有一个标准。为了填补这个空白,<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">微软</span>创建了一种叫<b style="user-select: text !important;">自动专用IP寻址</b>(APIPA)的实现。因微软的市场影响力,APIPA已经被部署到了几百万机器上,也因此成为了事实上的工业标准。许多年后,<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">IETF</span>为此定义了一份正式的标准:<span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 3927</span>,命名为“IPv4链路本地地址的动态配置”。</p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E7.8E.AF.E5.9B.9E.E5.9C.B0.E5.9D.80.28Loopback_Address.29" style="user-select: text !important;"></span><span class="mw-headline" id="环回地址(Loopback_Address)" style="user-select: text !important;">环回地址(Loopback Address)</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><div role="note" class="hatnote navigation-not-searchable" style="font-size: small; user-select: text !important; padding-left: 2em; margin-bottom: 0.8em; margin-top: 0.8em;">主条目:<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">127.0.0.1</span></div><p style="margin: 0.5em 0px; user-select: text !important;">地址块127.0.0.0/8被保留作环回通信用。此范围中的地址绝不应出现在主机之外,发送至此地址的报文被作为同一虚拟网络设备上的入站报文(环回),主要用于检查TCP/IP协议栈是否正确运行和本机对本机的链接。</p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E4.BB.A50.E6.88.96255.E7.BB.93.E5.B0.BE.E7.9A.84.E5.9C.B0.E5.9D.80" style="user-select: text !important;"></span><span class="mw-headline" id="以0或255结尾的地址" style="user-select: text !important;">以0或255结尾的地址</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><p style="margin: 0.5em 0px; user-select: text !important;">一个常见的误解是以0或255结尾的地址永远不能分配给主机:这仅在子网掩码至少24位长度时(旧的C类地址,或CIDR中的/24到/32)才成立。</p><p style="margin: 0.5em 0px; user-select: text !important;">在有类别的编址中,只有三种可能的子网掩码:A类:255.0.0.0,B类:255.255.0.0,C类:255.255.255.0。如,在子网192.168.5.0/255.255.255.0(即192.168.5.0/24)中,网络标识符192.168.5.0用来表示整个子网,所以它不能用来标识子网上的某个特定主机。</p><p style="margin: 0.5em 0px; user-select: text !important;"><span style="text-decoration: none; color: rgb(165, 88, 88); background: none; user-select: text !important;" class="new">广播地址</span>允许数据包发往子网上的所有设备。一般情况下,广播地址是借由子网掩码的比特反码并和网络标识符运行 OR 的位操作得到,即广播地址是子网中的最后一个地址。在上述例子中,广播地址是192.168.5.255,所以为了避免歧义,这个地址也不能被分配给主机。在A、B和C类网络中,广播地址总是以255结尾。</p><p style="margin: 0.5em 0px; user-select: text !important;">但是,这并不意味着每个以255结尾的地址都不能用做主机地址。比如,在B类子网192.168.0.0/255.255.0.0(即192.168.0.0/16)中,广播地址是192.168.255.255(主机位全1)。在这种情况下,尽管可能带来误解,但192.168.1.255、192.168.2.255等地址可以被分配给主机。同理,192.168.0.0作为网络标识符不能被分配,但192.168.1.0、192.168.2.0等都是可以的。</p><p style="margin: 0.5em 0px; user-select: text !important;">随着CIDR的到来,广播地址不一定总是以255结尾(广播地址是指主机位都为1的地址,255只是其中一种情况)。比如,子网203.0.113.16/28的广播地址是203.0.113.31。过程如下:</p><p style="margin: 0.5em 0px; user-select: text !important;">网络:203.0.113.16</p><p style="margin: 0.5em 0px; user-select: text !important;">掩码:255.255.255.240</p><p style="margin: 0.5em 0px; user-select: text !important;">掩码反码:0.0.0.15</p><p style="margin: 0.5em 0px; user-select: text !important;">OR操作:</p><p style="margin: 0.5em 0px; user-select: text !important;">00010000 | 00001111 = 00011111 =31</p><p style="margin: 0.5em 0px; user-select: text !important;">一般情况下,子网的第一个和最后一个地址分别被作为网络标识符和广播地址,任何其它地址都可以被分配给其上的主机。</p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E5.9C.B0.E5.9D.80.E8.A7.A3.E6.9E.90" style="user-select: text !important;"></span><span class="mw-headline" id="地址解析" style="user-select: text !important;">地址解析</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><div role="note" class="hatnote navigation-not-searchable" style="font-size: small; user-select: text !important; padding-left: 2em; margin-bottom: 0.8em; margin-top: 0.8em;">主条目:<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">域名系统</span></div><p style="margin: 0.5em 0px; user-select: text !important;">互联网上的主机通常被指定,但IP报文的路由是由IP地址而不是这些名字决定的。这就需要将域名翻译(解析)成地址。</p><p style="margin: 0.5em 0px; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">域名系统</span>(DNS)提供了域名转换为IP地址的服务。与CIDR相像,DNS是层级结构。</p><h2 style="color: rgb(0, 0, 0); margin: 1em 0px 0.25em; padding: 0px; overflow: hidden; border-bottom: 1px solid rgb(162, 169, 177); font-size: 1.5em; font-weight: normal; user-select: text !important; font-family: &quot;Linux Libertine&quot;, Georgia, Times, serif; line-height: 1.3;"><span id=".E5.9C.B0.E5.9D.80.E7.A9.BA.E9.96.93.E6.9E.AF.E7.AB.AD" style="user-select: text !important;"></span><span class="mw-headline" id="地址空間枯竭" style="user-select: text !important;">地址空间枯竭</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h2><div role="note" class="hatnote navigation-not-searchable" style="font-size: small; user-select: text !important; padding-left: 2em; margin-bottom: 0.8em; margin-top: 0.8em;">主条目:<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">IPv4地址枯竭</span></div><p style="margin: 0.5em 0px; user-select: text !important;">从20世纪80年代起,一个很明显的问题是IPv4地址在以比设计时的预计更快的速度耗尽。<sup id="cite_ref-4" class="reference" style="line-height: 1; user-select: text !important; unicode-bidi: isolate; white-space: nowrap; font-weight: normal; font-style: normal;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;"></span></sup><span>&nbsp;</span>这是创建<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">分类网络</span>、<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">无类别域间路由</span>,和最终决定重新设计基于更长地址的互联网协议(<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">IPv6</span>)的诱因。</p><p style="margin: 0.5em 0px; user-select: text !important;">一些市场力量也加快了IPv4地址的耗尽,如:</p><ul style="list-style-image: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/bullet-icon.svg?d4515&quot;); margin: 0.3em 0px 0px 1.6em; padding: 0px; user-select: text !important;"><li style="margin-bottom: 0.1em; user-select: text !important;">互联网用户的急速增长;</li><li style="margin-bottom: 0.1em; user-select: text !important;">总是开着的设备:<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">ADSL</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">调制解调器</span>、<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">缆线调制解调器</span>等;</li><li style="margin-bottom: 0.1em; user-select: text !important;">移动设备:<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">笔记本电脑</span>、<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">PDA</span>、<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">移动电话</span>等。</li></ul><p style="margin: 0.5em 0px; user-select: text !important;">随着互联网的增长,各种各样的技术随之产生以应对IPv4地址的耗尽,如:</p><ul style="list-style-image: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/bullet-icon.svg?d4515&quot;); margin: 0.3em 0px 0px 1.6em; padding: 0px; user-select: text !important;"><li style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">网络地址转换</span>(NAT);</li><li style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">专用网络</span>的使用;</li><li style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">动态主机设置协议</span>(DHCP);</li><li style="margin-bottom: 0.1em; user-select: text !important;">基于名字的<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">虚拟主机</span>;</li><li style="margin-bottom: 0.1em; user-select: text !important;">区域互联网注册管理机构对地址分配的控制;</li><li style="margin-bottom: 0.1em; user-select: text !important;">对互联网初期分配的大地址块的回收。</li></ul><p style="margin: 0.5em 0px; user-select: text !important;">随着<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">IANA</span>把最后5个地址块分配给5个RIR,其主地址池在2011年2月3日耗尽。<sup id="cite_ref-5" class="reference" style="line-height: 1; user-select: text !important; unicode-bidi: isolate; white-space: nowrap; font-weight: normal; font-style: normal;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;"></span></sup><span>&nbsp;</span>许多地址分配和消耗的模型都预测第一个耗尽地址的RIR会在2011年的下半年出现。<sup id="cite_ref-6" class="reference" style="line-height: 1; user-select: text !important; unicode-bidi: isolate; white-space: nowrap; font-weight: normal; font-style: normal;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;"></span></sup></p><p style="margin: 0.5em 0px; user-select: text !important;">广泛被接受且已被标准化的解决方案是迁移至<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">IPv6</span>。IPv6的地址长度从IPv4的32位增长到了128位,以此提供了更好的路由聚合,也为最终用户分配最小为2<sup style="line-height: 1; user-select: text !important;">64</sup>个主机地址的地址块成为可能。迁移过程正在进行,但其完成仍需要相当的时间。</p><h2 style="color: rgb(0, 0, 0); margin: 1em 0px 0.25em; padding: 0px; overflow: hidden; border-bottom: 1px solid rgb(162, 169, 177); font-size: 1.5em; font-weight: normal; user-select: text !important; font-family: &quot;Linux Libertine&quot;, Georgia, Times, serif; line-height: 1.3;"><span id=".E7.BD.91.E7.BB.9C.E5.9C.B0.E5.9D.80.E8.BD.AC.E6.8D.A2" style="user-select: text !important;"></span><span class="mw-headline" id="网络地址转换" style="user-select: text !important;">网络地址转换</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h2><div role="note" class="hatnote navigation-not-searchable" style="font-size: small; user-select: text !important; padding-left: 2em; margin-bottom: 0.8em; margin-top: 0.8em;">主条目:<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">网络地址转换</span></div><p style="margin: 0.5em 0px; user-select: text !important;">对地址的快速分配和其造成的地址短缺促成了许多有效应用地址的方法,其中一种就是网络地址转换(NAT)。</p><h2 style="color: rgb(0, 0, 0); margin: 1em 0px 0.25em; padding: 0px; overflow: hidden; border-bottom: 1px solid rgb(162, 169, 177); font-size: 1.5em; font-weight: normal; user-select: text !important; font-family: &quot;Linux Libertine&quot;, Georgia, Times, serif; line-height: 1.3;"><span id=".E6.8A.A5.E6.96.87.E7.BB.93.E6.9E.84" style="user-select: text !important;"></span><span class="mw-headline" id="报文结构" style="user-select: text !important;">报文结构</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h2><p style="margin: 0.5em 0px; user-select: text !important;">IP报文包含IP首部和数据部分</p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E9.A6.96.E9.83.A8" style="user-select: text !important;"></span><span class="mw-headline" id="首部" style="user-select: text !important;">首部</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><p style="margin: 0.5em 0px; user-select: text !important;">IPv4报文的首部包含14个字段,其中13个是必须的,第14个是可选的(红色标出),并命名为:“选项”字段。首部中的字段均以<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">大端序</span>包装,在以下的图表和讨论中,<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">最高有效位</span>(Most Significant bit)被标记为0。</p><table class="wikitable" style="font-size: 15.008px; background-color: rgb(248, 249, 250); color: rgb(32, 33, 34); margin: 1em 0px; border: 1px solid rgb(162, 169, 177); border-collapse: collapse; user-select: text !important; text-align: center;"><tbody style="user-select: text !important;"><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="4%">位偏移</th><th colspan="4" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="12%">0–3</th><th colspan="4" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="12%">4–7</th><th colspan="6" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="24%">8–13</th><th colspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="6%">14-15</th><th colspan="3" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="9%">16–18</th><th colspan="13" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="39%">19–31</th></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">0</th><td colspan="4" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">版本</td><td colspan="4" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">首部长度</td><td colspan="6" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">区分服务</td><td colspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(165, 88, 88); background: none; user-select: text !important;" class="new">显式拥塞通告</span></td><td colspan="16" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">全长</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">32</th><td colspan="16" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">标识符</td><td colspan="3" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">标志</td><td colspan="13" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">分片偏移</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">64</th><td colspan="8" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">存活时间</span></td><td colspan="8" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-disambig">协议</span></td><td colspan="16" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">首部检验和</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">96</th><td colspan="32" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">源IP地址</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">128</th><td colspan="32" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">目的IP地址</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">160</th><td colspan="32" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;" bgcolor="#FFBBBB">选项(如首部长度&gt;5)</td></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">160<br style="user-select: text !important;">or<br style="user-select: text !important;">192+</th><td colspan="32" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">&nbsp;<br style="user-select: text !important;">数据<br style="user-select: text !important;">&nbsp;</td></tr></tbody></table><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">版本(Version)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">版本字段占4bit,通信双方使用的版本必须一致。对于IPv4,字段的值是4。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">首部长度(Internet Header Length, IHL)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">占4bit,首部长度说明首部有多少32位字(4字节)。由于IPv4首部可能包含数目不定的选项,这个字段也用来确定数据的偏移量。这个字段的最小值是5(二进制0101),相当于5*4=20字节(<span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 791</span>),最大十进制值是15。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">区分服务(Differentiated Services,DS)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">占6bit,最初被定义为<span style="text-decoration: none; color: rgb(165, 88, 88); background: none; user-select: text !important;" class="new">服务类型</span>字段,实际上并未使用,但1998年被IETF重定义为区分服务RFC 2474。只有在使用区分服务时,这个字段才起作用,在一般的情况&nbsp; 下都不使用这个字段。例如需要实时数据流的技术会应用这个字段,一个例子是<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">VoIP</span>。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">显式拥塞通告( Explicit Congestion Notification,ECN)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">在RFC 3168中定义,允许在不丢弃报文的同时通知对方网络拥塞的发生。ECN是一种可选的功能,仅当两端都支持并希望使用,且底层网络支持时才被使用。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">全长(Total Length)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">这个16位字段定义了报文总长,包含首部和数据,单位为字节。这个字段的最小值是20(20字节首部+0字节数据),最大值是2<sup style="line-height: 1; user-select: text !important;">16</sup>-1=65,535。IP规定所有主机都必须支持最小576字节的报文,这是假定上层数据长度512字节,加上最长IP首部60字节,加上4字节富裕量,得出576字节,但大多数现代主机支持更大的报文。当下层的数据链路协议的<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">最大传输单元</span>(MTU)字段的值小于IP报文长度时,报文就必须被分片,详细见下个标题。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">标识符(Identification)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">占16位,这个字段主要被用来唯一地标识一个报文的所有分片,因为分片不一定按序到达,所以在重组时需要知道分片所属的报文。每产生一个数据报,计数器加1,并赋值给此字段。一些实验性的工作建议将此字段用于其它目的,例如增加报文跟踪信息以协助探测伪造的源地址。<sup id="cite_ref-7" class="reference" style="line-height: 1; user-select: text !important; unicode-bidi: isolate; white-space: nowrap; font-weight: normal; font-style: normal;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;"></span></sup></dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">标志 (Flags)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">这个3位字段用于控制和识别分片,它们是:<ul style="list-style-image: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/bullet-icon.svg?d4515&quot;); margin: 0.3em 0px 0px 1.6em; padding: 0px; user-select: text !important;"><li style="margin-bottom: 0.1em; user-select: text !important;">位0:保留,必须为0;</li><li style="margin-bottom: 0.1em; user-select: text !important;">位1:禁止分片(Don’t Fragment,DF),当DF=0时才允许分片;</li><li style="margin-bottom: 0.1em; user-select: text !important;">位2:更多分片(More Fragment,MF),MF=1代表后面还有分片,MF=0 代表已经是最后一个分片。</li></ul></dd><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">如果DF标志被设置为1,但路由要求必须分片报文,此报文会被丢弃。这个标志可被用于发往没有能力组装分片的主机。</dd><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">当一个报文被分片,除了最后一片外的所有分片都设置MF为1。最后一个片段具有非零片段偏移字段,将其与未分片数据包区分开,未分片的偏移字段为0。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">分片偏移 (Fragment Offset)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">这个13位字段指明了每个分片相对于原始报文开头的偏移量,以8字节作单位。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">存活时间(Time To Live,TTL)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">这个8位字段避免报文在互联网中永远存在(例如陷入路由环路)。存活时间以秒为单位,但小于一秒的时间均向上取整到一秒。在现实中,这实际上成了一个跳数计数器:报文经过的每个路由器都将此字段减1,当此字段等于0时,报文不再向下一跳传送并被丢弃,最大值是255。常规地,一份<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">ICMP</span>报文被发回报文发送端说明其发送的报文已被丢弃。这也是<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">traceroute</span>的核心原理。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">协议 (Protocol)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">占8bit,这个字段定义了该报文数据区使用的协议。<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">IANA</span>维护着一份协议列表(最初由RFC 790定义),详细参见<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">IP协议号列表</span>。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">首部检验和 (Header Checksum)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">这个16位<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">检验和</span>字段只对首部查错,不包括数据部分。在每一跳,路由器都要重新计算出的首部检验和并与此字段进行比对,如果不一致,此报文将会被丢弃。重新计算的必要性是因为每一跳的一些首部字段(如TTL、Flag、Offset等)都有可能发生变化,不检查数据部分是为了减少工作量。数据区的错误留待上层协议处理——<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">用户数据报协议</span>(UDP)和<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">传输控制协议</span>(TCP)都有检验和字段。此处的检验计算方法不使用CRC。</dd><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;"><span style="text-decoration: none; color: rgb(102, 51, 102); background: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/external-link-ltr-icon.svg?b4b84&quot;) right center no-repeat; user-select: text !important; padding-right: 13px;" class="external mw-magiclink-rfc">RFC 1071</span></dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">源地址(Source address)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">一个IPv4地址由四个字节共32位构成,此字段的值是将每个字节转为二进制并拼在一起所得到的32位值。</dd><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">例如,10.9.8.7是00001010000010010000100000000111。</dd><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">但请注意,因为NAT的存在,这个地址并不总是报文的<i style="user-select: text !important;">真实</i>发送端,因此发往此地址的报文会被送往NAT设备,并由它被翻译为真实的地址。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">目的地址(Destination address)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">与源地址格式相同,但指出报文的接收端。</dd></dl><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dt style="font-weight: bold; margin-bottom: 0.1em; user-select: text !important;">选项(Options)</dt><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">附加的首部字段可能跟在目的地址之后,但这并不被经常使用,从1到40个字节不等。请注意首部长度字段必须包括足够的32位字来放下所有的选项(包括任何必须的填充以使首部长度能够被32位整除)。当选项列表的结尾不是首部的结尾时,EOL(选项列表结束,0x00)选项被插入列表末尾。下表列出了可能</dd></dl><table class="wikitable" style="font-size: 15.008px; background-color: rgb(248, 249, 250); color: rgb(32, 33, 34); margin: 1em 0px; border: 1px solid rgb(162, 169, 177); border-collapse: collapse; user-select: text !important;"><tbody style="user-select: text !important;"><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">字段</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">长度(位)</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">描述</th></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><b style="user-select: text !important;">备份</b></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">当此选项需要被备份到所有分片中时,设为1。</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><b style="user-select: text !important;">类</b></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">2</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">常规的选项类别,0为“控制”,2为“查错和措施”,1和3保留。</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><b style="user-select: text !important;">数字</b></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">5</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">指明一个选项。</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><b style="user-select: text !important;">长度</b></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">8</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">指明整个选项的长度,对于简单的选项此字段可能不存在。</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><b style="user-select: text !important;">数据</b></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">可变</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">选项相关数据,对于简单的选项此字段可能不存在。</td></tr></tbody></table><ul style="list-style-image: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/bullet-icon.svg?d4515&quot;); margin: 0.3em 0px 0px 1.6em; padding: 0px; user-select: text !important;"><li style="margin-bottom: 0.1em; user-select: text !important;">注:如果首部长度大于5,那么选项字段必然存在并必须被考虑。</li><li style="margin-bottom: 0.1em; user-select: text !important;">注:备份、类和数字经常被一并称呼为“类型”。</li></ul><dl style="margin-top: 0.2em; margin-bottom: 0.5em; user-select: text !important;"><dd style="margin-left: 1.6em; margin-bottom: 0.1em; user-select: text !important; margin-right: 0px;">宽松的源站选路(LSRR)和严格的源站选路(SSRR)选项不被推荐使用,因其可能带来安全问题。许多路由器会拒绝带有这些选项的报文。</dd></dl><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E6.95.B0.E6.8D.AE" style="user-select: text !important;"></span><span class="mw-headline" id="数据" style="user-select: text !important;">数据</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><p style="margin: 0.5em 0px; user-select: text !important;">数据字段不是首部的一部分,因此并不被包含在首部检验和中。数据的格式在协议首部字段中被指明,并可以是任意的<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">传输层</span>协议。</p><p style="margin: 0.5em 0px; user-select: text !important;">一些常见协议的协议字段值被列在下面:</p><table class="wikitable" style="font-size: 15.008px; background-color: rgb(248, 249, 250); color: rgb(32, 33, 34); margin: 1em 0px; border: 1px solid rgb(162, 169, 177); border-collapse: collapse; user-select: text !important;"><tbody style="user-select: text !important;"><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">协议字段值</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">协议名</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">缩写</th></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">互联网控制消息协议</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">ICMP</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">2</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">互联网组管理协议</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">IGMP</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">6</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">传输控制协议</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">TCP</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">17</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">用户数据报协议</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">UDP</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">41</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">IPv6封装</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">ENCAP</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">89</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">开放式最短路径优先</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">OSPF</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">132</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">流控制传输协议</span></td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">SCTP</td></tr></tbody></table><p style="margin: 0.5em 0px; user-select: text !important;">参见<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">IP协议号列表</span>以获得完整列表。</p><h2 style="color: rgb(0, 0, 0); margin: 1em 0px 0.25em; padding: 0px; overflow: hidden; border-bottom: 1px solid rgb(162, 169, 177); font-size: 1.5em; font-weight: normal; user-select: text !important; font-family: &quot;Linux Libertine&quot;, Georgia, Times, serif; line-height: 1.3;"><span id=".E5.88.86.E7.89.87.E5.92.8C.E7.BB.84.E8.A3.85" style="user-select: text !important;"></span><span class="mw-headline" id="分片和组装" style="user-select: text !important;">分片和组装</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h2><div role="note" class="hatnote navigation-not-searchable" style="font-size: small; user-select: text !important; padding-left: 2em; margin-bottom: 0.8em; margin-top: 0.8em;">主条目:<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">IP分片</span></div><p style="margin: 0.5em 0px; user-select: text !important;">互联网协议(IP)是整个互联网架构的基础,可以支持不同的物理层网络,即IP层独立于链路层传输技术。不同的链路层不仅在传输速度上有差异,还在帧结构和大小上有所不同,不同<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-disambig">MTU</span>参数描述了数据帧的大小。为了实现IP数据包能够使用不同的链路层技术,需要将IP数据包变成适合链路层的数据格式,IP报文的<span style="text-decoration: none; color: rgb(165, 88, 88); background: none; user-select: text !important;" class="new">分片</span>即是IP数据包为了满足链路层的数据大小而进行的分割。</p><p style="margin: 0.5em 0px; user-select: text !important;">在IPv6不要求路由器执行分片操作,而是将检测路径最大传输单元大小的任务交给了主机。</p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E5.88.86.E7.89.87" style="user-select: text !important;"></span><span class="mw-headline" id="分片" style="user-select: text !important;">分片</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><p style="margin: 0.5em 0px; user-select: text !important;">当设备收到IP报文时,分析其目的地址并决定要在哪个链路上发送它。MTU决定了数据载荷的最大长度,如IP报文长度比MTU大,则IP数据包必须进行分片。每一片的长度都小于等于MTU减去IP首部长度。接下来每一片均被放到独立的IP报文中,并进行如下修改:</p><ul style="list-style-image: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/bullet-icon.svg?d4515&quot;); margin: 0.3em 0px 0px 1.6em; padding: 0px; user-select: text !important;"><li style="margin-bottom: 0.1em; user-select: text !important;">总长字段被修改为此分片的长度;</li><li style="margin-bottom: 0.1em; user-select: text !important;">更多分片(MF)标志被设置,除了最后一片;</li><li style="margin-bottom: 0.1em; user-select: text !important;">分片偏移量字段被调整为合适的值;</li><li style="margin-bottom: 0.1em; user-select: text !important;">首部检验和被重新计算。</li></ul><p style="margin: 0.5em 0px; user-select: text !important;">例如,对于一个长20字节的首部和一个MTU为1,500的以太网,分片偏移量将会是:0、(1480/8)=185、(2960/8)=370、(4440/8)=555、(5920/8)=740、等等。</p><p style="margin: 0.5em 0px; user-select: text !important;">如果报文经过路径的MTU减小了,那么分片可能会被再次分片。</p><p style="margin: 0.5em 0px; user-select: text !important;">比如,一个4,500字节的数据载荷被封装进了一个没有选项的IP报文(即总长为4,520字节),并在MTU为2,500字节的链路上传输,那么它会被破成如下两个分片:</p><table class="wikitable" style="font-size: 15.008px; background-color: rgb(248, 249, 250); color: rgb(32, 33, 34); margin: 1em 0px; border: 1px solid rgb(162, 169, 177); border-collapse: collapse; user-select: text !important; text-align: center;"><tbody style="user-select: text !important;"><tr style="user-select: text !important;"><th rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">#</th><th colspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="200">总长</th><th rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">更多分片(MF)?</th><th rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">DF</th><th rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">分片偏移量</th></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="100">首部</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="100">数据</th></tr><tr style="user-select: text !important;"><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1</td><td colspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">2500</td><td rowspan="2" class="table-yes" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; text-align: center; background: rgb(144, 255, 144);">是</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">20</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">2480</td></tr><tr style="user-select: text !important;"><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">2</td><td colspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">2040</td><td rowspan="2" class="table-no" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; text-align: center; background: rgb(255, 144, 144);">否</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">310</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">20</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">2020</td></tr></tbody></table><p style="margin: 0.5em 0px; user-select: text !important;">现在,假设下一跳的MTU为1,500字节,那么每一个分片都会被再次分成两片(由于数据片段只有在目的主机才重新被组成数据报,因此再次分片是针对每个在网络中传输的数据帧):</p><table class="wikitable" style="font-size: 15.008px; background-color: rgb(248, 249, 250); color: rgb(32, 33, 34); margin: 1em 0px; border: 1px solid rgb(162, 169, 177); border-collapse: collapse; user-select: text !important; text-align: center;"><tbody style="user-select: text !important;"><tr style="user-select: text !important;"><th rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">#</th><th colspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="200">总长</th><th rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">更多分片(MF)?</th><th rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">DF</th><th rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;">分片偏移量</th></tr><tr style="user-select: text !important;"><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="100">首部</th><th style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; background-color: rgb(234, 236, 240); text-align: center;" width="100">数据</th></tr><tr style="user-select: text !important;"><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1</td><td colspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1500</td><td rowspan="2" class="table-yes" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; text-align: center; background: rgb(144, 255, 144);">是</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">20</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1480</td></tr><tr style="user-select: text !important;"><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">2</td><td colspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1020</td><td rowspan="2" class="table-yes" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; text-align: center; background: rgb(144, 255, 144);">是</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">185</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">20</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1000</td></tr><tr style="user-select: text !important;"><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">3</td><td colspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1500</td><td rowspan="2" class="table-yes" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; text-align: center; background: rgb(144, 255, 144);">是</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">310</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">20</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">1480</td></tr><tr style="user-select: text !important;"><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">4</td><td colspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">560</td><td rowspan="2" class="table-no" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em; text-align: center; background: rgb(255, 144, 144);">否</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">0</td><td rowspan="2" style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">495</td></tr><tr style="user-select: text !important;"><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">20</td><td style="user-select: text !important; border: 1px solid rgb(162, 169, 177); padding: 0.2em 0.4em;">540</td></tr></tbody></table><p style="margin: 0.5em 0px; user-select: text !important;">第3和4片是从原始第2片再次分片而来,所以除了分片后的最后一个分片外MF为都为1。</p><h3 style="color: rgb(0, 0, 0); margin: 0.3em 0px 0px; padding-top: 0.5em; padding-bottom: 0px; overflow: hidden; font-size: 1.2em; user-select: text !important; line-height: 1.6; font-weight: bold;"><span id=".E9.87.8D.E7.BB.84" style="user-select: text !important;"></span><span class="mw-headline" id="重组" style="user-select: text !important;">重组</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h3><p style="margin: 0.5em 0px; user-select: text !important;">当一个接收者发现IP报文的下列项目之一为真时:</p><ul style="list-style-image: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/bullet-icon.svg?d4515&quot;); margin: 0.3em 0px 0px 1.6em; padding: 0px; user-select: text !important;"><li style="margin-bottom: 0.1em; user-select: text !important;">DF标志为0;</li><li style="margin-bottom: 0.1em; user-select: text !important;">分片偏移量字段不为0。</li></ul><p style="margin: 0.5em 0px; user-select: text !important;">它便知道这个报文已被分片,并随即将数据、标识符字段、分片偏移量和更多分片标志一起储存起来。</p><p style="margin: 0.5em 0px; user-select: text !important;">当接受者收到了更多分片标志未被设置的分片时,它便知道原始数据载荷的总长。一旦它收齐了所有的分片,它便可以将所有片按照正确的顺序(通过分片偏移量)组装起来,并交给上层协议栈。</p><h2 style="color: rgb(0, 0, 0); margin: 1em 0px 0.25em; padding: 0px; overflow: hidden; border-bottom: 1px solid rgb(162, 169, 177); font-size: 1.5em; font-weight: normal; user-select: text !important; font-family: &quot;Linux Libertine&quot;, Georgia, Times, serif; line-height: 1.3;"><span id=".E8.BE.85.E5.8A.A9.E5.8D.8F.E8.AE.AE" style="user-select: text !important;"></span><span class="mw-headline" id="辅助协议" style="user-select: text !important;">辅助协议</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h2><p style="margin: 0.5em 0px; user-select: text !important;">互联网协议定义并激活了<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">网络层</span>,它使用一个逻辑地址系统。IP地址并不以任何永久的方式绑定到硬件,而且事实上一个网络接口可以有许多IP地址。为了正确地交付一份报文,主机和路由器需要其它机制来识别设备接口和IP地址之间的关联。<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">地址解析协议</span>(ARP)为IPv4执行这种IP地址到物理地址(<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">MAC地址</span>)的转换。</p><p style="margin: 0.5em 0px; user-select: text !important;">此外,反向操作有时候也是必须的,比如,一台主机在启动时需要知道自己的IP地址(除非地址已经被管理员预先设置)。目前被用于这一用途的协议有动态主机设置协议(<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">DHCP</span>)、引导协议(<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">BOOTP</span>)和比较不常用的<span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;" class="mw-redirect">RARP</span>。</p><h2 style="color: rgb(0, 0, 0); margin: 1em 0px 0.25em; padding: 0px; overflow: hidden; border-bottom: 1px solid rgb(162, 169, 177); font-size: 1.5em; font-weight: normal; user-select: text !important; font-family: &quot;Linux Libertine&quot;, Georgia, Times, serif; line-height: 1.3;"><span id=".E5.8F.82.E8.A7.81" style="user-select: text !important;"></span><span class="mw-headline" id="参见" style="user-select: text !important;">参见</span><span class="mw-editsection" style="font-family: sans-serif; user-select: text !important; font-size: small; font-weight: normal; margin-left: 1em; vertical-align: baseline; line-height: 1em; unicode-bidi: isolate;"><span class="mw-editsection-bracket" style="user-select: text !important; margin-right: 0.25em; color: rgb(84, 89, 93);">[</span><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important; white-space: nowrap;">编辑</span><span class="mw-editsection-bracket" style="user-select: text !important; margin-left: 0.25em; color: rgb(84, 89, 93);">]</span></span></h2><ul style="list-style-image: url(&quot;/w/skins/Vector/resources/skins.vector.styles/images/bullet-icon.svg?d4515&quot;); margin: 0.3em 0px 0px 1.6em; padding: 0px; user-select: text !important;"><li style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">分类网络</span></li><li style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">无类别域间路由</span></li><li style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">互联网号码分配局</span></li><li style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">已分配的/8 IPv4地址块列表</span></li><li style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">区域互联网注册管理机构</span></li><li style="margin-bottom: 0.1em; user-select: text !important;"><span style="text-decoration: none; color: rgb(11, 0, 128); background: none; user-select: text !important;">各国IPv4位址分配列表</span></li></ul></div></div></div>
页: [1]
查看完整版本: 网际协议版本4缩写:IPv4又称互联网通信协议第四版