<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title><![CDATA[CyberMDNote]]></title> 
<atom:link href="https://cybermdnote.asia/rss.php" rel="self" type="application/rss+xml" />
<description><![CDATA[前端 · Linux · Python · PHP · Docker · VM]]></description>
<link>https://cybermdnote.asia/</link>
<language>zh-cn</language>

<item>
    <title>Web服务</title>
    <link>https://cybermdnote.asia/jisuanji_jichu/40.html</link>
    <description><![CDATA[<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">先记住一句最核心的话</font></h1>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 服务 = 互联网上的 “公共商店 / 展览馆”</font>**</strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你用浏览器逛网站，本质就是：浏览器去访问一个提供 Web 服务的服务器。</font>**</p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 先搞懂：Web 服务到底是个啥？</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 服务的全称就是 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">World Wide Web Service</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，我们平时说的：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">打开百度</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">刷知乎</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">看 B 站</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">登录学校教务系统</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">访问公司后台</font></li>
</ul>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">全部都在使用 Web 服务。</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用最简单的话说：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">有一台</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（远程电脑），它</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一直开着、一直等着别人来访问</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">它上面放着：网页、图片、视频、文字、登录接口</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你用</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（Chrome、Edge、Safari）去找它</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">它把内容发给你看</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这一整套，就叫 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 服务</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 生活类比：Web 服务就像一条 “商业街”</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我用</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">商业街模型</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">贯穿整个 Web 服务讲解，你一下就懂：</font></p>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">互联网 = 整座城市</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 服务器 = 一家店铺 / 门店</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器 = 你这个人</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">域名 / IP = 店铺地址</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTP/HTTPS = 你和店员说话的语言、规则</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网页 = 店铺里的商品、菜单、装修</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">请求（Request）= 你进店问：我要看什么、买什么</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">响应（Response）= 店员拿东西给你</font></strong></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有 Web 服务 = 整条街全是关门的店铺，你啥也看不了。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 再类比：Web 服务 = 学校的公告栏</font></h1>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">学校机房里一台电脑当服务器，开了 Web 服务</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">上面放着：通知、课表、成绩</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你在宿舍用浏览器访问</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就能看到内容</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是最典型的 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">内网 Web 服务</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. 核心问题：没有 Web 服务，我们上网会怎样？</font></h1>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你不能看任何网页</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不能登录任何网站</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不能网购、不能刷视频、不能查资料</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">互联网只剩下：发文件、发邮件、打游戏</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">互联网会直接退回到 30 年前的样子</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 服务是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">现在互联网最主流、使用最多的服务</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，没有之一。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5. Web 服务由几部分组成？（超详细拆解）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">要跑起来一个 Web 服务，必须同时有 4 样东西：</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">① 客户端（你这边）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就是：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Chrome、Edge、Firefox、手机浏览器都算。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">作用：发起请求，展示页面。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：进店买东西的</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">顾客</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">② 服务器（对方那边）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一台 24 小时不关机的电脑。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">可以是：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Linux 服务器（新创服务器、CentOS、Ubuntu）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Windows 服务器</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">店铺的房子 + 场地</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">③ Web 服务器软件（真正提供服务的程序）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器开着还不够，必须跑一个专门的软件，才能提供 Web 服务。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">最常见的三个：</font></p>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Nginx</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（现在企业最火）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Apache</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（经典老牌）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IIS</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（Windows 自带）</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">守店的店员 + 收银台</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑只是房子，软件才是真正接待你的人。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">④ 网页 / 资源文件</font></h2>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTML（骨架）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">CSS（皮肤 / 样式）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">JS（动作 / 交互）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">图片、视频、接口</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">货架上的商品、海报、菜单</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">6. 一次完整的 “打开网页” 过程</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">以你打开 </font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;www.baidu.com&lt;/font&gt;</code><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 为例，我拆成</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">最细步骤</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，让你彻底懂 Web 服务怎么跑。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 0 步：你在浏览器输入网址</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你输入：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;https://www.baidu.com&lt;/font&gt;</code><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">按下回车。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 1 步：浏览器先找 IP（DNS 上场）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器不认识域名，只认识 IP。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">所以先做：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 解析：</font></strong><a href="https://www.baidu.com"><strong><font style="color:rgb(0, 87, 255);background-color:rgba(0, 0, 0, 0);">www.baidu.com</font></strong></a><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> → 对应 IP</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要去百度店铺，先查地址。</font></p>
<h4><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">附；要了解 DNS 服务原理请点击“</font><a href="https://www.yuque.com/g/alpha02/linux/ekst440a6ai05v4x/collaborator/join?token=8z0sjyLWKFSbZXNp&amp;source=doc_collaborator#">DNS-原理详解</a><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 《DNS-原理详解》”</font></h4>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 2 步：浏览器和服务器建立连接</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器拿着 IP 地址，去找到那台服务器。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">然后说：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我要访问你的 Web 服务！”</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器上的 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Nginx/Apache</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 收到消息，回复：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“收到，我开着 Web 服务，可以接待你。”</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这一步叫</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">建立 TCP 连接</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"></font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你走到店门口，敲门，店员开门。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 3 步：浏览器发送 “请求”（Request）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器告诉 Web 服务：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我要访问哪个页面（/ 首页）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用什么协议（HTTP/HTTPS）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我是什么设备（电脑 / 手机）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">要不要带 Cookie（登录状态）</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你进店说：“我要逛一下你们店首页！”</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 4 步：Web 服务器处理请求</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Nginx/Apache 收到后：</font></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">看你要什么页面</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">去服务器硬盘里找对应的 HTML、图片</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">如果是动态页面（比如登录、查成绩），还要去问数据库</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">店员去仓库里找你要的商品。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 5 步：服务器返回 “响应”（Response）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 服务把：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网页代码</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">图片</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">样式</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">文字</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一起打包发给浏览器。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">店员把商品、海报拿给你。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 6 步：浏览器渲染页面</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器收到一堆代码，不会直接给你看源码，</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">而是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">翻译成人能看懂的样子</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">排版、颜色、图片、按钮……</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你看到的百度首页，就出现了。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你把商品拿在手里，看到它的样子。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 7 步：断开连接（或保持连接）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">页面加载完，连接就可以关掉。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">整个 Web 访问完成。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">7. HTTP 和 HTTPS 到底啥区别？（用生活例子讲透）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是 Web 服务最核心的两个协议。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTP：明文传输，不加密</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你和店员</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大声说话</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，路上所有人都能听见。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">别人可以偷听、篡改你说的话。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">特点：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">快</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不安全</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网址显示 </font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;http://&lt;/font&gt;</code></li>
</ul>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS = HTTP + SSL/TLS 加密</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你和店员</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用悄悄话 + 暗号说话</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，别人听见也听不懂。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">特点：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">安全</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">略慢一点</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网址有小锁图标 </font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;https://&lt;/font&gt;</code></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">现在几乎所有网站都是 HTTPS。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">8. 端口号：Web 服务的 “专用门牌号”</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一台服务器可以同时开很多服务：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据库</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">怎么区分？靠</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">端口</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 默认端口：80（HTTP）</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 默认端口：443（HTTPS）</font></strong></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一个大楼里：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">80 号门 → Web 服务（HTTP）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">443 号门 → Web 服务（HTTPS）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">21 号门 → FTP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">22 号门 → SSH</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你访问网页时，默认走 80 或 443，所以不用手动输端口。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">9. 静态网页 vs 动态网页（Web 服务两大类型）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">① 静态网页（Static）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">页面内容写死在 HTML 里，谁访问都一样。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如：纯介绍页面。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">墙上贴死的海报，谁看都一样。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">② 动态网页（Dynamic）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">内容会变，需要查数据库。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">登录后显示你的名字</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">查成绩</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">购物车</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">刷短视频</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">需要后端语言配合：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">PHP、Java、Python、Go 等。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">智能屏幕，每个人登录显示自己的信息。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">10. 你在 “新创服务器 / Linux” 上配置 Web 服务，到底在干嘛？</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你上课做的实验一般是：</font></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">安装 Nginx 或 Apache</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">启动 Web 服务</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">放一个 index.html 到指定目录</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">打开防火墙 80/443 端口</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用浏览器访问服务器 IP，看到页面</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就等于：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">租了个店铺</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">雇了店员（Nginx）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">摆上商品（html）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">开门营业</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">别人就能访问你的网站了。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">11. 作为信息安全专业，Web 服务要重点关注什么？</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击面最大、漏洞最多</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">的地方，这些你后面都会学：</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">① 常见 Web 漏洞</font></h2>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SQL 注入（改数据库）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">XSS 跨站脚本（偷 Cookie）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">文件上传漏洞（传木马）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">弱口令、未授权访问</font></li>
</ul>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">② Web 安全加固</font></h2>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用 HTTPS</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">防火墙限制端口</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">隐藏版本信息</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">过滤恶意请求</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">日志审计</font></li>
</ul>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">③ Web 攻击与防御</font></h2>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DDOS 攻击（把店铺挤爆）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">CC 攻击</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">防盗链、防爬虫</font></li>
</ul>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">12. 超级精简总结</font></h1>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 服务 = 互联网上的公共商店</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器是顾客，Web 服务器（Nginx/Apache）是店员</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">访问流程：输入网址 → DNS 解析 → 建立连接 → 请求 → 响应 → 显示页面</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTP 不加密，HTTPS 加密</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">默认端口：80 (HTTP)、443 (HTTPS)</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">静态页面内容固定，动态页面需要查数据库</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 是互联网最常用服务，也是安全重点防护对象</font></li>
</ul>]]></description>
    <pubDate>Tue, 10 Nov 2026 02:34:56 +0800</pubDate>
    <dc:creator>Alpha_02</dc:creator>
    <guid>https://cybermdnote.asia/jisuanji_jichu/40.html</guid>
</item>
<item>
    <title>VPN原理详解</title>
    <link>https://cybermdnote.asia/39.html</link>
    <description><![CDATA[<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一、先一句话说清：VPN 到底是干嘛的？</font></h1>
<p>:::color1<br />
<strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN = Virtual Private Network虚拟专用网</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">作用就一句话：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">在不安全的公共网络上，建立一条安全、加密、像专线一样的 “秘密通道”。</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你可以把互联网理解成一条</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">人来人往、谁都能偷看的大马路</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN 就是在大马路上给你搭了一条</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">密封、加密、别人看不见里面的专用管道</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<p>:::</p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">二、生活类比：最容易懂的 VPN 解释</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 先把 “互联网” 比作一个现实环境</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我们先统一一个</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大背景例子</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，后面所有原理都用它来讲：</font></p>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">互联网 = 一条人超级多、非常混乱的露天大街</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">谁都能走，谁都能看，谁都能偷听你说话。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你在咖啡店连公共 Wi-Fi = 你站在大街上</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公司内网 = 一个有保安、有围墙、外人进不去的</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">私家大院</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你想从大街安全进入大院 = VPN 要干的事</font></strong></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有 VPN：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你在大街上说话、递纸条，路人都能偷看、抢走、篡改。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">有 VPN：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">给你搭了一条</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">从你脚下直接通到公司大院的封闭地下管道</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，别人看不见、进不来。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. VPN 到底是什么？（用例子一句话说清）</font></h2>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN = 虚拟专用网</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用生活例子翻译：</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大街是公共的，谁都能走。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">但我不想在大街上走，太危险。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">于是我</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">临时修了一条只有我能用的地下秘密通道</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，从我的位置直通公司大门。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这条通道不是真的水泥管道，是 “虚拟” 的，但效果和专用管道一模一样。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是 VPN。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 正常上网（不用 VPN）到底有多危险？（例子详细说）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你在咖啡店，连公共 Wi-Fi，登录学校教务系统。</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你输入：学号 2025001，密码 123456</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这些信息变成数据包，在</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公共 Wi-Fi 里传播</font></strong></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用大街例子类比：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你站在大街上，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大声喊</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我的学号是 2025001，密码是 123456！”</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">周围路人（黑客）全都听见了。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">甚至有人故意拦住你，给你一张</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">假的教务系统纸条</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（钓鱼页面）。</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">抓包窃听</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTP 明文泄露</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 中间人劫持</font></li>
</ul>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不用 VPN = 在大街上裸奔说话。</font></strong></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. 用 VPN 之后，发生了什么？（超详细 + 全程例子）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我把 VPN 完整流程拆成 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">6 步</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，每一步都配生活例子。</font></p>
<hr />
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 1 步：你启动 VPN 客户端</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你拿出手机，呼叫 “管道施工队”</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你对施工队说：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我要建一条</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">从我这里到公司大院</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">的安全通道。”</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">施工队 = VPN 客户端软件</font></p>
<hr />
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 2 步：和 VPN 服务器 “对暗号”（密钥交换）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">施工队和大院保安先对暗号，确认是自己人</font></strong></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你这边：生成一套</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只有你们俩懂的密码本</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大院保安（VPN 服务器）：也生成同样的密码本</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你们约定：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把 “A” 说成 “苹果”</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把 “B” 说成 “香蕉”</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把 “密码” 说成 “水果糖”</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">以后所有话，都用这套暗语说。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">路人就算听见，也完全听不懂。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这一步在技术上叫：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IKE 密钥交换 + 加密协商</font></strong></p>
<hr />
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 身份验证：保安确认你能不能进</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大院保安查你的门禁卡、身份证</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要提供：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">账号密码</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">或者证书</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">或者动态令牌</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">保安问：“你是谁？哪个部门的？”</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你拿出工牌，保安核对后说：“可以，允许建通道。”</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有验证，随便谁都能建通道，公司就炸了。</font></p>
<hr />
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. 建立 “加密隧道”（核心中的核心）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">真的在大街地下，给你修了一条密封管道</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这条管道特点：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">全封闭</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大街上的人看不见里面</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">全加密</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">里面说话全是暗语</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">点对点直达</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">从你脚下 → 公司大院，不经过任何路人</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">技术上叫：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Tunnel 隧道封装</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用更直白的例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你平时说话是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">明信片</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，谁都能看。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">进 VPN 隧道后，你的明信片被装进：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">→ 一层铁皮盒子</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">→ 再加一把密码锁</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">→ 再套一层防水布</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">路人捡到，也打不开、看不懂、拆不开。</font></p>
<hr />
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5. VPN 服务器给你分配一个 “内部身份”</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大院保安给你发了一张 “大院内部通行证”</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你的外网身份：大街上的路人</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">给你分配的内网身份：公司员工 10 号</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">从此以后：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你虽然人还站在大街上</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">但你在网络世界里，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">已经坐在公司办公室里了</font></strong></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你人在咖啡店，但你 “虚拟地” 坐在公司工位。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你访问公司打印机、共享文件夹、教务系统，</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就跟在公司里一样。</font></p>
<hr />
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">6. 所有流量都走这条秘密管道</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你所有说话、递纸条，全部从地下管道走</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你发一条消息：</font></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">本机先加密</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">塞进管道</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">传到公司 VPN 网关</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网关解密</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网关帮你转发到真正的目的地</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">回来的数据同样：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公司 → 加密 → 管道 → 你电脑解密</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大街上的人：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只看到一段看不懂的加密数据流，</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">完全不知道你在访问什么、说什么。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5. 用一个超级形象的例子，把 VPN 彻底讲穿</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：寄信</font></h2>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不使用 VPN</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你把信</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">直接扔在大街上</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，谁都能捡、能看、能改。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">使用 VPN</font></strong>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你把信放进</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">保险箱</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（加密）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">让专人通过</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">专用地下通道</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">送到公司</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公司保安打开保险箱，把信交给收件人</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">回信也走同样通道</font></li>
</ol></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大街上的人：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只看到一个保险箱在移动，不知道里面是什么。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">6. 隧道技术到底是什么？（详细 + 例子）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">隧道 = </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把一个数据包，再套一层数据包</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要送一个小盒子（真实数据），</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你把它放进一个大箱子（隧道外层包），</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大箱子上写着 VPN 服务器的地址。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">中间所有路由器、运营商：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只看到大箱子，看不到里面的小盒子。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">内层：你真正的 IP、访问的网页</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">外层：VPN 隧道的包装</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只有 VPN 服务器能拆开外层箱子。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">7. 加密是什么？</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加密 = </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把正常文字变成乱码，只有密钥能还原</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要说：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;我的密码是123456&lt;/font&gt;</code></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加密后变成：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;xY9$kP2!qR7*sT5&lt;/font&gt;</code></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有密钥，就算截获也完全没用。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN 常用加密：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">AES-256</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ChaCha20</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">可以理解为：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">银行金库级别的锁。</font></strong></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">8. 为什么公共 Wi‑Fi 必须开 VPN？（例子）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公共 Wi-Fi 下：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">黑客可以 ARP 欺骗</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">可以抓包</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">可以劫持网页</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">可以看你所有账号密码</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你在大街上脱衣服走路。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">开 VPN 后：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">黑客即使劫持流量，拿到的也是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加密乱码</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">相当于：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你虽然在街上，但穿了</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">三层防弹衣 + 密封太空服</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">9. VPN 和 HTTPS 的区别（用例子讲清楚）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只给</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器这一个窗口</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加密。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你只把嘴巴捂住，身体还露在外面。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">给你</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">整台电脑所有流量</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加密。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你整个人钻进密封装甲车。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">10. 企业为什么要用 VPN？（真实场景例子）</font></h1>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">员工出差在外，要查公司内部文件</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= 人在大街，要进私家大院</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">分公司和总公司要互相访问共享盘</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= 两个大院之间修一条长期地下通道</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">员工在家办公，连内网服务器</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= 在家修一条直通公司的管道</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是 VPN 最原本、最合法、最正规的用途。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">11. 最简单的终极总结（全班都能记住）</font></h1>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">互联网 = 混乱大街</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公司内网 = 私家大院</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN = 从你脚下直通大院的地下密封管道</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加密 = 说话用暗语，别人听不懂</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">隧道 = 把数据包装进保险箱运输</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">连上 VPN = 人在大街，身份在大院</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">所有流量加密 = 别人看不见、偷不走、改不了</font></strong></li>
</ul>]]></description>
    <pubDate>Tue, 10 Nov 2026 02:34:56 +0800</pubDate>
    <dc:creator>Alpha_02</dc:creator>
    <guid>https://cybermdnote.asia/39.html</guid>
</item>
<item>
    <title>VPN vs HTTPS</title>
    <link>https://cybermdnote.asia/38.html</link>
    <description><![CDATA[<p>:::info</p>
<h1>vpn 和 https 的区别</h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">先给你一个</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一句话核心总结</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，再展开细讲，保证你彻底搞懂：</font></p>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS 是给「单个网站的访问」加了安全锁，只保护你和这个网站之间的路；VPN 是给「你整个手机 / 电脑的所有上网行为」挖了一条专属加密隧道，保护你所有的网络流量。</font></strong></p>
<p>:::</p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一、先分别搞懂：它们到底是什么？</font></h2>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. HTTPS：你和商家之间的「加密悄悄话」</font></h3>
<h4><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">本质是什么？</font></h4>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS = HTTP + SSL/TLS，是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">应用层协议</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，作用是给「你和某个网站服务器之间的通信」做加密、身份认证、防篡改。</font></p>
<h4><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活化比喻：</font></h4>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你去奶茶店点单：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没加密的 HTTP = 你对着店员</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大声喊</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：“我要一杯全糖珍珠奶茶，手机号 138xxxx1234，地址 XX 小区”，周围所有人都能听见、甚至能改你的订单（比如把全糖改成无糖）。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加密的 HTTPS = 你和店员之间</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">拉了一个隔音的小隔间</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，只有你们俩能听见对话，别人听不到内容，也没法改你的订单。</font></li>
</ul>
<h4><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心特点：</font></h4>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只保护</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你和这个网站</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">之间的通信（比如你刷淘宝、登微信、用网银），不保护你其他的上网行为。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">由</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网站服务器</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">提供加密服务，你不用额外装软件，浏览器自动帮你处理。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心目标：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">保护你在这个网站上输入的账号、密码、支付信息不被窃听、篡改</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你手机上的小锁图标（</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">🔒</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">）就是 HTTPS 的标志，代表这个隔间是安全的。</font></li>
</ul>
<hr />
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. VPN：你和「中转站」之间的「专属加密隧道」</font></h3>
<h4><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">本质是什么？</font></h4>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN = Virtual Private Network（虚拟专用网络），是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络层 / 传输层技术</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，作用是给「你所有的网络流量」建立一条从你的设备到 VPN 服务器的加密隧道，再由 VPN 服务器帮你访问互联网。</font></p>
<h4><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活化比喻：</font></h4>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你住在一个小区，平时出门要走小区的公共大路：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不用 VPN = 你走</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公共大路</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，小区保安、路上的监控、邻居都能看到你去哪、带了什么东西、说了什么话。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用 VPN = 你从家里</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">直接打了一条专属的地下加密隧道</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，直通一个安全的中转站（VPN 服务器），你所有的出行（上网流量）都走这条隧道，外面的人完全看不到隧道里的内容，只能看到你连到了这个中转站，不知道你之后去了哪、干了什么。</font></li>
</ul>
<h4><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心特点：</font></h4>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">保护</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你设备上所有的上网行为</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（刷网页、打游戏、用 APP、传文件，全都会走隧道加密）。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">由</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN 服务商 / 企业</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">提供服务，你需要在设备上装 VPN 软件、配置连接。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心目标：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">隐藏你的真实 IP、加密所有流量、绕过网络限制、在公共 Wi-Fi 下保护所有数据安全</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你连 VPN 后，相当于 “换了一个身份上网”，网站看到的是 VPN 服务器的 IP，不是你的真实 IP。</font></li>
</ul>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">二、核心区别对照表</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">表格</font></p>
<table>
<thead>
<tr>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对比维度</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN</font></strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">保护范围</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只保护「单个网站 / 应用的通信」（比如淘宝、网银）</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">保护「设备所有的网络流量」（全设备所有上网行为）</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">工作层级</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">应用层（只针对网页 / APP 的应用通信）</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络层 / 传输层（接管整个设备的网络连接）</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加密对象</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你和网站之间的通信内容</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你所有的网络流量（从你设备到 VPN 服务器的全程）</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">身份隐藏</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不隐藏你的真实 IP，网站能看到你的真实地址</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">隐藏真实 IP，网站只能看到 VPN 服务器的 IP</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">使用方式</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器自动启用，无需额外操作，网站支持就生效</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">需要手动安装 VPN 软件、连接服务器，全程主动开启</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心用途</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">保护网站登录、支付等敏感信息不被窃听 / 篡改</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公共 Wi-Fi 安全、隐藏上网痕迹、绕过网络限制、企业远程办公</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活化比喻</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你和商家的隔音小隔间（只保护这次交易）</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你家到中转站的专属加密隧道（保护你所有出行）</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">是否能防中间人攻击</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">能（验证网站身份，防窃听 / 篡改）</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">能（加密隧道防窃听，但需信任 VPN 服务商）</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">是否需要付费</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">完全免费（网站部署后用户免费使用）</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">多数优质 VPN 需要付费（免费 VPN 有安全风险）</font></td>
</tr>
</tbody>
</table>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">三、用「生活场景」彻底区分，再也不混淆</font></h2>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景 1：你在咖啡馆连公共 Wi-Fi</font></h3>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只开 HTTPS：你刷淘宝、登网银时，这些网站的通信是安全的（小锁</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">🔒</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生效），但你手机上其他 APP 的流量（比如后台更新、聊天软件）是明文的，黑客能在公共 Wi-Fi 上窃听这些流量，甚至给你推送广告、劫持 DNS。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">开 VPN+HTTPS：你所有的流量都走加密隧道，黑客在公共 Wi-Fi 上只能看到你连了 VPN，完全看不到任何内容，所有 APP、所有网站的通信都被双重保护，绝对安全。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景 2：你要访问一个国外的学习网站</font></h3>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只开 HTTPS：网站本身是 HTTPS 加密的，但如果国内网络限制访问，你根本连不上这个网站，HTTPS 再安全也没用。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">开 VPN：VPN 帮你把流量转发到国外的服务器，绕过网络限制，你就能正常访问，同时访问过程全程加密。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景 3：你要隐藏自己的上网痕迹</font></h3>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只开 HTTPS：你的运营商、公司网管能看到你访问了哪个 HTTPS 网站（比如能看到你访问了淘宝，但看不到你买了什么），你的真实 IP 也会被网站记录。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">开 VPN：运营商、网管只能看到你连了 VPN 服务器，看不到你访问了什么网站；网站只能看到 VPN 服务器的 IP，看不到你的真实 IP，彻底隐藏痕迹。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景 4：企业员工远程办公</font></h3>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只开 HTTPS：员工只能访问企业的 HTTPS 网站，无法访问企业内部的文件服务器、办公系统（这些不是网页服务）。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">开企业 VPN：员工的所有流量都连到企业内网，能像在办公室一样访问所有内部资源，全程加密，防止数据泄露。</font></li>
</ul>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">四、新手最容易搞混的 3 个问题，一次性讲透</font></h2>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 用了 HTTPS，还需要 VPN 吗？</font></h3>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">分情况：</font></strong></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">在家用自己的安全 Wi-Fi，只刷普通网站、网购：HTTPS 足够用，不需要 VPN。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">在公共 Wi-Fi（咖啡馆、机场、酒店）上网，或者需要隐藏 IP、绕过限制：必须用 VPN，HTTPS 保护不了你的全设备流量。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">两者不是替代关系，是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">互补关系</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：最好的安全状态是「VPN+HTTPS」双重加密，就像你走专属隧道，还在隧道里和商家拉了隔音隔间，双重安全。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. VPN 能代替 HTTPS 吗？</font></h3>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">绝对不能！</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN 只加密了你到 VPN 服务器的流量，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN 服务器到目标网站的流量是明文的</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（除非网站本身用 HTTPS）。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">举个例子：你用 VPN 访问一个 HTTP 的钓鱼网站，VPN 保护了你到 VPN 服务器的流量，但 VPN 服务器到钓鱼网站的流量是明文的，你的账号密码还是会被钓鱼网站窃取，而且 VPN 也没法验证网站的身份，没法防钓鱼。</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS 的核心作用之一是「验证网站的真实身份」，防止你访问钓鱼网站，这是 VPN 完全做不到的。</font></strong></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 浏览器的小锁</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">🔒</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，是 VPN 的标志吗？</font></h3>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">完全不是！</font></strong></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">小锁</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">🔒</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">是 HTTPS 的标志，代表你和这个网站的通信是加密的，和 VPN 无关。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN 的标志是你设备状态栏里的 VPN 图标（比如</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">🔐</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">、VPN 字样），代表你所有流量走了加密隧道。</font></li>
</ul>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">五、给信息安全专业新生的补充知识点</font></h2>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 技术原理上的本质区别</font></h3>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：基于 SSL/TLS 协议，在应用层对 HTTP 数据进行加密，使用数字证书验证服务器身份，采用对称加密 + 非对称加密的混合加密方式，保证通信的机密性、完整性、身份认证。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：常见的有 IPsec（网络层）、OpenVPN（传输层）、WireGuard 等协议，在网络层 / 传输层对 IP 数据包进行封装加密，建立端到端的隧道，实现远程访问和数据加密。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 安全风险的区别</font></h3>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS 的风险</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：证书伪造（钓鱼网站）、证书链漏洞、SSL 剥离攻击等，核心风险是「网站身份被冒充」。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN 的风险</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：VPN 服务商本身不可信（窃取用户数据）、VPN 服务器被攻击、免费 VPN 的恶意软件等，核心风险是「信任第三方服务商」。</font></li>
</ul>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">六、最后用一个超简单的比喻收尾，帮你永久记住</font></h2>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS = 你和朋友打电话时用了只有你们俩懂的暗语</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：只保护你们俩的通话内容，别人听不懂，但别人能看到你给这个朋友打了电话。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">VPN = 你给电话装了加密线路</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：不仅通话内容没人能听懂，连你给谁打电话、打了多久，外面的人都完全看不到，只能看到你连了一个加密线路。</font></li>
</ul>]]></description>
    <pubDate>Tue, 10 Nov 2026 02:34:56 +0800</pubDate>
    <dc:creator>Alpha_02</dc:creator>
    <guid>https://cybermdnote.asia/38.html</guid>
</item>
<item>
    <title>UDP传输协议</title>
    <link>https://cybermdnote.asia/jisuanji_jichu/37.html</link>
    <description><![CDATA[<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一、先一句话把 UDP 说死（最本质）</font></h1>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP = 用户数据报协议</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一句话本质：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 就是 “发快递不签收、不保证送到、不保证顺序、不建立连接” 的网络传输协议。</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对比 TCP：</font></p>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP = 打电话</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（必须接通、不能漏、不能乱、丢了重发）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP = 寄平信 / 广播喊话</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（扔出去就不管，丢了就丢了）</font></li>
</ul>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">二、最形象的生活例子（贯穿全文）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我们把网络传输比作 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“给别人发纸条”</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP 像什么？</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">像 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">两个人打电话</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">先拨号（三次握手）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对方接了才说话</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">每说一句对方都要 “嗯” 一声回应</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">断了会重连</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">说完要挂电话（四次挥手）</font></li>
</ol>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 像什么？</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">像 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你站在楼上，往楼下人群里扔纸条</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你不打招呼</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不看对方在不在</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不确认对方有没有接住</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">扔下去就完事</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">被风吹走、被别人捡走、掉水里，你都不管</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你连续扔 1、2、3 张，对方可能先接到 3，再接到 1</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">三、UDP 的 5 大核心特点（每条都配例子）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">无连接（不需要握手）</font></strong></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 发送数据前，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不建立任何连接</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">想发就发，拿起来就发。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要喊话，不需要先 “喂喂喂” 确认，直接吼就行。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对比 TCP：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">必须先三次握手建立连接，才能发数据。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不可靠（不保证送达，不重传）</font></strong></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 发出去，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">丢了就丢了，不会重发</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有确认机制，没有重传机制。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你扔纸条，被风吹走了，你不会再扔一张。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不管顺序（乱序不管）</font></strong></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你发：数据包 1 → 数据包 2 → 数据包 3</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对方可能收到：3 → 1 → 2</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不会重新排序</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，收到啥就是啥。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你扔三张纸条：“我”“爱”“你”</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">楼下可能捡到顺序是：“你”“我”“爱”</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 不会帮你整理。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有拥塞控制（不管网络堵不堵）</font></strong></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络堵车了，UDP 照样疯狂发。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不会像 TCP 那样减速。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">马路堵死了，TCP 会停车等；</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 直接硬挤，堵死也继续发。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5. </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">开销极小、速度极快</font></strong></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 头部只有 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">8 个字节</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP 头部最少 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">20 个字节</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 少了大量确认、重传、排序逻辑，所以</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">极快</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">四、UDP 报文结构</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 报文非常简单，就两部分：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 头部（8 字节）</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据内容</font></strong></li>
</ol>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">头部 4 个字段</font></h2>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">源端口</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（你是谁）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">目的端口</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（发给谁）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">长度</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（整个数据包多长）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">校验和</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（简单检查数据有没有损坏）</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">序号</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">确认号</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">窗口大小</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">标志位（SYN/ACK/FIN 等）</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">所以它</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">简单到极致</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">五、UDP 完整发送流程（一步一步讲）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 应用程序把数据给 UDP</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如：游戏要发一个 “我开枪了” 的指令</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. UDP 加上 8 字节头部</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不握手、不连接、不等待。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 直接交给网络层（IP 层）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">打包成 IP 包，直接扔到网络里。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. 网络传输</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">可能丢、可能乱、可能延迟。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5. 对方 UDP 收到</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">直接交给应用程序，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不回 ACK、不确认、不重传</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">结束。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对比 TCP：要握手、确认、重传、排序、挥手…… 流程复杂 10 倍。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">六、为什么要用 UDP？既然不可靠，为什么还存在？</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">因为</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">有些场景，速度比可靠性更重要！</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我给你逐一场景讲细：</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景 1：游戏（王者荣耀、CS、吃鸡）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你移动、开枪、跳跃，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">必须实时</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">如果用 TCP：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">丢一个包 → 重传</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">延迟变大 → 你角色瞬移、卡顿</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用 UDP：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">偶尔丢包无所谓</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">下一帧数据立刻跟上</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">流畅最重要</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你挥一刀，网络卡了一下，指令丢了。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 不会重发，你直接挥下一刀就行。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">如果用 TCP，你会卡 0.5 秒，直接被打死。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景 2：直播、视频通话（抖音、微信电话、会议）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">视频画面偶尔卡顿、花屏一下没关系，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不能等</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">如果丢包重传，画面会卡住不动。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 方案：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">丢了就丢了，直接播放下一帧，人感觉不出来。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你视频聊天，偶尔卡顿一下，不影响聊天。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">如果非要等重传，画面会定住，更难受。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景 3：DNS 域名解析</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你访问 </font><a href="https://baidu.com"><font style="color:rgb(0, 87, 255);background-color:rgba(0, 0, 0, 0);">baidu.com</font></a><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，要查 IP。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 就是用 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 53 端口</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">为什么？</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">快</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据极小</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">丢了就再发一次，成本极低</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你问路人 “百度在哪？”</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">路人没听见，你再问一次就行，不需要打电话。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景 4：DHCP（自动获取 IP）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你连 Wi-Fi，自动获得 IP 就是 DHCP，用 UDP。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">因为还没 IP，无法建立 TCP 连接。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景 5：在线语音（微信语音、游戏语音）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">语音讲究实时性，丢一两帧无所谓。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">七、UDP 与 TCP 详细对比（最清晰版本）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">表格</font></p>
<table>
<thead>
<tr>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">特点</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP</font></strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">是否连接</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">无连接</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">面向连接（三次握手）</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">可靠性</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不可靠，丢包不重传</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">可靠，丢包必重传</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">顺序</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不保证顺序</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">保证顺序，自动重排</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">速度</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">极快</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">较慢</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">头部大小</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">8 字节</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">最少 20 字节</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">流量控制</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">无</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">有</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">拥塞控制</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">无</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">有</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">适用场景</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">游戏、直播、DNS、语音</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网页、文件、邮件、数据库</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活类比</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">扔纸条、喊话、广播</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">打电话、挂号信、快递</font></td>
</tr>
</tbody>
</table>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">八、UDP 有什么安全问题？（信息安全专业重点）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 因为</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">简单、无验证、无连接</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，非常容易被攻击。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. UDP Flood 攻击（UDP 洪水）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击者发送大量伪造 UDP 包，把服务器带宽占满，导致瘫痪。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一个人疯狂往你家扔废纸，把家门堵死。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. DNS 放大攻击（最常见的 DDoS）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击者伪造源 IP，向 DNS 服务器发小包，DNS 回大包。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">流量被放大几十倍，打垮目标。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 端口扫描</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP 端口扫描很难防御，因为没有回应也能判断端口状态。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. 容易被劫持、注入</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">因为没有连接状态，黑客容易伪造 UDP 包。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">九、哪些常用协议用 UDP？</font></h1>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（53 端口）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（67/68 端口）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">游戏协议</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">直播 / 视频通话</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">RTP 实时传输</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TFTP 简单文件传输</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">QUIC（新一代 HTTP/3 底层就是 UDP）</font></strong></li>
</ul>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">十、超级总结</font></h1>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP = 无连接、不握手、不确认、不重传、不排序</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">速度极快，开销极小</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不可靠，但实时性强</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">适合：游戏、直播、语音、DNS、DHCP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">扔纸条、喊话、广播</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对比 TCP：TCP 是打电话，UDP 是街头喊话</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">安全问题：易被 Flood 攻击、放大攻击</font></li>
</ul>]]></description>
    <pubDate>Tue, 10 Nov 2026 02:34:56 +0800</pubDate>
    <dc:creator>Alpha_02</dc:creator>
    <guid>https://cybermdnote.asia/jisuanji_jichu/37.html</guid>
</item>
<item>
    <title>TCP三次握手</title>
    <link>https://cybermdnote.asia/jisuanji_jichu/36.html</link>
    <description><![CDATA[<p>:::info</p>
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">先记住一句最核心的话</font></h1>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP 三次握手，就是客户端和服务器在正式传输数据之前，先互相确认：</font>**</strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“你能收到我吗？我能收到你吗？咱俩收发都正常吗？”</font>**</p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">它的目的只有一个：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">建立一个可靠的连接，保证数据不会乱发、丢包、发错。</font></strong></p>
<p>:::</p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 先搞懂：TCP 是什么？</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你可以简单理解：</font></p>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：可靠传输协议，像</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">打电话</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，必须先接通，再说话，不会漏话。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：不可靠，像</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">喊话</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，喊完拉倒，听不听得到不管。</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我们上网、打开网页、登录、发消息，几乎都用 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，所以必须先握手。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 生活最强比喻：两个人隔空喊话</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你站在山这边（</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端 Client</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">）</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">朋友站在山那边（</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器 Server</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">）</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你们距离很远，必须喊话才能听见。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你们要确认三件事：</font></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你能喊到他</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">他能喊到你</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">双方听力、嗓门都没问题</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是三次握手。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 正式开始：三次握手详细拆解</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我先把专业名字给你，后面全部翻译成大白话：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端 → 服务器：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SYN</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器 → 客户端：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SYN + ACK</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端 → 服务器：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ACK</font></strong></li>
</ul>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第一次握手：你 → 朋友（SYN）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你对着山那边大喊：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“喂！你听得见我说话吗？”</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">含义：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端告诉服务器：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我想和你建立连接。</font></strong></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SYN</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（同步序列编号）</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第二次握手：朋友 → 你（SYN + ACK）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">朋友听见了，大喊两句：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我听见你了！</font>**</strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">那你听得见我说话吗？”</font>**</p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">含义：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ACK</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：我收到你的请求了</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SYN</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：现在换我问你，你能不能收到我</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">所以是 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SYN+ACK</font></strong></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第三次握手：你 → 朋友（ACK）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你听见朋友的声音，大喊：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我也能听见你！好了，我们可以开始聊天了！”</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">含义：</font></p>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ACK</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：我也收到你的回应了</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">双方确认：收发都正常</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">连接正式建立</font></li>
</ul>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. 为什么必须是 3 次？为什么不能 2 次？</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是面试必考、新手最疑惑的点，我用最简单的话讲明白：</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">如果只有 1 次握手</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你喊一声，对方听没听见你完全不知道。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">→ 不可靠</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">如果只有 2 次握手</font></h2>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你喊：听得见吗？</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对方喊：听得见。</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">看起来好像可以，但有巨大问题：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你不知道对方能不能听见你！</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对方可能只是随便回了一句，</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你根本不确定他是否真的收到。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">而且网络上会有</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">延迟的旧包</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">两次握手会导致服务器建立无效连接，浪费资源。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3 次才刚好</font></h2>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你 → 他：我能发</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">他 → 你：你能发，而且我也能发</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你 → 他：你也能发，我也收到了</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">→ </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">双方收发能力全部确认完毕</font></strong></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5. 用 “打电话” 再讲一遍</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你（客户端）给 服务器（朋友）打电话：</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第一次握手</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你：“喂？”</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（我能说话，信号发出去了）</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第二次握手</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">朋友：“喂，我听得见，你听得见我吗？”</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（我收到你了，现在我说话，看你收不收得到）</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第三次握手</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你：“嗯，听得见！”</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（我也收到你了，通话正常建立）</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">然后才开始聊天。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP 三次握手</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">6. 专业版极简总结（考试 / 实验用）</font></h1>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第一次握手</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端发送 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SYN</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 包到服务器</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">→ 我要连接</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第二次握手</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器回复 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SYN+ACK</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">→ 同意连接，同时问你收得到我吗</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第三次握手</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端回复 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ACK</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">→ 收到，连接建立成功</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">之后就可以</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">传输数据</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">7. 连接用完了怎么办？还有四次挥手</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">建立连接是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">三次握手</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">断开连接是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">四次挥手</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">简单说就是：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我要挂了</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">知道了</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我也挂了</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">好的</font></li>
</ul>]]></description>
    <pubDate>Tue, 10 Nov 2026 02:34:56 +0800</pubDate>
    <dc:creator>Alpha_02</dc:creator>
    <guid>https://cybermdnote.asia/jisuanji_jichu/36.html</guid>
</item>
<item>
    <title>OSI七层模型</title>
    <link>https://cybermdnote.asia/jisuanji_jichu/35.html</link>
    <description><![CDATA[<h3>了解 OSI 模型原理之前看一下七个层的作用</h3>
<p>:::info<br />
<strong><font style="color:rgba(0, 0, 0, 0.8);">OSI模型</font></strong><font style="color:rgba(0, 0, 0, 0.8);">（开放系统互联模型）是国际标准化组织（ISO）制定的一个用于计算机或通信系统间互联的标准体系。它将网络通信过程分为七个层次，每个层次都有特定的功能和协议。</font></p>
<p><font style="color:rgb(0, 0, 0);">七层模型的各层次</font></p>
<ol>
<li><strong><font style="color:rgba(0, 0, 0, 0.8);">物理层</font></strong><font style="color:rgba(0, 0, 0, 0.8);">：负责在物理介质上传输比特流，包括电压、电缆、连接器等物理特性。它定义了机械和电气规范，如电压水平、传输速率和物理连接器。</font></li>
<li><strong><font style="color:rgba(0, 0, 0, 0.8);">数据链路层</font></strong><font style="color:rgba(0, 0, 0, 0.8);">：负责建立逻辑连接、硬件地址寻址、差错校验等功能。它将比特组合成帧，并通过MAC地址访问介质。</font></li>
<li><strong><font style="color:rgba(0, 0, 0, 0.8);">网络层</font></strong><font style="color:rgba(0, 0, 0, 0.8);">：负责逻辑地址寻址和路径选择，实现不同网络之间的通信。常见协议有IP（IPv4、IPv6）、ICMP等。</font></li>
<li><strong><font style="color:rgba(0, 0, 0, 0.8);">传输层</font></strong><font style="color:rgba(0, 0, 0, 0.8);">：定义传输数据的协议端口号，负责数据的分段和重组，确保数据可靠传输。常见协议有TCP和UDP。</font></li>
<li><strong><font style="color:rgba(0, 0, 0, 0.8);">会话层</font></strong><font style="color:rgba(0, 0, 0, 0.8);">：负责建立、管理和终止会话，确保不同机器上的用户之间的通信。常见协议有SSL和TLS。</font></li>
<li><strong><font style="color:rgba(0, 0, 0, 0.8);">表示层</font></strong><font style="color:rgba(0, 0, 0, 0.8);">：负责数据的表示、安全和压缩，如加密解密、格式转换等。常见格式有JPEG、ASCII等。</font></li>
<li><strong><font style="color:rgba(0, 0, 0, 0.8);">应用层</font></strong><font style="color:rgba(0, 0, 0, 0.8);">：提供网络服务与最终用户的接口，支持各种应用程序协议，如HTTP、FTP、SMTP等。</font></li>
</ol>
<p>:::</p>
<p>对于刚接触的人来说可能会看不懂，但没关系，下面将一一介绍每个层的功能、用途及原理</p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一、为什么会有两个模型？（核心区别）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">在讲具体内容前，先搞懂它们的关系：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">OSI 七层模型</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">理论标准</font></strong>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">由国际标准化组织（ISO）制定</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">目的：想制定一个全世界通用的网络标准</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">缺点：太完美、太复杂，实际落地太难（像理想中的乌托邦）</font></li>
</ul></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP/IP 五层模型</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">实战产物</font></strong>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">由美国国防部（DARPA）为了互联网诞生制定</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">目的：简单、实用、能跑起来</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">现状：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">真正的互联网标准</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，我们平时说的网络分层，基本都指这个</font></li>
</ul></li>
</ol>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">划重点</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：OSI 是 “理论图纸”，TCP/IP 是 “实际施工图”。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">但考试、学习、理解原理时，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">七层模型更适合细分知识点</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，五层模型更适合理解整体流程。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">二、核心概念：什么是 “分层模型”？</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络通信是一个超级复杂的过程，如果把所有功能堆在一起，代码会写成一坨屎，维护也没法维护。</font></p>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">分层的逻辑</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">每个人只做自己的事，各司其职，最后配合完成整体任务。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像你要寄一个快递：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：打包好东西，写好地址（应用层）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">快递员</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：拿快递，运到站点（传输层 / 网络层）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">物流车</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：把快递运到城市（网络层 / 数据链路层）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">分拣中心</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：按目的地分发（数据链路层）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">快递员派送</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：送到家门口（物理层）</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络通信也是这样，每一层都只负责一层的工作，互不干扰。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">三、第一部分：OSI 七层模型（理论总纲，详细拆解）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">OSI 把网络通信拆成了</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">7 层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，从下往上是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">物理传输</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">到</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用户交互</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我按</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">从下往上</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">的顺序，用</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活例子</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">详细讲每一层：</font></p>
<p><img src="https://cdn.nlark.com/yuque/0/2026/png/58876841/1775287750217-b2568f0b-35f4-4c6d-b0a9-efefe4723e66.png" alt="" /></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 1 层：物理层（Physical Layer）——“快递卡车与公路”</font></h3>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心作用</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：负责</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">物理信号</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">的传输（0 和 1 的传输）。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">通俗理解</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不管是网线、光纤、无线电波，都是在这一层干活。它不关心数据是什么，只关心 “电流的高低”、“光信号的闪灭”、“无线电波的有无”。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活例子</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">快递卡车和公路</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。卡车负责把包裹运过去，但卡车不知道包裹里是什么，它只负责运输。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">设备 / 介质</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：网线（双绞线）、光纤、网卡（部分）、集线器（Hub）。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">信安视角</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：这一层最容易被物理攻击，比如干扰信号、切断网线、无线电干扰。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 2 层：数据链路层（Data Link Layer）——“快递单与车牌号”</font></h3>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心作用</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：在</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">相邻节点</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">之间传输数据，建立同一个局域网内的连接。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">关键概念</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">MAC 地址</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（物理地址）。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">通俗理解</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">它负责把数据封装成 “帧”，加上 “源 MAC” 和 “目的 MAC”。只有同一个局域网（同一批卡车跑同一条路）的设备能互相识别。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要把快递交给隔壁老王，必须知道老王的 “身份证号”（MAC）。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">设备</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：交换机（Switch）、网桥。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">信安视角</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这一层是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">局域网攻击的重灾区</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">！</font>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你之前学的 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 欺骗</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 就在这一层！</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">MAC 地址漂移、VLAN 跳跃攻击都发生在这。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">交换机的 MAC 地址表满了（CAM 表溢出）会变成 “集线器模式”，导致广播风暴。</font></li>
</ul></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 3 层：网络层（Network Layer）——“物流中心与地图导航”</font></h3>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心作用</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">跨网络</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">的路由与寻址，找到最佳路径。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">关键概念</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP 地址</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">、</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">路由表</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">、</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网关</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">通俗理解</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">物理层只管卡车运货，网络层管</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">怎么从北京运到美国</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。它负责给数据包打上 “源 IP” 和 “目的 IP”，查路由表决定走哪条路。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像快递的</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">物流中心</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，决定这个包裹走哪条航线、哪条铁路。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">设备</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：路由器（Gateway）、三层交换机。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">信安视角</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是网络安全的</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第一道防线</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">！</font>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">防火墙主要工作在这一层（及四层），做 IP 包过滤。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP 欺骗、ICMP 重定向攻击都发生在这。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">NAT（网络地址转换）也在这。</font></li>
</ul></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 4 层：传输层（Transport Layer）——“快递保价与分拆”</font></h3>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心作用</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：端到端（进程到进程）的通信，负责</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据的可靠性</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">与</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">流量控制</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">关键概念</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">端口号</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">、TCP、UDP。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">通俗理解</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据太大了，要拆分成 “报文” 或 “段”。同时保证数据不丢、不乱序。</font>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP = 打电话（可靠，丢了重传）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">UDP = 发广播（快，丢了不管）</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">给快递保价</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，如果包裹碎了，快递员要赔偿；或者</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">分包裹</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，一个大件拆成几个小件送。</font></li>
</ul></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">设备</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：负载均衡器、防火墙（识别端口）。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">信安视角</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击最密集</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">的一层！</font>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP 三次握手 / 四次挥手</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">的状态监听。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SYN Flood</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 拒绝服务攻击（占满连接池）。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">端口扫描（Nmap）就是扫这一层的端口。</font></li>
</ul></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 5 层：会话层（Session Layer）——“建立通话连接”</font></h3>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心作用</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：建立、管理和终止表示层实体之间的通信会话。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">通俗理解</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">它负责确认 “你和服务器是不是连上了”，并且给会话做个标记。如果断开了，它知道怎么恢复会话。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活例子：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">建立微信通话</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，接通后保持连接，中途断了自动重连。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">信安视角</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">会话劫持（Session Hijacking）攻击就在这一层，偷取你的 Session ID，冒充你登录。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 6 层：表示层（Presentation Layer）——“快递包装与翻译”</font></h3>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心作用</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：数据的格式转换、加密、解密、压缩、解压。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">通俗理解</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器发过来的是乱码？还是图片？还是加密文件？表示层负责翻译成你能看懂的格式，或者把你的数据加密打包。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活例子：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把信件翻译成密码本</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，或者</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把视频文件压缩</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">信安视角</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加密攻防</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">的核心！</font>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS 的 TLS/SSL 加密就在这一层（或者说介于 5-7 层之间）。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据加密 / 解密、编码转换（Base64）都在这发生。</font></li>
</ul></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 7 层：应用层（Application Layer）——“用户界面与软件”</font></h3>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心作用</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：直接为</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用户应用软件</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">提供服务。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">关键概念</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：HTTP、FTP、DNS、SMTP、Telnet。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">通俗理解</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是你能看到的所有软件：浏览器（Chrome）、微信、迅雷、FTP 客户端。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活例子：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你打开淘宝 APP 下单</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，这个 APP 就是应用层。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">设备</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：服务器、防火墙（应用层防火墙 WAF）。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">信安视角</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">黑客攻击的主战场</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">！</font>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SQL 注入、XSS 跨站脚本、CSRF、文件上传漏洞…… 全部都在这一层。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Web 安全（Web 渗透）基本都在搞这一层。</font></li>
</ul></li>
</ul>
<p><img src="https://cdn.nlark.com/yuque/0/2026/png/58876841/1775287770634-ff00d7cd-38af-4696-b028-0994f211b3b3.png" alt="" /></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">四、第二部分：TCP/IP 五层模型（实战逻辑，重点）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">因为 OSI 太细，实际互联网只用了</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP/IP 五层模型</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">它把 OSI 的</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">会话层、表示层、应用层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">合并成了</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">应用层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP/IP 五层模型对照表（建议截图保存）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">表格</font></p>
<table>
<thead>
<tr>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP/IP 五层</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对应 OSI 七层</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心功能</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对应协议 / 设备</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活类比</font></strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5. 应用层</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5+6+7 层</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">给用户提供服务</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTP,FTP,DNS,SMTP</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">淘宝 APP、浏览器</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. 传输层</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4 层</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">端到端通信，可靠 / 不可靠</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">TCP,UDP, 端口</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">快递分拆 / 保价</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 网络层</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3 层</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">跨网络路由，IP 寻址</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP,ICMP, 路由协议</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">物流中心导航</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 数据链路层</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2 层</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">局域网通信，MAC 寻址</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP,MAC, 交换机</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">快递单 / 车牌号</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 物理层</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1 层</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">物理信号传输（0/1）</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网线，光纤，Hub</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">卡车 / 公路</font></td>
</tr>
</tbody>
</table>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">五、灵魂拷问：数据包是怎么通过五层模型传输的？（封装与解封装）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是理解网络最核心的一步！</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 发送端：封装过程（从上层往下包）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">当你在浏览器点击 “发送” 时，数据是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">从头顶往下裹一层又一层的 “快递包装”</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">应用层（数据 Data）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你的浏览器生成一段文字：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;Hello Server&lt;/font&gt;</code></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">传输层（添加头部）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加上 TCP 头（包含端口号），变成</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">段 (Segment)</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络层（添加头部）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加上 IP 头（包含 IP 地址），变成</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">包 (Packet)</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据链路层（添加头部 + 尾部）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加上 MAC 头（包含 MAC 地址）和 FCS 尾，变成</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">帧 (Frame)</font></strong></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">物理层（转成比特流）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把帧变成</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电流 / 光波 / 无线电波</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，发射出去！</font></li>
</ol>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 接收端：解封装过程（从下层往上拆）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器收到信号，是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一层层拆包装</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">物理层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把电流 / 光波转成二进制数据，还原出</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">帧</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据链路层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">检查 MAC 地址是不是我的？</font>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">是我的 → 剥掉 MAC 头，取出</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">包</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不是 → 丢弃</font></li>
</ul></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">检查 IP 地址是不是我的？</font>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">是我的 → 剥掉 IP 头，取出</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">段</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不是 → 丢弃</font></li>
</ul></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">传输层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">检查端口号是不是对应服务？</font>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">是 → 剥掉 TCP 头，取出</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据</font></strong></li>
</ul></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">应用层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器软件（比如 Nginx）处理数据，返回结果。</font></li>
</ol>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心总结</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">发送端是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">从上往下打包</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，接收端是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">从下往上拆包</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">每一层只处理自己头上的头，看不见下面的内容。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">六、信安专业视角：为什么分层模型这么重要？</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">作为信息安全学生，我们为什么要背这两个模型？因为</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击手段就是按分层来的！</font></strong></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 攻击分层对照表</font></h3>
<table>
<thead>
<tr>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击类型</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对应层级</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击原理</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">防御手段</font></strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 欺骗</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据链路层 (二层)</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">伪造 MAC，篡改 ARP 缓存</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">交换机 DAI、IP-MAC 绑定</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SYN Flood</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">传输层 (四层)</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">耗尽服务器连接资源</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">防火墙防 syn、WAF 防护</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP 欺骗 / DDOS</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络层 (三层)</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">伪造源 IP 攻击、流量耗尽</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">防火墙 ACL 过滤、黑洞清洗</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTP 劫持 / 钓鱼</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">应用层 (七层)</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">篡改网页、插入恶意代码</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">HTTPS 加密、WAF 防护</font></td>
</tr>
<tr>
<td><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">会话劫持</font></strong></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">会话层 (五层)</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">偷取 cookie/session</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">加密 cookie、session 过期机制</font></td>
</tr>
</tbody>
</table>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 防火墙的工作原理（分层防护）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你列表里有</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">防火墙原理详解</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，防火墙就是按分层工作的：</font></p>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">包过滤防火墙</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：工作在</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络层 / 传输层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。只看 IP 和端口，快但笨。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">应用层防火墙（WAF）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：工作在</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">应用层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。能看懂网页代码，防 SQL 注入，慢但精准。</font></li>
</ul>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">七、终极总结：一句话记住每个层级</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">给你们班同学整理的</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">背诵版口诀</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，考试必考：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">物理层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：看电流，传 01（管硬件）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据链路层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：查 MAC，传局域网（管 ARP、交换机）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：定路由，找 IP（管网关、路由器）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">传输层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：分端口，连进程（管 TCP/UDP、端口）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">应用层</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：给用户，用软件（管 HTTP、FTP、浏览器）</font></li>
</ol>]]></description>
    <pubDate>Tue, 10 Nov 2026 02:34:56 +0800</pubDate>
    <dc:creator>Alpha_02</dc:creator>
    <guid>https://cybermdnote.asia/jisuanji_jichu/35.html</guid>
</item>
<item>
    <title>FTP文件传输协议--原理详解</title>
    <link>https://cybermdnote.asia/jisuanji_jichu/34.html</link>
    <description><![CDATA[<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一、FTP 到底是什么？一句话先懂</font></h1>
<p>:::info<br />
<strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP = File Transfer Protocol</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">中文：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">文件传输协议</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">作用只有一个：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">在两台计算机之间，可靠地传文件（上传、下载）。</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像现实生活里：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要把文件从电脑 A 发给电脑 B</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不能直接隔空扔</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">必须有一套 “怎么传、怎么连、怎么确认收到” 的规则</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这套规则就是 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></li>
</ul>
<p>:::</p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">二、生活类比：FTP 就像 “快递站 + 快递员”</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我给你一个最形象的比喻，全班都能秒懂：</font></p>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP 服务器</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> = 快递总站（存放所有文件的地方）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP 客户端</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> = 寄件人 / 取件人（你的电脑）</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用户名 + 密码</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> = 进入快递站的门禁卡</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">上传文件</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> = 把包裹寄到总站</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">下载文件</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> = 从总站取包裹</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP 协议</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> = 快递行业统一的运输规则</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要传文件，必须：</font></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">找到服务器地址</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">登录</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">选择上传 / 下载</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器确认、传输、完成</font></li>
</ol>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">三、FTP 的核心角色：客户端 vs 服务器</font></h1>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. FTP 服务器（Server）</font></h3>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">24 小时开机等着别人连</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">存储文件</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">验证账号密码</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">控制权限：谁能看、谁能删、谁能上传</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">常见的服务器软件：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">vsftpd（Linux 最常用）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FileZilla Server</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IIS 自带 FTP</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. FTP 客户端（Client）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你的电脑 / 手机</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，用来连接服务器。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">常见客户端：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FileZilla</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Xftp</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">WinSCP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">浏览器（输入 ftp://...）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">命令行（ftp 命令）</font></li>
</ul>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">四、FTP 最关键的知识点：两个端口！（必考必懂）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP 非常特殊：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">它用两个端口同时工作</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是新手最容易懵的地方，我讲得超级细。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 命令端口（21 号端口）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">作用：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">发指令、聊天</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">登录</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">切换目录</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">查看文件列表</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">告诉服务器 “我要下载 xxx 文件”</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你打电话给快递站 → </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">21 端口</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你说：我要取 3 号包裹 → 这就是命令</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 数据端口（20 号端口 或 随机端口）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">作用：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">真正传文件内容</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">图片、压缩包、文本…… 所有数据都走这里。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">类比：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">快递员开车把包裹送过来 → </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">数据端口</font></strong></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">五、FTP 的两种模式（超级重要）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP 有两种工作模式，区别在于</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">谁主动发起数据连接</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">① 主动模式（Active）</font></h2>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端连服务器 21 端口（命令）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端告诉服务器：“我开了某个端口，你来连我传数据”</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器主动连客户端的端口（20 端口）</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">问题：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">现在电脑都有防火墙，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器主动连你会被拦</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，所以经常传失败。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">② 被动模式（Passive）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">现在 99% 都用这个！</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端连 21 端口</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端说：我用被动模式</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器说：好，我开了端口 xxxx，你来连我</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">客户端主动连服务器</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">传文件</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">优点：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">防火墙不会拦，更稳定。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">六、FTP 完整登录传输流程（一步一步讲）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">假设：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器：192.168.1.100</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用户名：user</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">密码：123456</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要下载一个文件 test.txt</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">步骤 1：建立命令连接</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你的电脑 → 服务器 21 端口</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">建立对话通道。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">步骤 2：登录验证</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你发：USER user</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器回：请输密码</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你发：PASS 123456</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器回：登录成功</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">步骤 3：进入目录、查看文件</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你发：LIST 或 CWD 目录名</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器回文件列表</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">步骤 4：准备传文件（被动模式）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你发：PASV</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器回：我开了端口 12345，你来连</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">步骤 5：建立数据连接，开始传输</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你连服务器 12345 端口</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">开始下载 test.txt</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">步骤 6：传输完成，断开数据连接</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">命令连接还在，你可以继续传其他文件。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">七、匿名 FTP 是什么？</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">有些 FTP 服务器不需要账号密码，直接登录。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">账号：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;anonymous&lt;/font&gt;</code><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">密码：随便填（通常是邮箱）</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">老旧软件仓库</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公开文档服务器</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">学校内部资源</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">但</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不安全，权限要严格限制</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">八、FTP 最大的致命问题：明文传输（信安专业重点！）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是 FTP 最关键的安全问题，你们以后做渗透、做防御一定会遇到。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP 所有内容都是明文：</font></h2>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用户名</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">密码</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">文件名</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">甚至文件内容</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">抓包工具（Wireshark）一抓，直接看到密码！</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你发：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;PASS 123456&lt;/font&gt;</code></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络上就是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">赤裸裸的 123456</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是为什么：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">现在企业几乎不用原始 FTP，都用 SFTP 或 FTPS。</font></strong></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">九、安全版本：FTPS 和 SFTP（必须区分）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. FTPS</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= FTP + TLS/SSL 加密</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">在原来的 FTP 上加了一层加密</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">端口还是 21，但数据加密</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. SFTP</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">= SSH File Transfer Protocol</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">基于 SSH 协议（22 端口）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">完全不是传统 FTP</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">更安全、更稳定</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">企业、服务器运维 99% 用这个</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">十、FTP 常见命令（命令行模式，简单看一眼）</font></h1>
<details class="lake-collapse"><summary id="u7c323eaf"><span class="ne-text" style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); font-size: 16px">如果你用 cmd 输入 ftp，会用到这些：</span></summary><ul class="ne-ul"><li id="u2e6224a8" data-lake-index-type="0"><span class="ne-text" style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); font-size: 16px">open 192.168.1.100 （连接）</span></li><li id="u23180167" data-lake-index-type="0"><span class="ne-text" style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); font-size: 16px">user （输入用户名）</span></li><li id="u45d43597" data-lake-index-type="0"><span class="ne-text" style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); font-size: 16px">pass （输入密码）</span></li><li id="u71a8991a" data-lake-index-type="0"><span class="ne-text" style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); font-size: 16px">ls （看文件）</span></li><li id="ud3016c7e" data-lake-index-type="0"><span class="ne-text" style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); font-size: 16px">get test.txt （下载）</span></li><li id="u6e9996f2" data-lake-index-type="0"><span class="ne-text" style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); font-size: 16px">put test.txt （上传）</span></li><li id="u09513612" data-lake-index-type="0"><span class="ne-text" style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0); font-size: 16px">bye （退出）</span></li></ul></details>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">十一、给你和全班同学的终极总结（最简单版本）</font></h1>
<ul>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP 是传文件的协议</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">21 端口发命令</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">随机端口传数据</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">分主动 / 被动模式，现在都用被动</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">最大缺点：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">账号密码明文，极不安全</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">现代替代：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">SFTP（SSH 22 端口）</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP 服务器 = 文件仓库</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">FTP 客户端 = 你的电脑</font></li>
</ul>]]></description>
    <pubDate>Tue, 10 Nov 2026 02:34:56 +0800</pubDate>
    <dc:creator>Alpha_02</dc:creator>
    <guid>https://cybermdnote.asia/jisuanji_jichu/34.html</guid>
</item>
<item>
    <title>DNS-原理详解</title>
    <link>https://cybermdnote.asia/jisuanji_jichu/33.html</link>
    <description><![CDATA[<p>:::info<br />
<strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 就是互联网的 “电话本 / 翻译官”。它把人类能看懂的域名，翻译成机器能看懂的 IP 地址。</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有 DNS，你上网只能输一长串数字，根本记不住。</font></p>
<p>:::</p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 为什么必须要有 DNS？（最通俗的原因）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">机器只认数字，人只认名字</font></h2>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑、服务器、路由器…… 所有设备</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只认识 IP 地址</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;110.242.68.3&lt;/font&gt;</code></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">人记不住数字，人只记得名字</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;baidu.com&lt;/font&gt;</code></li>
</ul>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 就是中间的翻译。</font></strong></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 举一个最贴近生活的例子：打电话</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你想给朋友打电话：</font></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你不知道朋友手机号</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你翻开</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电话本</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">找到名字 → 查到号码</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">拨号</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对应到网络：</font></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你想访问百度</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你不知道百度服务器 IP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你去问 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 服务器</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 把 </font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;baidu.com&lt;/font&gt;</code><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> → 翻译成 </font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;110.242.68.3&lt;/font&gt;</code></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你的电脑去连接这个 IP</font></li>
</ol>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS = 互联网电话本</font>**</strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">域名 = 人名</font><strong>**<font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP = 手机号</font></strong></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 再举一个更形象的：快递送货</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你在网上买东西，写地址：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">北京市海淀区中关村大街</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">快递员不看文字，他看</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">经纬度</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">才能定位。</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">文字地址 = 域名</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">经纬度 = IP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">帮你把文字转成经纬度的地图软件 = DNS</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有 DNS，就像你写文字地址，快递员完全看不懂。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. 再举一个学校里的例子</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">班里有同学：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">名字：张三</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">学号：2025001</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">老师点名只喊学号，同学之间喊名字。</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">域名 = 人名</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP = 学号</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS = 班主任手里的花名册</font></li>
</ul>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5. 现在正式讲：DNS 到底是什么？</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">全称：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Domain Name System</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">域名系统。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">作用只有一个：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把域名 </font>**</strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">↔</font><strong>**<font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> IP 互相翻译。</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你访问网站时，真正发生的是：</font></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你输入：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;www.baidu.com&lt;/font&gt;</code></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑问 DNS：这个名字对应的 IP 是多少？</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 回答：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;110.242.68.3&lt;/font&gt;</code></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑连接这个 IP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网页出现</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有 DNS，你必须手动输：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;https://110.242.68.3&lt;/font&gt;</code></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">6. 最关键：DNS 是怎么工作的？（超详细流程）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我用</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活场景 + 网络步骤</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一步步讲，绝不跳步。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">假设你要打开：</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;www.baidu.com&lt;/font&gt;</code></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第一步：你的电脑先查自己的缓存</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像你脑子里先想：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“百度的 IP 我记得吗？”</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">如果以前访问过，电脑本地有缓存，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">直接用，不用再问别人。</font></strong></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第二步：如果本地没有 → 问路由器</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你问家里路由器：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“你知道 </font><a href="https://baidu.com"><font style="color:rgb(0, 87, 255);background-color:rgba(0, 0, 0, 0);">baidu.com</font></a><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 的 IP 吗？”</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">路由器也有缓存，可能知道。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第三步：路由器不知道 → 问运营商 DNS（电信 / 移动 / 联通）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">路由器问：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“电信大哥，</font><a href="https://baidu.com"><font style="color:rgb(0, 87, 255);background-color:rgba(0, 0, 0, 0);">baidu.com</font></a><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 是多少？”</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是最常见的情况。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第四步：运营商也没有 → 去问根 DNS（全世界只有 13 台）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">根服务器说：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我不知道具体 IP，但我知道 </font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;.com&lt;/font&gt;</code><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 是谁管。”</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第五步：去问 .com 顶级域名服务器</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">.com 说：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我知道 </font><a href="https://baidu.com"><font style="color:rgb(0, 87, 255);background-color:rgba(0, 0, 0, 0);">baidu.com</font></a><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 是谁管，我给你它的地址。”</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第六步：去问 </font><a href="https://baidu.com"><font style="color:rgb(0, 87, 255);background-color:rgba(0, 0, 0, 0);">baidu.com</font></a><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 自己的权威 DNS</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">百度自己的 DNS 说：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我的 IP 是 110.242.68.3”</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第七步：一路返回，最终到你电脑</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你的电脑拿到 IP，开始连接。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">7. 用 “找人” 的例子完整演一遍 DNS 查询</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要找一个人：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“中国北京百度公司的张三”</font></strong></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你先自己想 → 不知道</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">问室友 → 不知道</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">问小区保安 → 不知道</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">保安问市政府 → 市政府说：找北京</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">北京说：找海淀区</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">海淀区说：百度公司在这</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">百度公司说：张三在 302 办公室</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">整个过程就是 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 递归查询 + 迭代查询</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">8. DNS 里最重要的几个名词（用比喻讲）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 根域名服务器（Root）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">相当于</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">国家外交部</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不管具体人，只告诉你哪个国家管。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 顶级域名服务器（TLD）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如 </font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;.com&lt;/font&gt;``&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;.cn&lt;/font&gt;``&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;.net&lt;/font&gt;``&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;.edu&lt;/font&gt;</code><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">相当于</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">各省省政府</font></strong></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 权威 DNS（Authoritative）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">真正拥有这个域名的服务器</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">相当于</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公司人事科</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，最清楚自己员工。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. 递归 DNS（运营商 DNS）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">相当于</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">跑腿的中介</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">帮你一层层去问，最后把结果带给你。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">9. DNS 不仅能查 IP，还能干很多事</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 不只是翻译域名，它还有很多记录类型，我用最简单方式讲：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">A 记录：域名 → IPv4（最常见</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">）</font></li>
</ol>
<p><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;baidu.com → 110.242.68.3&lt;/font&gt;</code></p>
<ol start="2">
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">AAAA 记录：域名 → IPv6</font></strong></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">更长的地址。</font></p>
<ol start="3">
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">CNAME：别名</font></strong></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">相当于 “外号”</font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;www.baidu.com&lt;/font&gt;</code><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> → </font><code>&lt;font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"&gt;shifen.baidu.com&lt;/font&gt;</code></p>
<ol start="4">
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">MX 记录：邮件服务器</font></strong></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">告诉邮箱：往哪发信。</font></p>
<ol start="5">
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">PTR 记录：反向解析</font></strong></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP → 域名</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">用来反查这 IP 是谁。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">10. 没有 DNS 会怎样？（极端真实场景）</font></h1>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你不能用域名访问任何网站</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">必须手动输入 IP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">普通人根本上不了网</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">邮件发不了</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">几乎所有互联网服务瘫痪</font></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电话本全烧了，你谁也联系不上。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">11. DNS 污染、劫持是什么？（信息安全专业重点）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 劫持</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">假 DNS 骗你：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你要去百度，它给你一个钓鱼网站 IP。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比喻：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你查朋友手机号，骗子给你一个假号码。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 污染</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">运营商故意返回错误 IP。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你访问某些网站，直接跳错。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">12. 最简单、最浓缩的总结</font></h1>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS = </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">互联网电话本 / 翻译官</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">人记域名，机器记 IP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DNS 负责把域名翻译成 IP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">查 DNS 像一层层找人：本地 → 路由器 → 运营商 → 根 → 顶级 → 权威</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有 DNS，互联网根本无法使用</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">安全方向重点：DNS 劫持、污染、缓存投毒</font></li>
</ul>]]></description>
    <pubDate>Tue, 10 Nov 2026 02:34:56 +0800</pubDate>
    <dc:creator>Alpha_02</dc:creator>
    <guid>https://cybermdnote.asia/jisuanji_jichu/33.html</guid>
</item>
<item>
    <title>DHCP原理解析（新手专属）</title>
    <link>https://cybermdnote.asia/jisuanji_jichu/32.html</link>
    <description><![CDATA[<p>:::info<br />
<font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">先给你一句</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">最核心的大白话定义</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP 就是局域网里的「自动发号员」，专门给手机、电脑、打印机这些设备，自动分配上网用的 IP 地址（还有配套参数），不用你手动一个个输 IP，省事还不会重复。</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你听不懂，大概率是因为一上来就接触「DORA 流程、广播、租约、IP 池」这些术语，完全没对应到现实场景。我先把</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">基础概念拆碎</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，再讲流程，再讲生活应用，全程用你天天见的例子，保证一步步吃透。</font></p>
<p>:::</p>
<h2>DHCP 名字的由来：每个字母都藏着它的「工作说明书」</h2>
<blockquote>
<p>DHCP 不是随便起的名字，而是<strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">英文全称的首字母缩写</font></strong>，每个字母都精准对应它的核心功能，就像给一个工具贴了「功能标签」，一看名字就知道它是干什么的。  </p>
</blockquote>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一、DHCP 的完整英文与中文翻译</font></h3>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP = Dynamic Host Configuration Protocol中文译名：动态主机配置协议</font></strong></p>
<table>
<thead>
<tr>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">字母</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">英文单词</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">中文意思</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">对应生活场景</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">为什么这么叫？</font></strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">D</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Dynamic</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">动态的</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">酒店房间「循环使用」：客人退房→房间回收→给新客人</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP 不是永久分配，而是「临时租给你用」，到期收回再给别人，和手动设「固定 IP」（静态）完全相反</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">H</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Host</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">主机</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">要住店的客人（手机、电脑、打印机）</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就是网络里需要上网的「设备」，所有连网的终端都叫 Host</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">C</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Configuration</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">配置</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">酒店给的「房卡 + 入住须知 + WiFi 密码」</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不只是给 IP，还要配</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">子网掩码、网关、DNS</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这些「上网必需参数」，相当于帮设备「自动填好所有网络设置」</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">P</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Protocol</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">协议</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">酒店入住「固定流程」：登记→拿房卡→退房</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">是网络世界的「规矩」，规定了设备怎么向服务器要 IP、服务器怎么给、怎么续约，所有人都按这个流程来</font></td>
</tr>
</tbody>
</table>
<hr />
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">二、为什么不叫别的名字？（背后的设计逻辑）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你可能会想：直接叫「自动分配 IP 协议」不行吗？为什么要这么长的名字？</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">因为 DHCP 的功能</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">远不止「分配 IP」</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，这四个词刚好完整概括了它的核心价值：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Dynamic（动态）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：这是它和手动设 IP 最大的区别，解决了「IP 浪费」「地址不够用」的问题；</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Host（主机）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：明确了服务对象 —— 所有连网的终端设备；</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Configuration（配置）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：强调它是「一站式配置」，不是只给一个 IP 就完事，而是把上网需要的所有参数都配齐；</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Protocol（协议）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：说明它是国际标准，所有路由器、电脑、手机都遵守这个规则，保证全世界的设备都能「自动上网」。</font></li>
</ol>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第一步：先搞懂 3 个基础前提（不懂这个，DHCP 永远懵）</font></h2>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">什么是 IP 地址？（设备的「门牌号」）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你可以把</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">局域网</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（比如家里 WiFi、宿舍网、公司网、商场 WiFi）当成一个</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">小区</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。每一个连进这个小区的设备（手机、电脑、平板、打印机），都需要一个</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">唯一的门牌号</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，这个门牌号就是 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP 地址</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子：家里小区的门牌号是 101、102、103……</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络里的 IP 就是：192.168.1.2、192.168.1.3、192.168.1.4……</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没有门牌号，别人找不到你，你也出不了小区（上不了网）；</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">门牌号重复</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（两个设备用同一个 IP），就会「打架」，两个设备都上不了网。</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">手动设 IP 有多坑？（DHCP 存在的意义）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">以前没有 DHCP 的时候，要上网必须</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">手动给每个设备输 IP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如宿舍 4 台电脑，你得挨个设置：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑 1：192.168.1.2</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑 2：192.168.1.3</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑 3：192.168.1.4</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑 4：192.168.1.5</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">痛点直接拉满：</font></p>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">设备多了记不住，容易设重号（IP 冲突）；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">来客人连网，还要教他手动输 IP，麻烦死；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公司 / 教室几十台设备，手动配能把人累疯；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">设备搬走了，IP 空着浪费，新设备来了还得重新找空号。</font></li>
</ol>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP 就是为了解决这个破事诞生的！</font></strong></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP 里的 4 个关键角色（对应现实人物）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不用记术语，直接对应生活角色：</font></p>
<table>
<thead>
<tr>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络术语</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活对应角色</font></strong></th>
<th><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">作用</font></strong></th>
</tr>
</thead>
<tbody>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP 客户端</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">要住店的客人 / 要进宿舍的学生</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">手机、电脑、打印机（需要 IP 上网的设备）</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP 服务器</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">酒店前台 / 宿管阿姨 / 公司行政</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">专门管发 IP 的设备（家用路由器、专业服务器）</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP 地址池</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">酒店空房间 / 宿舍空床位</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器提前存好的一堆可用 IP（比如 192.168.1.100~200）</font></td>
</tr>
<tr>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">租约</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">酒店入住天数 / 宿舍暂住时间</font></td>
<td><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP 不是永久给的，有使用期限，到期要续约</font></td>
</tr>
</tbody>
</table>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第二步：DHCP 核心工作流程（DORA 四步）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP 分配 IP 只有</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4 个步骤</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，缩写叫 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DORA</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，我用「酒店开房」的例子，一步一步拆到最细，保证你秒懂。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">场景：你（手机 / 电脑）走进一家酒店（连入局域网），要开房间（要 IP 上网），前台（DHCP 服务器）给你办入住。</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第一步：D = Discover（发现）→ 客户端「大喊找前台」</font></h3>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络里的动作</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">设备刚连上网，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">自己没有 IP，也不知道 DHCP 服务器在哪</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，所以会向</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">整个局域网发广播</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（相当于大喊）：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">「有没有 DHCP 服务器？我要一个 IP 地址！谁能给我分配一个？」</font></p>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活例子</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你刚进酒店大堂，不知道前台在哪，扯着嗓子喊：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">「有没有前台？我要开房间！」</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">整个大堂（局域网）的人都能听到你的喊声。</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第二步：O = Offer（提供）→ 服务器「递房卡」</font></h3>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络里的动作</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP 服务器听到广播后，从「IP 地址池」里挑一个</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">没人用的空 IP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，加上子网掩码、网关、DNS（这些都是上网配套参数，相当于房卡 + 入住须知），回复给你的设备。</font></p>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活例子</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">前台听到你的喊声，拿出一张空房卡（比如 302 房间），对你说：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">「我是前台！给你 302 房间，有效期 3 天，拿着这个就能入住！」</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">⚠️</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 小知识点：局域网里可能有多个 DHCP 服务器（比如酒店多个前台），你的设备可能会收到</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">多个 Offer</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，后面会选一个。</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第三步：R = Request（请求）→ 客户端「选定房卡」</font></h3>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络里的动作</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你的设备从收到的多个 Offer 里选一个（一般选第一个收到的），然后</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">再次广播</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">「我选定了这个 DHCP 服务器给我的 IP！其他服务器的 IP 我不要了，你们收回去吧！」</font></p>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活例子</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你听到多个前台的回应，选了离你最近的那个前台，大喊：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">「我就要 302 房间了！其他前台不用给我留房了！」</font></strong></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第四步：A = Acknowledge（确认）→ 服务器「正式确认入住」</font></h3>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网络里的动作</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP 服务器收到你的请求后，发一个确认包，把 IP、租约时间、所有上网参数正式分配给你。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你的设备拿到后，自动配置网络，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">立刻就能上网</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">！</font></p>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活例子</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">前台登记后对你说：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">「收到！302 房间正式归你使用 3 天，没问题了！」</font></strong></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第三步：关键知识点「租约机制」（IP 不是永久的！）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这是 DHCP 很重要的点，新手很容易忽略，继续用酒店例子：</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 什么是租约？</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP 不会把 IP 永久给一个设备，而是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">有使用期限</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，这个期限就叫</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">租约</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">家用路由器：租约一般 1~7 天</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公司 / 校园网：租约几小时到一天</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">商场公共 WiFi：租约可能只有几十分钟</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 租约快到期了怎么办？（续约）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">比如租约 24 小时，用到</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第 12 小时</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（一半时间），你的设备会</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">主动找 DHCP 服务器续约</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">「我还在用这个 IP，能不能续期？」</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">服务器同意后，租约重新计时，继续用。</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 续约失败 / 设备断开怎么办？（IP 回收）</font></h3>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你关机带走手机（离开局域网）：服务器到期后，把 IP 收回，放进 IP 池，给下一个设备用；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DHCP 服务器挂了（前台跑路）：设备续约失败，租约到期后 IP 失效，设备会生成一个 169.254.x.x 的无效 IP，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">上不了网</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></li>
</ul>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">生活对应</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">酒店入住 3 天，快到期了你找前台续住；你退房走了，酒店把房间打扫好，给下一个客人住；前台跑路了，没人给你办入住，你就住不了。</font></p>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第四步：DHCP 在生活中的实际应用（全是你天天见的场景）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我举</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5 个你最熟悉的例子</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，让你知道 DHCP 到底在哪用、有什么用：</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子 1：家里连 WiFi（最常见）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你回家打开手机，连家里的 WiFi，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不用输任何 IP 地址，直接就能上网</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">背后：家里的</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">路由器自带 DHCP 服务器</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP 池：路由器提前设好 192.168.1.100~192.168.1.200 这 101 个 IP；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">过程：手机走 DORA 流程，路由器自动分一个 IP（比如 192.168.1.105）；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">好处：爸妈、亲戚来连 WiFi，不用教他们设 IP，连上就用。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子 2：大学宿舍 / 教室网络</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">宿舍 4 个人，电脑、平板、手机都连宿舍路由器；教室几十台电脑连校园网。</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">要是手动设 IP：老师 / 宿管要挨个配置，记错号就冲突；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">有 DHCP：所有设备自动获 IP，来人就分，走了就收，零维护。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子 3：商场 / 咖啡厅 / 奶茶店公共 WiFi</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你逛商场连免费 WiFi，不用设置任何参数，直接上网。</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">商场的 DHCP 服务器会给你分一个</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">临时 IP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你离开商场后，IP 自动收回，给下一个顾客用；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">优势：商场每天几千人连网，IP 池循环使用，不用准备几万个 IP。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子 4：公司办公网络</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公司几百台电脑、打印机、考勤机、监控摄像头。</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IT 人员不用挨个给设备设 IP；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">新员工入职：电脑连网自动获 IP；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">员工离职：设备搬走，IP 自动回收；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">还能给打印机绑定固定 IP（防止 IP 变了没法打印），全靠 DHCP 管理。</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">例子 5：校园网（图书馆 / 教学楼）</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">大学几万师生，手机、电脑、平板连校园网。</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不可能手动给每个人设 IP；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">校园网核心交换机上的 DHCP 服务器，统一分配 IP；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你在图书馆连网、教学楼连网，都是 DHCP 自动给号，无缝上网。</font></li>
</ul>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">第五步：DHCP 的 4 大核心好处（总结）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">结合上面的例子，一句话记牢：</font></p>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">省事</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：不用手动输 IP，老人小孩都会连网；</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不冲突</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：服务器自动分配，绝不会出现两个设备同 IP；</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">省 IP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：设备走了就回收 IP，循环利用，不用海量 IP；</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">好管理</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：公司 / 校园能统一设置 IP 池、租约，方便运维。</font></li>
</ol>
<hr />
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">最后：再给你一个「宿舍连网」完整小剧场（串起所有知识）</font></h2>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你回宿舍，打开电脑连宿舍 WiFi（客户端进入局域网）；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑大喊：「谁给我 IP？」（Discover 广播）；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">宿舍路由器（DHCP 服务器）说：「给你 192.168.1.106，用 24 小时」（Offer）；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑：「我就要这个 IP！」（Request）；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">路由器：「确认归你用！」（Acknowledge）；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你电脑上网，24 小时快到了，自动找路由器续约；</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你关机去上课，路由器到期收回 192.168.1.106，给室友的平板用。</font></li>
</ol>]]></description>
    <pubDate>Tue, 10 Nov 2026 02:34:55 +0800</pubDate>
    <dc:creator>Alpha_02</dc:creator>
    <guid>https://cybermdnote.asia/jisuanji_jichu/32.html</guid>
</item>
<item>
    <title>ARP欺骗--原理详解</title>
    <link>https://cybermdnote.asia/jisuanji_jichu/31.html</link>
    <description><![CDATA[<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一、先把基础讲透：ARP 是干嘛的？（不懂这个就不可能懂欺骗）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 网络里有两种 “地址”</font></h2>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP 地址</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（逻辑地址）</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你家的门牌号，好记、会变。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">MAC 地址</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">（物理地址）</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网卡出厂就烧在硬件里的唯一编号，</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">永远不变</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">像你的身份证号，全世界唯一。</font></li>
</ol>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 问题来了</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑只知道对方的 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">，但</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">真正发数据必须用 MAC</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">那电脑怎么通过 IP 找到 MAC？</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">→ 靠 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 协议</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. ARP 协议的作用：一句话</font></h2>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP = 通过 IP 问 MAC</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我知道你叫 “张三”（IP），</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">我在班里大喊一声：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“张三是谁？你的座位在哪？”</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">张三举手回答：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我在这！我座位是 3 排 5 号（MAC）”</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是 ARP。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">二、ARP 正常工作流程（超级详细）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">假设：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你的电脑 A：IP 192.168.1.10，MAC AA-AA-AA-AA-AA-AA</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">同学电脑 B：IP 192.168.1.11，MAC BB-BB-BB-BB-BB-BB</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网关路由器：IP 192.168.1.1，MAC GG-GG-GG-GG-GG-GG</font></li>
</ul>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">正常流程：A 想给 B 发消息</font></h2>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">A 看自己的 ARP 缓存表</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">有没有 B 的 MAC？</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">→ 没有。</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">A 在</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">整个局域网广播</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一条消息：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP Request：谁是 192.168.1.11？请告诉我你的 MAC！</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">所有人都收到，但只有 B 会回应：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP Reply：我是 192.168.1.11，我的 MAC 是 BB-BB-BB-BB-BB-BB</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">A 把这个对应关系存进 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 缓存表</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">以后直接用，不用再问。</font></li>
</ol>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">三、重点来了：ARP 为什么能被欺骗？</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">核心漏洞：</font></h2>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑不会验证 ARP 回复是不是真的！</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">谁回答都信，谁先说信谁！</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你在班里喊：“张三在哪？”</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">结果一个坏人抢先举手：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我是张三！我座位在这！”</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你根本不验证，直接信了。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 欺骗</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 的本质。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">四、ARP 欺骗的完整原理（最详细版本）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击者 C 想搞破坏</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">C 的信息：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP：192.168.1.12</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">MAC：CC-CC-CC-CC-CC-CC</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击目标 1：欺骗电脑 A</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">C 不断给 A 发送 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">伪造 ARP 回复</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我是 192.168.1.11（B 的 IP），我的 MAC 是 CC-CC-CC-CC-CC-CC”</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">A 收到后，直接更新 ARP 表：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">原来的：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">192.168.1.11 → BB-BB-BB-BB-BB-BB</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">现在变成：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">192.168.1.11 → CC-CC-CC-CC-CC-CC</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">结果：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">A 发给 B 的所有数据，全都发给了 C！</font></strong></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击目标 2：欺骗网关（最危险！）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">C 对网关发伪造 ARP：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我是 192.168.1.10（A 的 IP），MAC 是 CC-CC-CC-CC-CC-CC”</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网关就会认为：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">A 的 MAC 是 C 的 MAC</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">于是：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">互联网发给 A 的所有数据，网关都发给 C！</font></strong></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">五、最经典的攻击：中间人攻击（MITM）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">完整流程（一定要看懂）</font></h2>
<ol>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">C 欺骗 A：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我是网关 192.168.1.1”</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">C 欺骗网关：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我是 A 192.168.1.10”</font></strong></li>
</ol>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">结果：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">A 发往互联网的数据 → 先到 C</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网关发给 A 的数据 → 先到 C</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">C 变成了 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">中间代理人</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击者可以干什么？</font></h2>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">偷看你的账号密码（HTTP、FTP 明文全暴露）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">篡改网页内容</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">插入广告、木马</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">劫持流量</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">断网（不转发）</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 中间人攻击</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">六、另一种常见攻击：断网攻击（ARP 泛洪）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">攻击者不断发送伪造 ARP，让所有人的网关 MAC 都指向一个</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不存在的地址</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">。</font></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">结果：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">所有人都找不到网关 → </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">直接断网！</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">就像：</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你把整个小区的大门地址都改成错误地址，所有人都出不去。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">七、用生活例子彻底总结 ARP 欺骗（全班秒懂）</font></h1>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把局域网当成 </font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">一间教室</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP = 同学名字</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">MAC = 座位号</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP = 找人</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">网关 = 教室门</font></li>
</ul>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">正常情况</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你想出门，问：“门在哪？”</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">门回答：“我在这。”</font></p>
<h3><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 欺骗</font></h3>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">坏人跑到你面前大喊：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">“我就是门！”</font></strong></p>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">你信了。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">于是你想出门，都走向坏人。</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">坏人可以：</font></p>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">看你口袋里的东西（窃听）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">把你东西换掉（篡改）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不让你出去（断网）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">假装门把你引向陷阱（钓鱼）</font></li>
</ul>
<p><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">这就是 ARP 欺骗。</font></strong></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">八、ARP 欺骗的技术特点（信息安全专业必背）</font></h1>
<ol>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只在局域网内有效</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">出了路由器就没用。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不需要权限，不需要破解密码</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只要在同一个网，就能发。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">二层攻击（数据链路层）</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不受防火墙影响。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">难以察觉</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑不会报警。</font></li>
<li><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">所有设备都可能受害</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">手机、电脑、摄像头、IoT 设备都一样。</font></li>
</ol>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">九、真实攻击工具（你们以后实验会用到）</font></h1>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">arpspoof（Kali Linux）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">BetterCAP</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Ettercap</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Cain &amp; Abel</font></li>
</ul>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">原理都一样：</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不断发送伪造 ARP 响应包</font></strong></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">十、怎么防御 ARP 欺骗？（重点）</font></h1>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">1. 绑定静态 ARP（最有效）</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">手动把网关 IP 和 MAC 写死</font><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">不让电脑随便更新。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">2. 交换机开启 ARP 防护</font></h2>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">DAI（Dynamic ARP Inspection）</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">Port Security</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">IP+MAC 绑定</font></li>
</ul>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">3. 使用 HTTPS</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">即使被中间人，数据也是加密的，看不到内容。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">4. ARP 防火墙</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">360、火绒都有 ARP 防火墙。</font></p>
<h2><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">5. 不用公共陌生 Wi-Fi</font></h2>
<p><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">公共 Wi-Fi 最容易被 ARP 欺骗。</font></p>
<hr />
<h1><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">十一、终极总结（给你全班背的版本）</font></h1>
<ul>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">通过 IP 找 MAC</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);"> 的协议</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 漏洞是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">电脑无条件相信任何 ARP 回复</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">ARP 欺骗就是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">冒充别人的 IP 发送假 MAC</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">最常用攻击是</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">中间人攻击 MITM</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">可以</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">窃听、篡改、劫持、断网</font></strong></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">只在</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">局域网</font></strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">有效</font></li>
<li><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">防御靠</font><strong><font style="color:rgb(0, 0, 0);background-color:rgba(0, 0, 0, 0);">静态绑定、交换机安全、HTTPS</font></strong></li>
</ul>]]></description>
    <pubDate>Tue, 10 Nov 2026 02:34:55 +0800</pubDate>
    <dc:creator>Alpha_02</dc:creator>
    <guid>https://cybermdnote.asia/jisuanji_jichu/31.html</guid>
</item>
</channel>
</rss>