<!doctype html><html lang=en dir=ltr class=scroll-smooth data-default-appearance=light data-auto-appearance=true><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=theme-color content="#FFFFFF"><title>探索 | NAT 简介 & 端口开放 &middot; FloatSheep's Blog</title>
<meta name=title content="探索 | NAT 简介 & 端口开放 &middot; FloatSheep's Blog"><script type=text/javascript src=/js/appearance.min.8a082f81b27f3cb2ee528df0b0bdc39787034cf2cc34d4669fbc9977c929023c.js integrity="sha256-iggvgbJ/PLLuUo3wsL3Dl4cDTPLMNNRmn7yZd8kpAjw="></script><link type=text/css rel=stylesheet href=/css/main.bundle.min.5175b55751112ca802889fe1f86d954335179c7770d85c064aa8b00042fe2868.css integrity="sha256-UXW1V1ERLKgCiJ/h+G2VQzUXnHdw2FwGSqiwAEL+KGg="><script defer type=text/javascript id=script-bundle src=/js/main.bundle.min.e2f23ac92b690a4e99ab2dffef9aa96a95f7ec39636fb9fa7eeb70d55ba347ae.js integrity="sha256-4vI6yStpCk6Zqy3/75qpapX37Dljb7n6futw1VujR64=" data-copy=Copy data-copied=Copied></script><meta name=description content="
      
        NAT 的介绍及 NAT 下端口映射
      
    "><link rel=canonical href=https://blog.hesiy.cn/posts/open-port-in-nat/><link rel=apple-touch-icon sizes=180x180 href=/apple-touch-icon.png><link rel=icon type=image/png sizes=32x32 href=/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=/favicon-16x16.png><link rel=manifest href=/site.webmanifest><meta property="og:url" content="https://blog.hesiy.cn/posts/open-port-in-nat/"><meta property="og:site_name" content="FloatSheep's Blog"><meta property="og:title" content="探索 | NAT 简介 & 端口开放"><meta property="og:description" content="NAT 的介绍及 NAT 下端口映射"><meta property="og:locale" content="en"><meta property="og:type" content="article"><meta property="article:section" content="posts"><meta property="article:published_time" content="2024-07-28T12:28:22+08:00"><meta property="article:modified_time" content="2024-07-28T12:28:22+08:00"><meta property="article:tag" content="Learn"><meta property="og:image" content="https://blog.hesiy.cn/posts/open-port-in-nat/cover.svg"><meta name=twitter:card content="summary_large_image"><meta name=twitter:image content="https://blog.hesiy.cn/posts/open-port-in-nat/cover.svg"><meta name=twitter:title content="探索 | NAT 简介 & 端口开放"><meta name=twitter:description content="NAT 的介绍及 NAT 下端口映射"><script type=application/ld+json>{"@context":"https://schema.org","@type":"Article","articleSection":"所有文章","name":"探索 | NAT 简介 \u0026 端口开放","headline":"探索 | NAT 简介 \u0026 端口开放","abstract":"NAT 的介绍及 NAT 下端口映射","inLanguage":"en","url":"https:\/\/blog.hesiy.cn\/posts\/open-port-in-nat\/","author":{"@type":"Person","name":"FloatSheep"},"copyrightYear":"2024","dateCreated":"2024-07-28T12:28:22\u002b08:00","datePublished":"2024-07-28T12:28:22\u002b08:00","dateModified":"2024-07-28T12:28:22\u002b08:00","keywords":["learn"],"mainEntityOfPage":"true","wordCount":"2960"}</script><script type=application/ld+json>{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","item":"https://blog.hesiy.cn/","name":"","position":1},{"@type":"ListItem","item":"https://blog.hesiy.cn/posts/","name":"所有文章","position":2},{"@type":"ListItem","item":"https://blog.hesiy.cn/categories/nat/","name":"Nat","position":3},{"@type":"ListItem","name":"探索 NAT 简介 \u0026 端口开放","position":4}]}</script><meta name=author content="FloatSheep"><link href=mailto:admin@hesiy.cn rel=me><link href=https://hesiy.cn/ rel=me><link href=https://github.com/FloatSheep rel=me><link href="https://music.163.com/#/user/home?id=1431228228" rel=me><link href=https://last.fm/user/FloatSheep rel=me><link href=https://space.bilibili.com/384597455 rel=me><script async src=https://umami.yurl.eu.org/script.js data-website-id=c4ab2812-12c5-44d6-9de3-cd6975a7967b></script><script>document.addEventListener("DOMContentLoaded",e=>{if("serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js?t="+(new Date).getTime(),{type:"module"}).then(function(e){console.log("Service Worker 注册成功:",e)}).catch(function(e){console.log("Service Worker 注册失败:",e)}),navigator.serviceWorker.addEventListener("message",e=>{e.data==="sw-updated"&&window.location.reload()}),window.fm||(window.fm={}),window.fm.refresh=()=>{navigator.serviceWorker.getRegistrations().then(e=>{e.forEach(e=>e.unregister())})},document.querySelector("#pagemap")){document.querySelector("#pagemap").addEventListener("mouseover",()=>{document.querySelector("#pagemap").classList.remove("fadeout"),document.querySelector("#pagemap").classList.add("fadein")}),document.querySelector("#pagemap").addEventListener("mouseout",()=>{document.querySelector("#pagemap").classList.remove("fadein"),document.querySelector("#pagemap").classList.add("fadeout")});let e=document.querySelector("#pagemap"),t=null;document.addEventListener("scroll",()=>{e.classList.remove("fadeout"),e.classList.add("fadein"),t&&clearTimeout(t),t=setTimeout(()=>{e.classList.remove("fadein"),e.classList.add("fadeout")},1e3)})}})</script><script src=/js/modules/mokerConsole.js></script><script src=/js/modules/messageBar.js></script><script src=/js/moduleEnable.js></script><script src=/js/snackbar/snackbar.min.js></script><script src=/js/disableKeyDown.js></script><link rel=stylesheet href=/js/snackbar/snackbar.min.css><script src=/js/switch-day-night.js></script><script src=/js/pagemap.js></script><link rel=preload href=https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/lxgw-wenkai-screen-webfont/1.7.0/lxgwwenkaiscreen.css as=style onload='this.rel="stylesheet"'></head><body class="m-auto flex h-screen max-w-7xl flex-col bg-neutral px-6 text-lg leading-7 text-neutral-900 dark:bg-neutral-800 dark:text-neutral sm:px-14 md:px-24 lg:px-32"><div id=the-top class="absolute flex self-center"><a class="-translate-y-8 rounded-b-lg bg-primary-200 px-3 py-1 text-sm focus:translate-y-0 dark:bg-neutral-600" href=#main-content><span class="pe-2 font-bold text-primary-600 dark:text-primary-400">&darr;</span>Skip to main content</a></div><header id=order-header class="py-6 font-semibold text-neutral-900 dark:text-neutral print:hidden sm:py-10"><nav class="flex items-start justify-between sm:items-center"><div class="flex flex-row items-center"><a class="decoration-primary-500 hover:underline hover:decoration-2 hover:underline-offset-2" rel=me href=/>FloatSheep&rsquo;s Blog</a></div><ul class="flex list-none flex-col ltr:text-right rtl:text-left sm:flex-row"><li class="group mb-1 sm:mb-0 sm:me-7 sm:last:me-0.5"><a href=/posts/ title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">文章</span></a></li><li class="group mb-1 sm:mb-0 sm:me-7 sm:last:me-0.5"><a href=/categories/ title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">分类</span></a></li><li class="group mb-1 sm:mb-0 sm:me-7 sm:last:me-0.5"><a href=/circle/ title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">友圈</span></a></li><li class="group mb-1 sm:mb-0 sm:me-7 sm:last:me-0.5"><a href=/friends/ title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">友链</span></a></li><li class="group mb-1 sm:mb-0 sm:me-7 sm:last:me-0.5"><a href=/speak/ title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">说说</span></a></li><li class="group mb-1 sm:mb-0 sm:me-7 sm:last:me-0.5"><a href=/about/ title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">关于</span></a></li><li class="group mb-1 sm:mb-0 sm:me-7 sm:last:me-0.5"><a href=https://www.travellings.cn/go.html title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">开往</span></a></li><li class="group mb-1 sm:mb-0 sm:me-7 sm:last:me-0.5"><button id=search-button-1 title="Search (/)">
<span class="group-dark:hover:text-primary-400 transition-colors group-hover:text-primary-600"><span class="icon relative inline-block px-1 align-text-bottom"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="search" class="svg-inline--fa fa-search fa-w-16" role="img" viewBox="0 0 512 512"><path fill="currentcolor" d="M505 442.7 405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9.0 208 0S0 93.1.0 208s93.1 208 208 208c48.3.0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9.0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7.0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7.0 128 57.2 128 128 0 70.7-57.2 128-128 128z"/></svg>
</span></span><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2"></span></button></li></ul></nav></header><canvas id=pagemap></canvas><div class="relative flex grow flex-col"><main id=main-content class=grow><article><header class=max-w-prose><ol class="text-sm text-neutral-500 dark:text-neutral-400 print:hidden"><li class="hidden inline"><a class="dark:underline-neutral-600 decoration-neutral-300 hover:underline" href=/></a><span class="px-1 text-primary-500">/</span></li><li class=inline><a class="dark:underline-neutral-600 decoration-neutral-300 hover:underline" href=/posts/>所有文章</a><span class="px-1 text-primary-500">/</span></li><li class="hidden inline"><a class="dark:underline-neutral-600 decoration-neutral-300 hover:underline" href=/posts/open-port-in-nat/>探索 | NAT 简介 & 端口开放</a><span class="px-1 text-primary-500">/</span></li></ol><h1 id=title class="mb-8 mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">探索 | NAT 简介 & 端口开放
     </h1><div class="mb-10 text-base text-neutral-500 dark:text-neutral-400 print:hidden"><div class="flex flex-row flex-wrap items-center"><time datetime="2024-07-28 12:28:22 +0800 +0800">2024 年 07 月 28 日</time><span class="px-2 text-primary-500">&#183;</span><span>2960 words</span><span class="px-2 text-primary-500">&#183;</span><span title="Reading time">6 mins</span></div><div class="my-1 flex flex-wrap text-xs leading-relaxed text-neutral-500 dark:text-neutral-400"><a href=/categories/nat/ class="mx-1 my-1 rounded-md border border-neutral-200 px-1 py-[1px] hover:border-primary-300 hover:text-primary-700 dark:border-neutral-600 dark:hover:border-primary-600 dark:hover:text-primary-400">Nat</a>
<a href=/tags/learn/ class="mx-1 my-1 rounded-md border border-neutral-200 px-1 py-[1px] hover:border-primary-300 hover:text-primary-700 dark:border-neutral-600 dark:hover:border-primary-600 dark:hover:text-primary-400">Learn</a></div></div><div class=prose><img class="mb-6 rounded-md" src=/posts/open-port-in-nat/cover.svg alt loading=lazy></div></header><div id=summary-wrapper><div id=title><span id=summary-post class=name><span class=icon-robot><span class="icon relative inline-block px-1 align-text-bottom"><!doctype html><svg viewBox="0 0 1024 1024" p-id="6281" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M924 422.5h-56a4 4 0 00-4 4v248a4 4 0 004 4h56a4 4 0 004-4v-248a4 4 0 00-4-4zm-768 0h-56a4 4 0 00-4 4v248a4 4 0 004 4h56a4 4 0 004-4v-248a4 4 0 00-4-4zM792 288H544v-97.3a60 60 0 10-64 0V288H232a40 40 0 00-40 40v528a40 40 0 0040 40h560a40 40 0 0040-40V328a40 40 0 00-40-40zM378.7 566.7c-23.6.0-42.7-23.9-42.7-53.3s19.1-53.4 42.7-53.4 42.6 23.9 42.6 53.4-19.1 53.3-42.6 53.3zM605 748a4 4 0 01-4 4H424a4 4 0 01-4-4v-56a4 4 0 014-4h177a4 4 0 014 4zm40.3-181.3c-23.5.0-42.6-23.9-42.6-53.3s19.1-53.4 42.6-53.4 42.7 23.9 42.7 53.4-19.1 53.3-42.7 53.3z" fill="currentcolor"/></svg></span> </span><span class=text>文章摘要 </span><span class=icon-up><span class="icon relative inline-block px-1 align-text-bottom"><!doctype html><svg viewBox="0 0 1024 1024" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M874.965333 621.696l-60.330666 60.352-301.696-301.717333L211.2 682.048l-60.330667-60.352 331.861334-331.861333L512.938667 320 482.752 289.834667 512.938667 259.648l362.026666 362.048z" p-id="7270" fill="currentcolor"/></svg></span></span>
</span><span id=ai-logo class=logo>QwenGPT</span></div><div id=post-ai-result class=post-ai-result><span id=post-ai-result-text lass=text><span id=result-loading>加载中...</span></span></div><div id=meta><span class=tip>此内容根据文章生成，并经过人工审核，仅用于文章内容的解释与总结</span>
<a class=report href=mailto:admin@hesiy.cn>投诉</a></div></div><script>addEventListener("DOMContentLoaded",()=>{const c="https://fake-gpt.hesiy.cn",g=document.getElementById("posts-content"),e=document.getElementById("post-ai-result-text"),u=document.getElementById("result-loading"),o=document.getElementById("ai-logo"),p=document.getElementById("summary-post"),b=new URL(location.href),h=b.pathname.split("/").filter(e=>e!=="").pop(),f=g.textContent,d=c.endsWith("/")?`${c}api/summary`:`${c}/api/summary`,m={postId:h,content:f},l=()=>{const t=document.createElement("span");t.className="ai-cursor",e.appendChild(t)};l();let n,t=!1;const i=(e,s)=>{if(u&&u.remove(),o.classList.add("typing"),e<s.length){const t=document.querySelector(".ai-cursor");t.insertAdjacentText("beforebegin",s.charAt(e)),e++,n=setTimeout(()=>i(e,s),80)}else o.classList.remove("typing"),document.querySelector(".ai-cursor")?.remove(),t=!1},r=s=>{const r=e,o=s;let a=0;t=!0,clearTimeout(n),i(a,o)};let s=void 0;const v=()=>{fetch(`${d}?postId=${h}`,{method:"GET"}).then(e=>e.json()).then(t=>{t.isSave?(s=t.data,r(t.data)):fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}).then(e=>e.json()).then(e=>{e.code===1?(s=e.data,r(e.data)):console.error("Error:",e)}).catch(t=>{e.textContent=`${t}`,console.error("Fetch error:",t)})}).catch(t=>{e.textContent=`${t}`,console.error("Fetch error:",t)})};v();let a=!1;o.addEventListener("click",()=>{if(!t)if(a)s!==void 0&&(t=!0,a=!1,clearTimeout(n),e.textContent=``,l(),r(s));else{let s=0;const o="我是浮杨开发的摘要生成助理 QwenGPT，如你所见，这是一个使用 Qwen 14B 作为生成模型的工具。我在这里只负责显示，并仿照 GPT 的形式输出，如果你像我一样讨厌 Cloudflare Worker 的速度，又囊中羞涩，你也可以像我这样做，当然，你也可以使用 Tianli 开发的 TianliGPT 来更简单的实现 AI 摘要。当然，我的样式与代码很大一部分来自于無名大佬，感谢他的帮助！";t=!0,a=!0,clearTimeout(n),e.textContent=``,l(),setTimeout(()=>{i(s,o)},1e3)}}),p.addEventListener("click",()=>{location.href=`/posts/qwen-summary`})}),document.currentScript.remove()</script><section class="flex flex-col max-w-full mt-0 prose dark:prose-invert lg:flex-row"><div class="order-first px-0 lg:order-last lg:max-w-xs lg:ps-8"><div class="toc pe-5 lg:sticky lg:top-10 print:hidden"><details open class="-ms-5 mt-0 overflow-hidden rounded-lg ps-5"><summary class="block cursor-pointer bg-neutral-100 py-1 ps-5 text-lg font-semibold text-neutral-800 dark:bg-neutral-700 dark:text-neutral-100 lg:hidden">Table of Contents</summary><div class="border-s border-dotted border-neutral-300 py-2 ps-5 dark:border-neutral-600"><nav id=TableOfContents><ul><li><a href=#你没有公网-ip你是怎么上网的>你没有公网 IP，你是怎么上网的？</a></li><li><a href=#常见的-nat-类型>常见的 NAT 类型</a></li><li><a href=#nat-类型与运营商>NAT 类型与运营商</a><ul><li><a href=#nat-类型与连接>NAT 类型与连接</a></li></ul></li><li><a href=#nat-类型与用户>NAT 类型与用户</a><ul><li><a href=#光猫桥接路由器拨号>光猫桥接，路由器拨号</a></li><li><a href=#光猫拨号路由器-dhcp>光猫拨号，路由器 DHCP</a></li></ul></li><li><a href=#使用-natter-进行映射>使用 Natter 进行映射</a><ul><li><a href=#命令行参数>命令行参数</a></li></ul></li><li><a href=#使用-natmap-进行映射>使用 natmap 进行映射</a><ul><li><a href=#命令行参数-1>命令行参数</a></li></ul></li><li><a href=#使用-lucky-进行映射>使用 Lucky 进行映射</a></li><li><a href=#使用-pcp-进行映射>使用 pcp 进行映射</a></li><li><a href=#题外话关于光猫桥接与路由拨号模式的选择>题外话：关于光猫桥接与路由（拨号）模式的选择</a></li><li><a href=#参考>参考</a></li></ul></nav></div></details></div></div><div id=posts-content class="min-w-0 min-h-0 max-w-prose grow"><div class="flex rounded-md bg-primary-100 px-4 py-3 dark:bg-primary-900"><span class="pe-3 text-primary-400"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 512 512"><path fill="currentcolor" d="M506.3 417 293 53c-16.33-28-57.54-28-73.98.0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6c32.76.0 53.26-35 36.96-63zM232 168c0-13.25 10.75-24 24-24s24 10.8 24 24v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zm24 248c-17.36.0-31.44-14.08-31.44-31.44s14.07-31.44 31.44-31.44 31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/></svg>
</span></span><span class=dark:text-neutral-300>本文仅涉及到基础，且可能有错误</span></div><h2 id=你没有公网-ip你是怎么上网的 class="relative group">你没有公网 IP，你是怎么上网的？ <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e4%bd%a0%e6%b2%a1%e6%9c%89%e5%85%ac%e7%bd%91-ip%e4%bd%a0%e6%98%af%e6%80%8e%e4%b9%88%e4%b8%8a%e7%bd%91%e7%9a%84 aria-label=Anchor>#</a></span></h2><p>目前，运营商在 IPv4 中使用 NAT（网络地址转换） 技术，让你能够正常上网</p><p>简单解释，NAT 就是可以让许多设备共享一个公网 IP</p><p>当然，IP 的使用者不仅仅包括你家的设备，可能小区中的很多设备和你家的设备共享一个 IP</p><h2 id=常见的-nat-类型 class="relative group">常见的 NAT 类型 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e5%b8%b8%e8%a7%81%e7%9a%84-nat-%e7%b1%bb%e5%9e%8b aria-label=Anchor>#</a></span></h2><p>在 RFC 3489 标准下，NAT 类型包括如下四种</p><table><thead><tr><th style=text-align:center>NAT 类型</th><th style=text-align:center>映射情况</th></tr></thead><tbody><tr><td style=text-align:center>Full Cone（全锥型）</td><td style=text-align:center>外部主机向内部主机发送报文，可以实现和内部主机通信</td></tr><tr><td style=text-align:center>Restricted Cone（受限圆锥型）</td><td style=text-align:center>内部主机向外部主机发送报文后，外部主机才能发送报文和内部主机通信</td></tr><tr><td style=text-align:center>Port Restricted Cone（端口受限型）</td><td style=text-align:center>内部主机向外部主机的特定 IP 和端口发送报文后，外部主机才能发送报文与内部主机通信</td></tr><tr><td style=text-align:center>Symmetric（对称型）</td><td style=text-align:center>不同的请求拥有不同的映射（相当于外部主机无法直接与内部主机通信）</td></tr></tbody></table><h2 id=nat-类型与运营商 class="relative group">NAT 类型与运营商 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#nat-%e7%b1%bb%e5%9e%8b%e4%b8%8e%e8%bf%90%e8%90%a5%e5%95%86 aria-label=Anchor>#</a></span></h2><p>一般来说，运营商的分配内网 IP 时的 NAT 设备，<strong>默认 NAT 类型</strong>为 Full Cone。在这种情况下，你只需要稍微修改配置，即可获得 Full Cone 型 NAT</p><p>在公网 IP 需求量大的地方，运营商会优先考虑<strong>企业、专线用户</strong>。这时候，运营商会为家庭用户使用其它 NAT 类型的 NAT 设备</p><h3 id=nat-类型与连接 class="relative group">NAT 类型与连接 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#nat-%e7%b1%bb%e5%9e%8b%e4%b8%8e%e8%bf%9e%e6%8e%a5 aria-label=Anchor>#</a></span></h3><p>如果运营商采用 Full Cone 型的 NAT 设备，最多只能有 0xffff（65535） 个连接</p><p>但如果运营商采用 Symmetric 型的 NAT 设备，可以根据 <code>dst ip dst port src port</code> 查找 <code>nat</code> 表，连接数量比 Full Cone 多得多</p><p>因此，越复杂的 NAT 越能用有限的外网地址支持更多的内网设备，这也就解释了为什么许多地方没有 Full Cone</p><h2 id=nat-类型与用户 class="relative group">NAT 类型与用户 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#nat-%e7%b1%bb%e5%9e%8b%e4%b8%8e%e7%94%a8%e6%88%b7 aria-label=Anchor>#</a></span></h2><p>在运营商提供 Full Cone 的情况，用户却无法获取到 Full Cone，一般与配置有关</p><h3 id=光猫桥接路由器拨号 class="relative group">光猫桥接，路由器拨号 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e5%85%89%e7%8c%ab%e6%a1%a5%e6%8e%a5%e8%b7%af%e7%94%b1%e5%99%a8%e6%8b%a8%e5%8f%b7 aria-label=Anchor>#</a></span></h3><p>这种情况在 2020 年之前比较常见</p><p>在这种情况下，你的环境是这样的</p><p><figure><img src=https://7.isyangs.cn/55/66a6213ababaf-55.png alt class="mx-auto my-0 rounded-md"></figure></p><p>由于光猫只作为光电转换设备，NAT 就与它无关了</p><ol><li>进入路由器后台</li></ol><p>找到 <code>高级设置 - 端口转发</code>（部分路由器叫做 DMZ 主机）</p><p>打开 DMZ 开关，并将地址指定为你的设备 IP 地址</p><ol start=2><li>（针对部分路由器）在路由器后台中找到 Full Cone 选项，将其打开</li></ol><p>再次进行 NAT 测试，你的结果理应为 Full Cone</p><p>或者，不配置端口转发，通过 <code>UPnP</code> 进行映射</p><p>找到 <code>高级设置 - 其他</code>，启用 UPnP</p><h3 id=光猫拨号路由器-dhcp class="relative group">光猫拨号，路由器 DHCP <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e5%85%89%e7%8c%ab%e6%8b%a8%e5%8f%b7%e8%b7%af%e7%94%b1%e5%99%a8-dhcp aria-label=Anchor>#</a></span></h3><p>目前，这种情况比较常见</p><div class="flex rounded-md bg-primary-100 px-4 py-3 dark:bg-primary-900"><span class="pe-3 text-primary-400"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 512 512"><path fill="currentcolor" d="M256 0C114.6.0.0 114.6.0 256s114.6 256 256 256 256-114.6 256-256S397.4.0 256 0zm0 128c17.67.0 32 14.33 32 32 0 17.67-14.33 32-32 32s-32-14.3-32-32 14.3-32 32-32zm40 256h-80c-13.2.0-24-10.7-24-24s10.75-24 24-24h16v-64h-8c-13.25.0-24-10.75-24-24s10.8-24 24-24h32c13.25.0 24 10.75 24 24v88h16c13.25.0 24 10.75 24 24s-10.7 24-24 24z"/></svg>
</span></span><span class=dark:text-neutral-300><p>光猫型号不同，操作也不同</p><p>此处以 ZXHN F653GV9 举例</p></span></div><ol><li>使用超管密码，进入光猫后台</li></ol><p>找到 <code>安全 - 防火墙 - 安全级</code>，改为低</p><p>进入<code>应用 - DMZ 主机</code> ，指定为路由器的 IP 地址（或 MAC 地址）</p><p>接着进入 <code>应用 - UPnP</code>，将其变为使能（启用）</p><ol start=2><li>进入路由器后台</li></ol><p>找到 <code>高级设置 - 端口转发</code>（部分路由器叫做 DMZ 主机）</p><p>打开 DMZ 开关，并将地址指定为你的设备 IP 地址</p><p>（针对部分路由器）在路由器后台中找到 Full Cone 选项，将其打开</p><p>或者，不配置端口转发，通过 <code>UPnP</code> 进行映射</p><p>找到 <code>高级设置 - 其他</code>，启用 UPnP</p><p>再次进行 NAT 测试，你的结果理应为 Full Cone</p><h2 id=使用-natter-进行映射 class="relative group">使用 Natter 进行映射 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e4%bd%bf%e7%94%a8-natter-%e8%bf%9b%e8%a1%8c%e6%98%a0%e5%b0%84 aria-label=Anchor>#</a></span></h2><div class="flex rounded-md bg-primary-100 px-4 py-3 dark:bg-primary-900"><span class="pe-3 text-primary-400"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 512 512"><path fill="currentcolor" d="M506.3 417 293 53c-16.33-28-57.54-28-73.98.0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6c32.76.0 53.26-35 36.96-63zM232 168c0-13.25 10.75-24 24-24s24 10.8 24 24v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zm24 248c-17.36.0-31.44-14.08-31.44-31.44s14.07-31.44 31.44-31.44 31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/></svg>
</span></span><span class=dark:text-neutral-300><p>本部分书写于 Natter v2.1.1</p><p>如果你要使用 Natter，请使用 v2 而不是 v1</p></span></div><p>由于 Natter 支持 Windows，我们就不需要 Linux 进行操作了</p><div class="flex rounded-md bg-primary-100 px-4 py-3 dark:bg-primary-900"><span class="pe-3 text-primary-400"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 512 512"><path fill="currentcolor" d="M506.3 417 293 53c-16.33-28-57.54-28-73.98.0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6c32.76.0 53.26-35 36.96-63zM232 168c0-13.25 10.75-24 24-24s24 10.8 24 24v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zm24 248c-17.36.0-31.44-14.08-31.44-31.44s14.07-31.44 31.44-31.44 31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/></svg>
</span></span><span class=dark:text-neutral-300>Natter 需要 Python 环境，请提前安装</span></div><ol><li>下载 Natter</li></ol><p>克隆仓库</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl>git clone https://github.com/MikeWang000000/Natter.git
</span></span></code></pre></div><ol start=2><li>打洞</li></ol><p>我们可以直接使用 <code>python natter.py -m test</code> 来测试是否打洞成功</p><p><figure><img src=https://7.isyangs.cn/55/66a621db48164-55.png alt=image-20240728184751335 class="mx-auto my-0 rounded-md"><figcaption class=text-center>Natter 打洞成功输出</figcaption></figure></p><h3 id=命令行参数 class="relative group">命令行参数 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%8f%82%e6%95%b0 aria-label=Anchor>#</a></span></h3><p>详细可以查看 <a href=https://github.com/MikeWang000000/Natter/blob/master/docs/usage.md target=_blank rel=noreferrer>Natter - 参数说明</a>，此处介绍一些基本参数</p><ul><li><p><code>-p</code> 指定需要映射的端口</p></li><li><p><code>-t</code> 指定需要映射的 IP</p></li><li><p><code>-u</code> 开启 <code>UDP</code> 打洞</p></li><li><p><code>-U</code> 开启 <code>UPnP</code> 映射</p></li><li><p><code>-v</code> 输出详细信息</p></li><li><p><code>-m</code> 配置转发方法</p><ul><li>在 Windows 下一般指定为 <code>socket</code>，<code>gost</code> 和 <code>socat</code> 也可用，但需要使用 <code>pip</code> 安装依赖</li></ul></li><li><p><code>-r</code> 不断重试，直到端口开放</p></li></ul><p>演示：映射本地 5421 端口，并使用 <code>UPnP</code> 映射，<code>socket</code> 转发</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl>python natter.py -p <span class=m>5421</span> -t 127.0.0.1 -U -v -m socket -r
</span></span></code></pre></div><p><figure><img src=https://7.isyangs.cn/55/66a62274c6407-55.png alt=image-20240728185024389 class="mx-auto my-0 rounded-md"><figcaption class=text-center>UPnP 打洞输出示例</figcaption></figure></p><div class="flex rounded-md bg-primary-100 px-4 py-3 dark:bg-primary-900"><span class="pe-3 text-primary-400"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 512 512"><path fill="currentcolor" d="M256 0C114.6.0.0 114.6.0 256s114.6 256 256 256 256-114.6 256-256S397.4.0 256 0zm0 128c17.67.0 32 14.33 32 32 0 17.67-14.33 32-32 32s-32-14.3-32-32 14.3-32 32-32zm40 256h-80c-13.2.0-24-10.7-24-24s10.75-24 24-24h16v-64h-8c-13.25.0-24-10.75-24-24s10.8-24 24-24h32c13.25.0 24 10.75 24 24v88h16c13.25.0 24 10.75 24 24s-10.7 24-24 24z"/></svg>
</span></span><span class=dark:text-neutral-300>需要注意的是，<code>socket</code>, <code>gost</code> 和 <code>socat</code> 都无法保留源 IP，转发所属的应用程序无法获得访客的真实 IP 和端口</span></div><h2 id=使用-natmap-进行映射 class="relative group">使用 natmap 进行映射 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e4%bd%bf%e7%94%a8-natmap-%e8%bf%9b%e8%a1%8c%e6%98%a0%e5%b0%84 aria-label=Anchor>#</a></span></h2><div class="flex rounded-md bg-primary-100 px-4 py-3 dark:bg-primary-900"><span class="pe-3 text-primary-400"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 512 512"><path fill="currentcolor" d="M506.3 417 293 53c-16.33-28-57.54-28-73.98.0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6c32.76.0 53.26-35 36.96-63zM232 168c0-13.25 10.75-24 24-24s24 10.8 24 24v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zm24 248c-17.36.0-31.44-14.08-31.44-31.44s14.07-31.44 31.44-31.44 31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/></svg>
</span></span><span class=dark:text-neutral-300><p>natmap <strong>仅支持 Linux、BSD 和 MacOS</strong>，Windows 上不可用</p><p>本部分书写于 natmap 20240603 版</p></span></div><p>首先从 release 上下载</p><div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl>wget https://github.com/heiher/natmap/releases/download/20240603/natmap-linux-x86_64 -O natmap
</span></span></code></pre></div><p>然后就可以开始打洞了</p><ol><li>TCP 转发模式</li></ol><p>​ 使用 <code>natmap -s turn.cloudflare.com -h example.com -b 80 -t 10.31.0.49 -p 80</code></p><p>​ 在这段代码中，我们使用 <code>turn.cloudflare.com</code> 作为 STUN 服务器（<code>-s turn.cloudflare.com</code>），<code>example.com</code> 作为保活服务器（<code>-h example.com</code>）, <code>80</code> 作为映射端口（<code>-p 80</code>）和 natmap 的绑定端口（<code>-b 80</code>），并指定映射到 <code>10.31.0.49</code> （<code>-t 10.31.0.49</code>）</p><ol><li>UDP 转发模式</li></ol><p>​ 使用 <code>natmap -s turn.cloudflare.com -h example.com -b 80 -t 10.31.0.49 -p 80 -u</code></p><p>​ 在这段代码中，我们使用 <code>turn.cloudflare.com</code> 作为 STUN 服务器（<code>-s turn.cloudflare.com</code>），<code>example.com</code> 作为保活服务器（<code>-h example.com</code>）, <code>80</code> 作为映射端口（<code>-p 80</code>）和 natmap 的绑定端口（<code>-b 80</code>），指定映射到 <code>10.31.0.49</code> （<code>-t 10.31.0.49</code>），并指定使用 UDP 转发模式（<code>-u</code>）</p><h3 id=命令行参数-1 class="relative group">命令行参数 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e5%91%bd%e4%bb%a4%e8%a1%8c%e5%8f%82%e6%95%b0-1 aria-label=Anchor>#</a></span></h3><p>详细可以查看 <a href="https://github.com/heiher/natmap?tab=readme-ov-file#usage" target=_blank rel=noreferrer>natmap - Usage</a>，此处介绍一些基本参数</p><ul><li><code>-u</code> 使用 UDP 转发模式</li><li><code>-s</code> 指定 STUN 服务器</li><li><code>-t</code> 指定需要映射的 IP</li><li><code>-p</code> 指定需要映射的端口</li></ul><h2 id=使用-lucky-进行映射 class="relative group">使用 Lucky 进行映射 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e4%bd%bf%e7%94%a8-lucky-%e8%bf%9b%e8%a1%8c%e6%98%a0%e5%b0%84 aria-label=Anchor>#</a></span></h2><p>本质和 Natter 以及 natmap 类似，可以参考 <a href=https://www.cometbbs.com/t/%E5%9F%BA%E4%BA%8Estun%E7%A9%BF%E9%80%8F%E5%B7%A5%E5%85%B7lucky%EF%BC%8C%E4%BD%BFbt%E5%AE%A2%E6%88%B7%E7%AB%AF%E7%BB%BF%E7%81%AF%E3%80%81%E5%BC%80%E6%94%BEtcp%E7%AB%AF%E5%8F%A3%E7%9A%84%E5%8A%9E%E6%B3%95%EF%BC%88%E8%BF%9B%E5%8C%96%E7%89%88%EF%BC%89/82042 target=_blank rel=noreferrer>基于stun穿透工具LUCKY，使BT客户端绿灯、开放TCP端口的办法（进化版）</a> 尝试</p><h2 id=使用-pcp-进行映射 class="relative group">使用 pcp 进行映射 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e4%bd%bf%e7%94%a8-pcp-%e8%bf%9b%e8%a1%8c%e6%98%a0%e5%b0%84 aria-label=Anchor>#</a></span></h2><div class="flex rounded-md bg-primary-100 px-4 py-3 dark:bg-primary-900"><span class="pe-3 text-primary-400"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 512 512"><path fill="currentcolor" d="M506.3 417 293 53c-16.33-28-57.54-28-73.98.0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6c32.76.0 53.26-35 36.96-63zM232 168c0-13.25 10.75-24 24-24s24 10.8 24 24v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zm24 248c-17.36.0-31.44-14.08-31.44-31.44s14.07-31.44 31.44-31.44 31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/></svg>
</span></span><span class=dark:text-neutral-300>此方法需要运营商和设备部署 pcp</span></div><ol><li>检查是否处于 CGN NAT（NAT444）类型</li></ol><p>查看拨号设备获取的 IP 地址，如果 IP 以 100.64 开头，说明处于 CGN NAT 类型（如下图）</p><p><figure><img src=https://7.isyangs.cn/55/66a623b6dded4-55.png alt=image-20240728185546885 class="mx-auto my-0 rounded-md"><figcaption class=text-center>CGN NAT 拨号获取示例</figcaption></figure></p><p>当然，并不是 CGN NAT 一定是 100.64 开头，可以自己尝试</p><ol start=2><li>克隆 pcp 并编译</li></ol><div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl>git clone https://github.com/libpcp/pcp.git <span class=o>&amp;&amp;</span> ./autogen.sh <span class=o>&amp;&amp;</span> ./configure <span class=o>&amp;&amp;</span> make <span class=o>&amp;&amp;</span> sudo make install
</span></span></code></pre></div><p>或者，你可以下载编译好的 2012 年版 pcp</p><p><a href=https://sourceforge.net/projects/pcpclient/ target=_blank rel=noreferrer>PCP Client download | SourceForge.net</a></p><ol start=3><li>探测设备是否部署 pcp</li></ol><div class=highlight><pre tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=cl>./pcp -i &lt;本地 / 局域网 IP&gt;:&lt;端口&gt; -e &lt;远程 IP&gt;:&lt;端口&gt; -t -l &lt;生命周期，如 3600&gt;
</span></span></code></pre></div><p>无论是否成功，终端都会返回类似 <code>1s 000ms 938us INFO : PCP server &lt;PCP Server IP> terminated.</code> 的输出</p><p>如果终端出现 <code>Flow signaling timed out.</code>，就代表这个设备没有部署 pcp</p><p><figure><img src=https://7.isyangs.cn/55/66a622dd5ec36-55.png alt=image-20240728185209442 class="mx-auto my-0 rounded-md"><figcaption class=text-center>尝试将光猫作为 PCP server 时出错</figcaption></figure></p><div class="flex rounded-md bg-primary-100 px-4 py-3 dark:bg-primary-900"><span class="pe-3 text-primary-400"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 512 512"><path fill="currentcolor" d="M506.3 417 293 53c-16.33-28-57.54-28-73.98.0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6c32.76.0 53.26-35 36.96-63zM232 168c0-13.25 10.75-24 24-24s24 10.8 24 24v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zm24 248c-17.36.0-31.44-14.08-31.44-31.44s14.07-31.44 31.44-31.44 31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z"/></svg>
</span></span><span class=dark:text-neutral-300><p>需要注意的是，如果光猫没有部署 pcp，但是路由器（如小米 AX9000）支持，你的端口将会映射到&lt;路由器 Ext. IP>:Port</p><p>具体 IP:Port 可以根据终端输出判断</p><p><figure><img src=https://7.isyangs.cn/55/66a6231fdeb69-55.png alt=image-20240728185315730 class="mx-auto my-0 rounded-md"><figcaption class=text-center>成功输出，框内为 &lt;Ext. IP>:Port</figcaption></figure></p></span></div><p>现在，你可以访问 IP:Port 查看映射效果</p><p><figure><img src=https://7.isyangs.cn/55/66a62351c13b3-55.png alt=image-20240728185405154 class="mx-auto my-0 rounded-md"><figcaption class=text-center>映射效果示例</figcaption></figure></p><h2 id=题外话关于光猫桥接与路由拨号模式的选择 class="relative group">题外话：关于光猫桥接与路由（拨号）模式的选择 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e9%a2%98%e5%a4%96%e8%af%9d%e5%85%b3%e4%ba%8e%e5%85%89%e7%8c%ab%e6%a1%a5%e6%8e%a5%e4%b8%8e%e8%b7%af%e7%94%b1%e6%8b%a8%e5%8f%b7%e6%a8%a1%e5%bc%8f%e7%9a%84%e9%80%89%e6%8b%a9 aria-label=Anchor>#</a></span></h2><p>已经是 2024 年了，过去的光猫改桥接是因为当时的光猫性能羸弱，PPPoE 协议的开销又很大，不改桥接速度跑不上去，因此当时的网民（甚至是装维）都会推荐改桥接</p><p>但随着光猫性能的提升，PPPoE 的开销对于现代光猫来说已经没有太大的负担。因此让光猫拨号，路由器 DHCP <strong>也许</strong>是现代的最佳方法</p><p>以及，现在很多地方开始使用 IPoE 代替 PPPoE，在这种模式下 “DHCP Option 的计算涉及到了动态的 Challenge Secret 和使用 SM3 、SM4 算法来生成，因此一段时间内是没有桥接并通过认证的方案，故暂时放弃。“</p><p>就算你所在的地方没有推行 IPoE，装维也会说现在不需要改桥接，<strong>也许你是为了公网 IP，但是公网 IP 与光猫拨号有什么关系呢？或者你是为了提高速度，但是现代光猫改桥接带来的网络提升可以忽略不计。亦或者你是为了实现 Full Cone，但在光猫 DMZ 路由器的情况下，这一层 NAT 可以轻松穿过。就算你改了桥接，运营商定时下发配置会变回路由模式，到时候家里无法上网，还得改一次桥接，属于费力不讨好。也许有人会说，删掉 TR069 就好了，但是运营商有时下发一些更新配置的时候怎么办？只能凉拌了</strong></p><p><strong>温馨提示：以上句段属于个人观点</strong></p><p>在 IPoE 未来普及的时候，“光猫将会内置 PPPoE 服务器，拓扑将会改变为：用户终端 - 用户自己路由器（ PPPoE 拨号）- 光猫（ PPPoE 服务器）- 光猫（ NAT ）- 光猫（ IPoE 的 WAN ）- 运营商出口”</p><h2 id=参考 class="relative group">参考 <span class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100"><a class="group-hover:text-primary-300 dark:group-hover:text-neutral-700" style=text-decoration-line:none!important href=#%e5%8f%82%e8%80%83 aria-label=Anchor>#</a></span></h2><ul><li><a href=https://info.support.huawei.com/info-finder/encyclopedia/zh/NAT.html target=_blank rel=noreferrer>什么是NAT？NAT的类型有哪些？ - 华为</a></li><li><a href=https://global.v2ex.com/t/460298 target=_blank rel=noreferrer>请教运营商分配内网 IP 时采用的 NAT 设备的 nat 类型是 full cone 的么 - V2EX</a></li><li><a href=https://github.com/MikeWang000000/Natter target=_blank rel=noreferrer>MikeWang000000/Natter</a></li><li><a href=https://github.com/heiher/natmap target=_blank rel=noreferrer>heiher/natmap</a></li><li><a href=https://github.com/libpcp/pcp target=_blank rel=noreferrer>libpcp/pcp</a></li><li><a href=https://v2ex.com/t/603512 target=_blank rel=noreferrer>介绍一个可能有助于 CGN NAT 端口映射的工具 - V2EX</a></li><li><a href=https://www.v2ex.com/t/871773 target=_blank rel=noreferrer>分享一个在 NAT1 下将端口打开到公网上的方法 - V2EX</a></li><li><a href=https://forum.openwrt.org/t/port-control-protocol-support/114411 target=_blank rel=noreferrer>Port Control Protocol support - For Developers - OpenWrt Forum</a></li><li><a href=https://www.v2ex.com/t/875362 target=_blank rel=noreferrer>电信又一新动作：上网业务不再使用 PPPoE 新装宽带无法改桥接 - V2EX</a></li></ul></div></section><footer class="pt-8 max-w-prose print:hidden"><div class=flex><picture class="!mb-0 !mt-0 me-4 w-24 h-auto rounded-full"><img width=4096 height=4096 class="!mb-0 !mt-0 me-4 w-24 h-auto rounded-full" alt=FloatSheep loading=lazy decoding=async src=/avatar_hu8c96a287a75bfd9f03af418858761485_108988_660x0_resize_q75_h2_box_2.webp srcset="/avatar_hu8c96a287a75bfd9f03af418858761485_108988_330x0_resize_q75_h2_box_2.webp 330w,/avatar_hu8c96a287a75bfd9f03af418858761485_108988_660x0_resize_q75_h2_box_2.webp 660w
,/avatar_hu8c96a287a75bfd9f03af418858761485_108988_1024x0_resize_q75_h2_box_2.webp 1024w
,/avatar_hu8c96a287a75bfd9f03af418858761485_108988_1320x0_resize_q75_h2_box_2.webp 1320w" sizes=100vw></picture><div class=place-self-center><div class="text-[0.6rem] uppercase leading-3 text-neutral-500 dark:text-neutral-400">Author</div><div class="font-semibold leading-6 text-neutral-800 dark:text-neutral-300">FloatSheep</div><div class="text-sm text-neutral-700 dark:text-neutral-400">On the other side of obstacles</div><div class="text-2xl sm:text-lg"><div class="flex flex-wrap text-neutral-400 dark:text-neutral-500"><a class="px-1 transition-transform hover:scale-125 hover:text-primary-700 dark:hover:text-primary-400" style=will-change:transform href=mailto:admin@hesiy.cn target=_blank aria-label=Email rel="me noopener noreferrer"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 512 512"><path fill="currentcolor" d="M207.8 20.73c-93.45 18.32-168.7 93.66-187 187.1-27.64 140.9 68.65 266.2 199.1 285.1 19.01 2.888 36.17-12.26 36.17-31.49l1e-4-.6631c0-15.74-11.44-28.88-26.84-31.24-84.35-12.98-149.2-86.13-149.2-174.2.0-102.9 88.61-185.5 193.4-175.4 91.54 8.869 158.6 91.25 158.6 183.2v16.16c0 22.09-17.94 40.05-40 40.05s-40.01-17.96-40.01-40.05v-120.1c0-8.847-7.161-16.02-16.01-16.02l-31.98.0036c-7.299.0-13.2 4.992-15.12 11.68-24.85-12.15-54.24-16.38-86.06-5.106-38.75 13.73-68.12 48.91-73.72 89.64-9.483 69.01 43.81 128 110.9 128 26.44.0 50.43-9.544 69.59-24.88 24 31.3 65.23 48.69 109.4 37.49C465.2 369.3 496 324.1 495.1 277.2V256.3c0-149.2-133.9-265.632-287.3-235.57zM239.1 304.3c-26.47.0-48-21.56-48-48.05s21.53-48.05 48-48.05 48 21.56 48 48.05-20.6 48.05-48 48.05z"/></svg>
</span></a><a class="px-1 transition-transform hover:scale-125 hover:text-primary-700 dark:hover:text-primary-400" style=will-change:transform href=https://hesiy.cn/ target=_blank aria-label=Link rel="me noopener noreferrer"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 640 512"><path fill="currentcolor" d="M172.5 131.1c55.6-55.59 148-55.59 203.6.0 50 50 57.4 129.7 16.3 187.2L391.3 319.9C381 334.2 361 337.6 346.7 327.3c-14.4-10.3-17.8-30.3-7.5-44.6L340.3 281.1C363.2 249 359.6 205.1 331.7 177.2c-31.4-31.4-82.5-31.4-114 0L105.5 289.5c-31.51 30.6-31.51 82.5.0 114C133.3 431.4 177.3 435 209.3 412.1L210.9 410.1C225.3 400.7 245.3 404 255.5 418.4 265.8 432.8 262.5 452.8 248.1 463.1L246.5 464.2c-58.4 41.1-136.3 34.5-186.29-15.4-56.469-56.5-56.469-148.1.0-204.5L172.5 131.1zM467.5 380c-56.5 56.5-148 56.5-204.5.0-50-50-56.5-128.8-15.4-186.3L248.7 192.1C258.1 177.8 278.1 174.4 293.3 184.7 307.7 194.1 311.1 214.1 300.8 229.3L299.7 230.9C276.8 262.1 280.4 306.9 308.3 334.8c31.4 31.4 82.5 31.4 114 0L534.5 222.5c31.5-31.5 31.5-83.4.0-114C506.7 80.63 462.7 76.99 430.7 99.9L429.1 101C414.7 111.3 394.7 107.1 384.5 93.58 374.2 79.2 377.5 59.21 391.9 48.94L393.5 47.82C451 6.731 529.8 13.25 579.8 63.24c56.5 56.46 56.5 148.06.0 204.46L467.5 380z"/></svg>
</span></a><a class="px-1 transition-transform hover:scale-125 hover:text-primary-700 dark:hover:text-primary-400" style=will-change:transform href=https://github.com/FloatSheep target=_blank aria-label=Github rel="me noopener noreferrer"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 496 512"><path fill="currentcolor" d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6.0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6.0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3.0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1.0-6.2-.3-40.4-.3-61.4.0.0-70 15-84.7-29.8.0.0-11.4-29.1-27.8-36.6.0.0-22.9-15.7 1.6-15.4.0.0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5.0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9.0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4.0 33.7-.3 75.4-.3 83.6.0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6.0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9.0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</span></a><a class="px-1 transition-transform hover:scale-125 hover:text-primary-700 dark:hover:text-primary-400" style=will-change:transform href="https://music.163.com/#/user/home?id=1431228228" target=_blank aria-label=Neteasemusic rel="me noopener noreferrer"><span class="icon relative inline-block px-1 align-text-bottom"><!doctype html><svg viewBox="0 0 1024 1024" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M628.76 5.89Q671.27-5.3 714.9 4.77q49.22 12.3 90.6 43.62 14.55 10.07 22.38 27.97 5.59 12.31 3.91 26.29-1.68 13.98-8.39 26.29-15.66 21.25-40.27 25.72-21.25 2.24-38.03-7.83l-17.9-13.42q-12.3-7.83-26.85-13.42t-30.21-5.59q-10.07 1.12-19.57 6.16-9.5 5.03-17.34 12.86-14.54 15.66-10.07 35.8l21.25 79.42q36.92 2.23 73.84 12.3 36.91 10.07 69.36 30.2 63.76 39.16 110.74 98.44 38.03 50.34 55.93 110.75 19.02 65.99 14.54 134.23-4.47 57.05-23.49 109.62-24.61 64.88-68.24 118.58t-102.92 90.62q-42.5 27.96-90.6 44.18-48.1 16.22-98.44 21.81-69.36 10.07-139.83-1.68-70.47-11.75-134.23-45.31-63.76-33.56-114.66-84.45t-84.46-114.1q-33.56-63.2-48.1-132.56-20.13-102.91 2.24-204.71 14.54-62.64 44.75-119.13t73.82-103.47q72.71-77.18 171.15-116.34 10.07-4.47 20.14-6.71 24.61-3.35 43.62 10.07 13.43 8.95 19.58 23.49 6.15 14.54 3.92 30.2-2.24 15.66-11.75 27.97t-25.17 17.91q-49.22 19.01-91.17 50.34-41.95 31.32-73.27 73.82-27.96 36.92-45.86 79.99-17.9 43.06-24.05 89.49t-.56 92.29 22.37 88.37q23.49 63.76 68.24 114.65Q306.6 840.39 367 871.73q72.71 38.03 155.49 38.03 68.23-1.12 130.87-23.49 55.93-20.14 100.68-60.41 41.39-35.79 67.12-85.01 13.42-24.61 21.25-51.46 11.19-38.03 12.31-78.3 1.12-40.27-10.07-79.42-10.07-32.44-28.53-60.4-18.46-27.97-44.18-50.35-22.38-19.01-48.1-34.67-22.38-12.31-48.1-17.9l35.79 136.47 5.59 32.44q1.12 35.8-10.06 69.91-11.19 34.12-33.56 60.4-22.37 26.29-51.45 43.63-29.09 17.34-61.53 22.94-35.8 6.71-71.59.55-35.8-6.15-65.44-25.17-29.64-19.01-50.33-46.42t-31.88-59.85q-12.31-35.8-13.42-74.95-2.24-41.39 8.38-81.66 10.63-40.27 35.24-74.95 27.97-40.27 68.8-68.24 40.83-27.96 88.93-41.38l-14.55-52.57q-8.94-29.09-6.7-59.29 2.23-30.2 15.65-57.05 14.55-30.2 40.27-52.58 29.09-23.49 64.88-34.67zM478.87 419.78q-25.73 27.96-33.56 63.76-6.71 33.55.0 65.99 3.36 17.9 12.87 34.12 9.5 16.22 24.05 27.41 25.73 16.78 55.94 11.18 26.84-5.59 45.3-26.29 18.46-20.69 19.58-48.65-2.24-12.31-5.6-25.73L558.3 372.79q-45.86 13.43-79.42 46.99z" fill="currentcolor"/></svg></span></a>
<a class="px-1 transition-transform hover:scale-125 hover:text-primary-700 dark:hover:text-primary-400" style=will-change:transform href=https://last.fm/user/FloatSheep target=_blank aria-label=Lastfm rel="me noopener noreferrer"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 512 512"><path fill="currentcolor" d="M225.8 367.1l-18.8-51s-30.5 34-76.2 34c-40.5.0-69.2-35.2-69.2-91.5.0-72.1 36.4-97.9 72.1-97.9 66.5.0 74.8 53.3 100.9 134.9 18.8 56.9 54 102.6 155.4 102.6 72.7.0 122-22.3 122-80.9.0-72.9-62.7-80.6-115-92.1-25.8-5.9-33.4-16.4-33.4-34 0-19.9 15.8-31.7 41.6-31.7 28.2.0 43.4 10.6 45.7 35.8l58.6-7c-4.7-52.8-41.1-74.5-100.9-74.5-52.8.0-104.4 19.9-104.4 83.9.0 39.9 19.4 65.1 68 76.8 44.9 10.6 79.8 13.8 79.8 45.7.0 21.7-21.1 30.5-61 30.5-59.2.0-83.9-31.1-97.9-73.9-32-96.8-43.6-163-161.3-163C45.7 113.8.0 168.3.0 261c0 89.1 45.7 137.2 127.9 137.2 66.2.0 97.9-31.1 97.9-31.1z"/></svg>
</span></a><a class="px-1 transition-transform hover:scale-125 hover:text-primary-700 dark:hover:text-primary-400" style=will-change:transform href=https://space.bilibili.com/384597455 target=_blank aria-label=Bilibili rel="me noopener noreferrer"><span class="icon relative inline-block px-1 align-text-bottom"><!doctype html><svg t="1722428520489" class="icon" viewBox="0 0 1024 1024" p-id="4278" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M977.2 208.2c33.4 36.2 48.8 79.4 46.6 131.4v404.8c-.8 52.8-18.4 96.2-53 130.2-34.4 34-78.2 51.8-131 53.4H184.04c-52.9-1.6-96.42-19.6-130.56-54.4C19.364 838.8 1.534 793 0 736.4V339.6c1.534-52 19.364-95.2 53.48-131.4 34.14-32.7 77.66-50.66 130.56-52.2h58.76l-50.7-51.62c-11.5-11.46-17.26-26-17.26-43.58.0-17.6 5.76-32.12 17.26-43.594C203.6 5.736 218.2.0 235.8.0s32.2 5.736 43.8 17.206L426.2 156h176l149-138.794C763.4 5.736 778.4.0 796 0s32.2 5.736 43.8 17.206C851.2 28.68 857 43.2 857 60.8c0 17.58-5.8 32.12-17.2 43.58L789.2 156h58.6c52.8 1.54 96 19.5 129.4 52.2zm-77.6 139.4c-.8-19.2-7.4-34.8-21.4-47-10.4-12.2-28-18.8-45.4-19.6H192.1c-19.18.8-34.9 7.4-47.16 19.6-12.28 12.2-18.8 27.8-19.56 47v388.8c0 18.4 6.52 34 19.56 47S173.7 803 192.1 803H832.8c18.4.0 34-6.6 46.6-19.6s19.4-28.6 20.2-47V347.6zM371 433c12.6 12.6 19.4 28.2 20.2 46.4V546c-.8 18.4-7.4 33.8-19.6 46.4-12.4 12.6-28 19-47.2 19s-35-6.4-47.2-19-18.8-28-19.6-46.4v-66.6c.8-18.2 7.6-33.8 20.2-46.4 12.6-12.6 26.4-19.2 46.6-20 18.4.8 34 7.4 46.6 20zm383 0c12.6 12.6 19.4 28.2 20.2 46.4V546c-.8 18.4-7.4 33.8-19.6 46.4s-28 19-47.2 19-34.8-6.4-47.2-19c-14-12.6-18.8-28-19.4-46.4v-66.6c.6-18.2 7.4-33.8 20-46.4 12.6-12.6 28.2-19.2 46.6-20 18.4.8 34 7.4 46.6 20z" p-id="4279" fill="currentcolor"/></svg></span></a></div></div></div></div><div class=pt-8><hr class="border-dotted border-neutral-300 dark:border-neutral-600"><div class="flex justify-between pt-3"><span><a class="group flex" href=/posts/simple-inverse-of-windhawk/><span class="me-2 text-neutral-700 transition-transform group-hover:-translate-x-[2px] group-hover:text-primary-600 dark:text-neutral dark:group-hover:text-primary-400"><span class="ltr:inline rtl:hidden">&larr;</span><span class="ltr:hidden rtl:inline">&rarr;</span></span>
<span class="flex flex-col"><span class="mt-[0.1rem] leading-6 group-hover:underline group-hover:decoration-primary-500">探索 | Windhawk 的简单逆向</span>
<span class="mt-[0.1rem] text-xs text-neutral-500 dark:text-neutral-400"><time datetime="2024-06-06 14:42:35 +0800 +0800">2024 年 06 月 06 日</time>
</span></span></a></span><span><a class="group flex text-right" href=/posts/xiaomi-router-advanced-usage/><span class="flex flex-col"><span class="mt-[0.1rem] leading-6 group-hover:underline group-hover:decoration-primary-500">探索 | 小米路由器 - 高级玩法</span>
<span class="mt-[0.1rem] text-xs text-neutral-500 dark:text-neutral-400"><time datetime="2024-08-13 20:11:47 +0800 +0800">2024 年 08 月 13 日</time>
</span></span><span class="ms-2 text-neutral-700 transition-transform group-hover:-translate-x-[-2px] group-hover:text-primary-600 dark:text-neutral dark:group-hover:text-primary-400"><span class="ltr:inline rtl:hidden">&rarr;</span><span class="ltr:hidden rtl:inline">&larr;</span></span></a></span></div></div><div class=pt-3><hr class="border-dotted border-neutral-300 dark:border-neutral-600"><div class=pt-3><link rel=stylesheet href=https://cdn.hesiy.cn/npm/@waline/client@latest/dist/waline.css><div id=comments-container><center><div class=loading></div></div></center></div><script type=module>
  import { init } from 'https://registry.npmmirror.com/@waline/client/latest/files/dist/waline.js';

  init({
    el: '#comments-container',
    serverURL: 'https://w-a.hesiy.cn',
    dark: 'html[class="scroll-smooth dark"]',
    search: false,
    reaction: [
      '//registry.npmmirror.com/@waline/emojis/1.2.0/files/tieba/tieba_agree.png',
      '//registry.npmmirror.com/@waline/emojis/1.2.0/files/tieba/tieba_look_down.png',
      '//registry.npmmirror.com/@waline/emojis/1.2.0/files/tieba/tieba_sunglasses.png',
      '//registry.npmmirror.com/@waline/emojis/1.2.0/files/tieba/tieba_pick_nose.png',
      '//registry.npmmirror.com/@waline/emojis/1.2.0/files/tieba/tieba_awkward.png',
    ],
    lang: 'zh-CN',
    emoji: [
      '//registry.npmmirror.com/@waline/emojis/1.2.0/files/bmoji',
    ],
  });
</script></div></div></footer></article></main><footer id=order-footer class="py-10 print:hidden"><nav class="pb-4 text-base font-medium text-neutral-500 dark:text-neutral-400"><ul class="flex list-none flex-col sm:flex-row"><li class="group mb-1 ltr:text-right rtl:text-left sm:mb-0 sm:me-7 sm:last:me-0"><a href=https://www.foreverblog.cn/ title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">十年之约</span></a></li><li class="group mb-1 ltr:text-right rtl:text-left sm:mb-0 sm:me-7 sm:last:me-0"><a href=/copyright/ title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">版权声明</span></a></li><li class="group mb-1 ltr:text-right rtl:text-left sm:mb-0 sm:me-7 sm:last:me-0"><a href=/sitemap.xml title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">网站地图</span></a></li><li class="group mb-1 ltr:text-right rtl:text-left sm:mb-0 sm:me-7 sm:last:me-0"><a href=/policy/ title><span class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2">隐私政策</span></a></li></ul></nav><div class="flex items-center justify-between"><div><p class="text-sm text-neutral-500 dark:text-neutral-400">© 2023 FloatSheep🤔<br>全站约
26,185 字 / 相当于《小王子》法文原版</p><p class="text-xs text-neutral-500 dark:text-neutral-400"><span>图床支持 </span><a class="hover:underline hover:decoration-primary-400 hover:text-primary-500" href=https://www.dogecast.com/ target=_blank rel="noopener noreferrer">DogeDoge</a><br><script>function checkStatus(){function e(){return localStorage.getItem("cachedFont")==="true"}e()}checkStatus()</script>Powered by <a class="hover:underline hover:decoration-primary-400 hover:text-primary-500" href=https://gohugo.io/ target=_blank rel="noopener noreferrer">Hugo</a> & <a class="hover:underline hover:decoration-primary-400 hover:text-primary-500" href=https://github.com/jpanther/congo target=_blank rel="noopener noreferrer">Congo</a></p><div class=timeContainer><span id=timeDate class="text-xs text-neutral-500 dark:text-neutral-400">锟斤拷</span><span id=times class="text-xs text-neutral-500 dark:text-neutral-400">锟斤拷</span>
<script>const now=new Date;function createtime(){const e=new Date("02/23/2020 15:46:12");now.setTime(now.getTime()+250),days=(now-e)/1e3/60/60/24,dnum=Math.floor(days),hours=(now-e)/1e3/60/60-24*dnum,hnum=Math.floor(hours),String(hnum).length==1&&(hnum="0"+hnum),minutes=(now-e)/1e3/60-24*60*dnum-60*hnum,mnum=Math.floor(minutes),String(mnum).length==1&&(mnum="0"+mnum),seconds=(now-e)/1e3-24*60*60*dnum-60*60*hnum-60*mnum,snum=Math.round(seconds),String(snum).length==1&&(snum="0"+snum),document.getElementById("timeDate").innerHTML="从初版博客起算，已运行 "+dnum+" 天 ",document.getElementById("times").innerHTML=hnum+" 小时 "+mnum+" 分 "+snum+" 秒"}setInterval("createtime()",250)</script></div></div><button id=refreshContainer onclick=window.fm.refresh() id=refresh-switcher type=button aria-label="Service Worker refresh controller"><div class="flex h-12 w-12 items-center justify-center dark:hidden" title="Refresh Service Worker"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 448 512"><path fill="currentcolor" d="M4e2 32H48C21.5 32 0 53.5.0 80v352c0 26.5 21.5 48 48 48h352c26.5.0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM144.5 319c-35.1.0-63.5-28.4-63.5-63.5s28.4-63.5 63.5-63.5 63.5 28.4 63.5 63.5-28.4 63.5-63.5 63.5zm159 0c-35.1.0-63.5-28.4-63.5-63.5s28.4-63.5 63.5-63.5 63.5 28.4 63.5 63.5-28.4 63.5-63.5 63.5z"/></svg></span></div><div class="hidden h-12 w-12 items-center justify-center dark:flex" title="Refresh Service Worker"><span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 448 512"><path fill="currentcolor" d="M4e2 32H48C21.5 32 0 53.5.0 80v352c0 26.5 21.5 48 48 48h352c26.5.0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM144.5 319c-35.1.0-63.5-28.4-63.5-63.5s28.4-63.5 63.5-63.5 63.5 28.4 63.5 63.5-28.4 63.5-63.5 63.5zm159 0c-35.1.0-63.5-28.4-63.5-63.5s28.4-63.5 63.5-63.5 63.5 28.4 63.5 63.5-28.4 63.5-63.5 63.5z"/></svg></span></div></button><div class="cursor-pointer text-sm text-neutral-700 hover:text-primary-600 dark:text-neutral dark:hover:text-primary-400"><button id=appearance-switcher-0 type=button aria-label="appearance switcher"><div class="flex h-12 w-12 items-center justify-center dark:flex" title="Switch to dark appearance"><theme-button value=light id=btn size=0.06></theme-button></div></button></div></div><script>function getCookie(e){const s=decodeURIComponent(document.cookie),t=s.split(";"),n=e+"=";for(let e=0;e<t.length;e++){const s=t[e].trim();if(s.indexOf(n)===0)return s.substring(n.length,s.length)}}document.addEventListener("DOMContentLoaded",e=>{document.mB&&typeof document.mB.show=="function"?getCookie("mbShow")!=="true"&&(document.mB.show("Service Worker 进行了重写！网页出现错误时，可以试试页面底部的两点按键！",!0,"我已知晓","#FFF","top-right",5e3),document.cookie="mbShow=true; path=/"):console.error("mB is not defined or show is not a function!"),pagemap(document.querySelector("#pagemap"),{viewport:null,styles:{"header,footer,section,article":"rgba(0,0,0,0.08)","h1,a":"rgba(0,0,0,0.10)","h2,h3,h4":"rgba(0,0,0,0.08)"},back:"rgba(0,0,0,0.02)",view:"rgba(0,0,0,0.05)",drag:"rgba(0,0,0,0.10)",interval:null})})</script></footer><div id=search-wrapper class="invisible fixed inset-0 z-50 flex h-screen w-screen cursor-default flex-col bg-neutral-500/50 p-4 backdrop-blur-sm dark:bg-neutral-900/50 sm:p-6 md:p-[10vh] lg:p-[12vh]" data-url=https://blog.hesiy.cn/><div id=search-modal class="top-20 mx-auto flex min-h-0 w-full max-w-3xl flex-col rounded-md border border-neutral-200 bg-neutral shadow-lg dark:border-neutral-700 dark:bg-neutral-800"><header class="relative z-10 flex flex-none items-center justify-between px-2"><form class="flex min-w-0 flex-auto items-center"><div class="flex h-8 w-8 items-center justify-center text-neutral-400"><span class="icon relative inline-block px-1 align-text-bottom"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="search" class="svg-inline--fa fa-search fa-w-16" role="img" viewBox="0 0 512 512"><path fill="currentcolor" d="M505 442.7 405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9.0 208 0S0 93.1.0 208s93.1 208 208 208c48.3.0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9.0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7.0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7.0 128 57.2 128 128 0 70.7-57.2 128-128 128z"/></svg></span></div><input type=search id=search-query class="mx-1 flex h-12 flex-auto appearance-none bg-transparent focus:outline-dotted focus:outline-2 focus:outline-transparent" placeholder=Search tabindex=0></form><button id=close-search-button class="flex h-8 w-8 items-center justify-center text-neutral-700 hover:text-primary-600 dark:text-neutral dark:hover:text-primary-400" title="Close (Esc)">
<span class="icon relative inline-block px-1 align-text-bottom"><svg viewBox="0 0 320 512"><path fill="currentcolor" d="M310.6 361.4c12.5 12.5 12.5 32.75.0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3 54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75.0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75.0-45.25s32.75-12.5 45.25.0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25.0s12.5 32.75.0 45.25l-105.4 105.4L310.6 361.4z"/></svg></span></button></header><section class="flex-auto overflow-auto px-2"><ul id=search-results></ul></section></div></div></div></body></html>