mirror of
https://codeberg.org/mayx/pages
synced 2026-01-02 04:23:40 +08:00
update
This commit is contained in:
344
2020/12/07/picore.html
Normal file
344
2020/12/07/picore.html
Normal file
@@ -0,0 +1,344 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<!-- Begin Jekyll SEO tag v2.8.0 -->
|
||||
<title>在树莓派上体验piCore | Mayx的博客</title>
|
||||
<meta name="generator" content="Jekyll v3.9.5" />
|
||||
<meta property="og:title" content="在树莓派上体验piCore" />
|
||||
<meta name="author" content="mayx" />
|
||||
<meta property="og:locale" content="zh_CN" />
|
||||
<meta name="description" content="麻雀虽小,五脏俱全" />
|
||||
<meta property="og:description" content="麻雀虽小,五脏俱全" />
|
||||
<meta property="og:site_name" content="Mayx的博客" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="article:published_time" content="2020-12-07T00:00:00+08:00" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta property="twitter:title" content="在树莓派上体验piCore" />
|
||||
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
|
||||
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
|
||||
<meta name="yandex-verification" content="fc0e535abed800be" />
|
||||
<script type="application/ld+json">
|
||||
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-12-07T00:00:00+08:00","datePublished":"2020-12-07T00:00:00+08:00","description":"麻雀虽小,五脏俱全","headline":"在树莓派上体验piCore","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/12/07/picore.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/12/07/picore.html"}</script>
|
||||
<!-- End Jekyll SEO tag -->
|
||||
|
||||
<link rel="canonical" href="https://mabbs.github.io/2020/12/07/picore.html" />
|
||||
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
|
||||
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
|
||||
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
|
||||
<link rel="stylesheet" href="/assets/css/style.css?v=1767196818" />
|
||||
<!--[if !IE]> -->
|
||||
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
|
||||
<!-- <![endif]-->
|
||||
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
|
||||
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
|
||||
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
|
||||
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
|
||||
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
|
||||
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
|
||||
<link rel="me" href="https://github.com/Mabbs" />
|
||||
<script src="/assets/js/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script>
|
||||
var lastUpdated = new Date("Thu, 01 Jan 2026 00:00:18 +0800");
|
||||
var BlogAPI = "https://summary.mayx.eu.org";
|
||||
</script>
|
||||
<script src="/assets/js/main.js"></script>
|
||||
<!--[if !IE]> -->
|
||||
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'UA-137710294-1');
|
||||
</script>
|
||||
|
||||
<script src="/assets/js/instant.page.js" type="module"></script>
|
||||
<!-- <![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript,这不影响你的浏览,但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
|
||||
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer,这不影响你的浏览,但可能会有一些功能无法使用……</small></marquee><![endif]-->
|
||||
<div class="wrapper">
|
||||
<header class="h-card">
|
||||
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
|
||||
|
||||
|
||||
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
|
||||
|
||||
|
||||
<p class="p-note">Mayx's Home Page</p>
|
||||
|
||||
<form action="/search.html">
|
||||
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." /> <input type="submit" value="搜索" />
|
||||
</form>
|
||||
<br />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
|
||||
|
||||
<ul class="downloads">
|
||||
|
||||
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
|
||||
|
||||
</ul>
|
||||
</header>
|
||||
<section class="h-entry">
|
||||
|
||||
<small><time class="date dt-published" datetime="2020-12-07T00:00:00+08:00">7 December 2020</time> - 字数统计:1998 - 阅读大约需要6分钟 - Hits: <span id="/2020/12/07/picore.html" class="visitors">Loading...</span></small>
|
||||
<h1 class="p-name">在树莓派上体验piCore</h1>
|
||||
|
||||
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
|
||||
<div id="outdate" style="display:none;">
|
||||
<hr /><p>
|
||||
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
|
||||
</p>
|
||||
</div>
|
||||
<script>
|
||||
daysold = Math.floor((new Date().getTime() - new Date("Mon, 07 Dec 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
|
||||
if (daysold > 90) {
|
||||
document.getElementById("outdate").style.display = "block";
|
||||
document.getElementById("outime").innerHTML = daysold;
|
||||
}
|
||||
</script>
|
||||
|
||||
<hr />
|
||||
|
||||
<b>AI摘要</b>
|
||||
<p id="ai-output">这篇文章介绍了在树莓派上体验piCore的操作系统选择和安装过程。作者原本考虑用树莓派作为网络资源共享设备,转向使用Tiny Core Linux的piCore发行版,因为它的安装包只有23MiB,非常适合资源有限的设备。piCore虽基于内存,但提供了解决数据持久化的方法,通过写入特殊文件。文章详细讲述了如何使用fdisk调整分区,如何用tce-ab简易安装软件(包括配置Wifi),以及与Raspberry Pi OS lite的对比,尽管体积小且功能类似,piCore因其小型、快速和特定的探索性质,更适合作者的使用需求。</p>
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
<ul><li><a href="#起因">起因</a></li><li><a href="#使用方法">使用方法</a><ul><li><a href="#扩大分区">扩大分区</a></li><li><a href="#安装软件">安装软件</a></li><li><a href="#配置wifi">配置Wifi</a></li></ul></li><li><a href="#与raspberry-pi-os-lite的对比">与Raspberry Pi OS lite的对比</a></li></ul>
|
||||
<hr />
|
||||
|
||||
|
||||
<main class="post-content e-content" role="main"><p>麻雀虽小,五脏俱全<!--more--></p>
|
||||
<h1 id="起因">
|
||||
|
||||
|
||||
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
|
||||
|
||||
|
||||
</h1>
|
||||
|
||||
<p>最近想让协会的打印机共享到网络上,但是又没有什么好的方法,如果用电脑的话体积有点太大了,所以我就考虑用树莓派来共享。 </p><p>
|
||||
我手头有一个吃灰多年的树莓派,有一个问题是我应该在上面装什么操作系统比较好?一般来说在树莓派上肯定是装官方的Raspberry Pi OS会更好一些,但是官方的系统很大,下载也有点慢,所以就想找个小一点的系统来处理。 </p><p>
|
||||
最终,我找到了一个叫做Tiny Core Linux的发行版,它有一个专门为树莓派开发的一个叫做piCore的发行版,下载下来只需要23MiB,可以说是非常不错了,毕竟就算是Raspberry Pi OS lite也要400多MiB。 </p><p>
|
||||
另外,点击<a href="http://www.tinycorelinux.net/12.x/aarch64/releases/RPi/piCore64-12.0.zip">这里</a>就可以下载安装包了。</p>
|
||||
<h1 id="使用方法">
|
||||
|
||||
|
||||
<a href="#使用方法"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 使用方法
|
||||
|
||||
|
||||
</h1>
|
||||
|
||||
<p>总体来说piCore还是挺不错的,文档写的也还可以,该有的功能基本上都有了。安装很简单,和树莓派一样直接把镜像写入MicroSD卡就可以直接使用了。不过有一个问题是它的系统不是直接挂载分区使用的,它的根目录是在内存里面的,所以如果直接断电所作的操作没有办法保存。 </p><p>
|
||||
不过他们提供了一种方案来解决这个问题,在对根目录下的文件进行操作后,可以执行<code class="language-plaintext highlighter-rouge">filetool.sh -b</code>把修改写到一个特别的文件里面,之后每一次开机系统都会读那个特别的文件来保持重启后数据不会丢失。 </p><p>
|
||||
第一次启动的时候系统会自动生成SSH的Key,所以第一次启动就要执行上面的命令。这些事情在README都有写。另外就是使用完整分区的问题,根据这个发行版的设计,所有的操作会写到第二个分区里面,但是默认情况下第二个分区只有16MiB,所以要扩大这个分区的大小。 </p><p>
|
||||
顺便一说,这个系统的默认用户名是tc,密码是piCore。 </p><p>
|
||||
扩大的方法在README里面也有写,但是全英文而且写的也不太清晰让我很难受,而且在国内貌似几乎没有人使用piCore,导致我第一次搞这个东西的时候很痛苦,所以我还是在这里记录一下吧。</p>
|
||||
<h2 id="扩大分区">
|
||||
|
||||
|
||||
<a href="#扩大分区"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 扩大分区
|
||||
|
||||
|
||||
</h2>
|
||||
|
||||
<p>首先第一步执行<code class="language-plaintext highlighter-rouge">sudo fdisk -u /dev/mmcblk0</code>,然后输入p查看分区,接下来记住第二个分区的StartLBA。记好以后输入d删除第二分区并且输入n重新创建分区。其中出现First Sector的时候输入刚刚记住的数字,其他的就默认就行了。最后输入w保存。 </p><p>
|
||||
很神奇的是用fdisk操作分区的时候并不会让被操作分区的数据丢失,貌似它只会修改分区表,也许这才是fdisk真正做的事情吧…… </p><p>
|
||||
在此之后需要重启一次,然后执行<code class="language-plaintext highlighter-rouge">resize2fs /dev/mmcblk0p2</code>让文件系统获得真正的大小就OK了。</p>
|
||||
<h2 id="安装软件">
|
||||
|
||||
|
||||
<a href="#安装软件"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 安装软件
|
||||
|
||||
|
||||
</h2>
|
||||
|
||||
<p>这个系统安装软件也很神奇,由于它的系统在内存中,安装软件肯定也不能直接安装到指定的位置。他们设计了一种很神奇的安装方法,就是把程序写到一个镜像里面,然后使用的时候挂载就可以用了。直接操作可能会比较麻烦,所以他们设计了一个脚本让任何人都可以随便安装软件。 </p><p>
|
||||
像debian系列的发行版都使用的是<code class="language-plaintext highlighter-rouge">apt</code>来管理软件的,piCore也整了一个类似的东西,叫做<code class="language-plaintext highlighter-rouge">tce-ab</code>,用起来比<code class="language-plaintext highlighter-rouge">apt</code>还要方便,它是一个可交互的脚本,想安装软件可以直接在里面搜索。方便确实很方便,而且清华源里也提供了这个系统的镜像源,还是挺不错的。 </p><p>
|
||||
不过卸载的时候就有点麻烦了,它貌似没有卸载的命令,需要自己手动去<code class="language-plaintext highlighter-rouge">/mnt/mmcblk0p2/tce/optional/</code>这个路径把软件删掉。不过其实还好,文件都在一起,倒是也没有特别的麻烦。</p>
|
||||
<h2 id="配置wifi">
|
||||
|
||||
|
||||
<a href="#配置wifi"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 配置Wifi
|
||||
|
||||
|
||||
</h2>
|
||||
|
||||
<p>因为piCore默认没有Wifi的驱动我还以为它不能用Wifi,不过还好,这个安装软件的功能可以直接安装Wifi的管理软件和驱动,用起来挺方便的,直接搜索wifi就可以安装,不过我在里面又找到了一个叫做<code class="language-plaintext highlighter-rouge">firmware-rpi-wifi</code>的包,虽然不知道需不需要安装,但是看起来好像需要的样子就安上了。 </p><p>
|
||||
还有一个问题就是即使安好后也不能自动连接Wifi,这个问题处理起来也很简单,第一次连Wifi是用的一个叫做<code class="language-plaintext highlighter-rouge">wifi.sh</code>的脚本,连好以后就可以在<code class="language-plaintext highlighter-rouge">/opt/bootlocal.sh</code>文件里写一句<code class="language-plaintext highlighter-rouge">wifi.sh -a</code>,这样它以后每次启动都会自动连接Wifi了。不过还有一点需要注意,在做完这些配置之后都需要执行<code class="language-plaintext highlighter-rouge">filetool.sh -b</code>来保证修改能在下一次重启的时候被应用。</p>
|
||||
<h1 id="与raspberry-pi-os-lite的对比">
|
||||
|
||||
|
||||
<a href="#与raspberry-pi-os-lite的对比"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 与Raspberry Pi OS lite的对比
|
||||
|
||||
|
||||
</h1>
|
||||
|
||||
<p>这样一波操作下来感觉基本上Raspberry Pi OS lite和piCore在功能上也没啥区别了吧,piCore不仅更快还更小,从安装包来看piCore要比Raspberry Pi OS lite小20倍! </p><p>
|
||||
这样看来还是piCore更好啊,为什么国内连相关的文章都搜不到呢?也许是因为piCore需要自己探索吧,大家一般都用的是树莓派官方的系统,而且因为Raspberry Pi OS lite用的是apt管理更方便所以就没人用piCore了吧…… </p><p>
|
||||
不过树莓派不就是用来折腾的嘛,所以我还是更支持piCore!😀</p></main>
|
||||
|
||||
|
||||
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E6%A0%91%E8%8E%93%E6%B4%BE"><em>树莓派</em></a> - <a rel="category tag" class="p-category" href="/search.html?keyword=piCore"><em>piCore</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-12-07-picore.md">查看原始文件</a></span></small>
|
||||
|
||||
|
||||
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
|
||||
<p id="suggest-container">Loading...</p>
|
||||
<script>
|
||||
var suggest = $("#suggest-container");
|
||||
$.get(BlogAPI + "/suggest?id=/2020/12/07/picore.html&update=" + lastUpdated.valueOf(), function (data) {
|
||||
if (data.length) {
|
||||
getSearchJSON(function (search) {
|
||||
suggest.empty();
|
||||
var searchMap = {};
|
||||
for (var i = 0; i < search.length; i++) {
|
||||
searchMap[search[i].url] = search[i];
|
||||
}
|
||||
|
||||
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
|
||||
for (var j = 0; j < data.length; j++) {
|
||||
var item = searchMap[data[j].id];
|
||||
if (item) {
|
||||
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
|
||||
var contentPreview = item.content.substring(0, 100);
|
||||
if (item.content.length > 100) {
|
||||
contentPreview += "……";
|
||||
}
|
||||
link.hover(
|
||||
function(e) {
|
||||
tooltip.text($(this).data('content'))
|
||||
.css({
|
||||
top: e.pageY + 10,
|
||||
left: e.pageX + 10
|
||||
})
|
||||
.show();
|
||||
},
|
||||
function() {
|
||||
tooltip.hide();
|
||||
}
|
||||
).mousemove(function(e) {
|
||||
tooltip.css({
|
||||
top: e.pageY + 10,
|
||||
left: e.pageX + 10
|
||||
});
|
||||
}).data('content', contentPreview);
|
||||
|
||||
suggest.append(link);
|
||||
suggest.append(' - ' + item.date + '<br />');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
suggest.html("暂无推荐文章……");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<br />
|
||||
<div class="pagination">
|
||||
|
||||
<span class="prev">
|
||||
<a href="/2020/11/24/createctf.html">
|
||||
上一篇:记一次组织CTF的经历
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<br />
|
||||
|
||||
<span class="next">
|
||||
<a href="/2020/12/13/nat.html">
|
||||
下一篇:关于内网穿透的笔记
|
||||
</a>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
<!--[if !IE]> -->
|
||||
<link rel="stylesheet" href="/assets/css/gitalk.css">
|
||||
<script src="/assets/js/gitalk.min.js"></script>
|
||||
|
||||
<div id="gitalk-container"></div>
|
||||
|
||||
<script>
|
||||
var gitalk = new Gitalk({
|
||||
clientID: '36557aec4c3cb04f7ac6',
|
||||
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
|
||||
repo: 'mabbs.github.io',
|
||||
owner: 'Mabbs',
|
||||
admin: ['Mabbs'],
|
||||
id: '/2020/12/07/picore', // Ensure uniqueness and length less than 50
|
||||
distractionFreeMode: false, // Facebook-like distraction free mode
|
||||
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
|
||||
})
|
||||
gitalk.render('gitalk-container')
|
||||
</script>
|
||||
<!-- <![endif]-->
|
||||
|
||||
</section>
|
||||
<!--[if !IE]> -->
|
||||
<div id="landlord" style="left:5px;bottom:0px;">
|
||||
<div class="message" style="opacity:0"></div>
|
||||
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
|
||||
<div class="live_talk_input_body">
|
||||
<form id="live_talk_input_form">
|
||||
<div class="live_talk_input_name_body" >
|
||||
<input type="checkbox" id="load_this" />
|
||||
<input type="hidden" id="post_id" value="/2020/12/07/picore.html" />
|
||||
<label for="load_this">
|
||||
<span style="font-size: 11px; color: #fff;"> 想问这篇文章</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="live_talk_input_text_body">
|
||||
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
|
||||
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<input name="live_talk" id="live_talk" value="1" type="hidden" />
|
||||
<div class="live_ico_box" style="display:none;">
|
||||
<div class="live_ico_item type_info" id="showInfoBtn"></div>
|
||||
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
|
||||
<div class="live_ico_item type_music" id="musicButton"></div>
|
||||
<div class="live_ico_item type_youdu" id="youduButton"></div>
|
||||
<div class="live_ico_item type_quit" id="hideButton"></div>
|
||||
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
|
||||
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
|
||||
<input id="duType" value="douqilai" type="hidden" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="open_live2d">召唤伊斯特瓦尔</div>
|
||||
<!-- <![endif]-->
|
||||
<footer>
|
||||
<p>
|
||||
<small>Made with ❤ by Mayx<br />Last updated at 2026-01-01 00:00:18<br /> 总字数:614622 - 文章数:178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
|
||||
</p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/js/scale.fix.js"></script>
|
||||
<!--[if !IE]> -->
|
||||
<script src="/assets/js/main_new.js"></script>
|
||||
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
|
||||
<script src="/Live2dHistoire/live2d/js/message.js"></script>
|
||||
<!-- <![endif]-->
|
||||
</body>
|
||||
</html>
|
||||
357
2020/12/13/nat.html
Normal file
357
2020/12/13/nat.html
Normal file
@@ -0,0 +1,357 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<!-- Begin Jekyll SEO tag v2.8.0 -->
|
||||
<title>关于内网穿透的笔记 | Mayx的博客</title>
|
||||
<meta name="generator" content="Jekyll v3.9.5" />
|
||||
<meta property="og:title" content="关于内网穿透的笔记" />
|
||||
<meta name="author" content="mayx" />
|
||||
<meta property="og:locale" content="zh_CN" />
|
||||
<meta name="description" content="为了更好的运用资源,内网穿透是必要的。" />
|
||||
<meta property="og:description" content="为了更好的运用资源,内网穿透是必要的。" />
|
||||
<meta property="og:site_name" content="Mayx的博客" />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="article:published_time" content="2020-12-13T00:00:00+08:00" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta property="twitter:title" content="关于内网穿透的笔记" />
|
||||
<meta name="google-site-verification" content="huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc" />
|
||||
<meta name="msvalidate.01" content="0ADFCE64B3557DC4DC5F2DC224C5FDDD" />
|
||||
<meta name="yandex-verification" content="fc0e535abed800be" />
|
||||
<script type="application/ld+json">
|
||||
{"@context":"https://schema.org","@type":"BlogPosting","author":{"@type":"Person","name":"mayx"},"dateModified":"2020-12-13T00:00:00+08:00","datePublished":"2020-12-13T00:00:00+08:00","description":"为了更好的运用资源,内网穿透是必要的。","headline":"关于内网穿透的笔记","mainEntityOfPage":{"@type":"WebPage","@id":"/2020/12/13/nat.html"},"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://avatars0.githubusercontent.com/u/17966333"},"name":"mayx"},"url":"/2020/12/13/nat.html"}</script>
|
||||
<!-- End Jekyll SEO tag -->
|
||||
|
||||
<link rel="canonical" href="https://mabbs.github.io/2020/12/13/nat.html" />
|
||||
<link type="application/atom+xml" rel="alternate" href="/atom.xml" title="Mayx的博客" />
|
||||
<link rel="alternate" type="application/rss+xml" title="Mayx的博客(RSS)" href="/rss.xml" />
|
||||
<link rel="alternate" type="application/json" title="Mayx的博客(JSON Feed)" href="/feed.json" />
|
||||
<link rel="stylesheet" href="/assets/css/style.css?v=1767196818" />
|
||||
<!--[if !IE]> -->
|
||||
<link rel="stylesheet" href="/Live2dHistoire/live2d/css/live2d.css" />
|
||||
<!-- <![endif]-->
|
||||
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Mayx的博客" />
|
||||
<link rel="webmention" href="https://webmention.io/mabbs.github.io/webmention" />
|
||||
<link rel="pingback" href="https://webmention.io/mabbs.github.io/xmlrpc" />
|
||||
<link rel="preconnect" href="https://summary.mayx.eu.org" crossorigin="anonymous" />
|
||||
<link rel="prefetch" href="https://www.blogsclub.org/badge/mabbs.github.io" as="image" />
|
||||
<link rel="blogroll" type="text/xml" href="/blogroll.opml" />
|
||||
<link rel="me" href="https://github.com/Mabbs" />
|
||||
<script src="/assets/js/jquery.min.js"></script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<script>
|
||||
var lastUpdated = new Date("Thu, 01 Jan 2026 00:00:18 +0800");
|
||||
var BlogAPI = "https://summary.mayx.eu.org";
|
||||
</script>
|
||||
<script src="/assets/js/main.js"></script>
|
||||
<!--[if !IE]> -->
|
||||
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-137710294-1"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'UA-137710294-1');
|
||||
</script>
|
||||
|
||||
<script src="/assets/js/instant.page.js" type="module"></script>
|
||||
<!-- <![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!--[if !IE]> --><noscript><marquee style="top: -15px; position: relative;"><small>发现当前浏览器没有启用JavaScript,这不影响你的浏览,但可能会有一些功能无法使用……</small></marquee></noscript><!-- <![endif]-->
|
||||
<!--[if IE]><marquee style="top: -15px; position: relative;"><small>发现当前浏览器为Internet Explorer,这不影响你的浏览,但可能会有一些功能无法使用……</small></marquee><![endif]-->
|
||||
<div class="wrapper">
|
||||
<header class="h-card">
|
||||
<h1><a class="u-url u-uid p-name" rel="me" href="/">Mayx的博客</a></h1>
|
||||
|
||||
|
||||
<img src="https://avatars0.githubusercontent.com/u/17966333" fetchpriority="high" class="u-photo" alt="Logo" style="width: 90%; max-width: 300px; max-height: 300px;" />
|
||||
|
||||
|
||||
<p class="p-note">Mayx's Home Page</p>
|
||||
|
||||
<form action="/search.html">
|
||||
<input type="text" name="keyword" id="search-input-all" placeholder="Search blog posts.." /> <input type="submit" value="搜索" />
|
||||
</form>
|
||||
<br />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="view"><a class="u-url" href="/Mabbs/">About me</a></p>
|
||||
|
||||
<ul class="downloads">
|
||||
|
||||
<li style="width: 270px; border-right: none;"><a href="/MayxBlog.tgz">Download <strong>TGZ File</strong></a></li>
|
||||
|
||||
</ul>
|
||||
</header>
|
||||
<section class="h-entry">
|
||||
|
||||
<small><time class="date dt-published" datetime="2020-12-13T00:00:00+08:00">13 December 2020</time> - 字数统计:1902 - 阅读大约需要6分钟 - Hits: <span id="/2020/12/13/nat.html" class="visitors">Loading...</span></small>
|
||||
<h1 class="p-name">关于内网穿透的笔记</h1>
|
||||
|
||||
<p class="view">by <a class="p-author h-card" href="//github.com/Mabbs">mayx</a></p>
|
||||
<div id="outdate" style="display:none;">
|
||||
<hr /><p>
|
||||
这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
|
||||
</p>
|
||||
</div>
|
||||
<script>
|
||||
daysold = Math.floor((new Date().getTime() - new Date("Sun, 13 Dec 2020 00:00:00 +0800").getTime()) / (24 * 60 * 60 * 1000));
|
||||
if (daysold > 90) {
|
||||
document.getElementById("outdate").style.display = "block";
|
||||
document.getElementById("outime").innerHTML = daysold;
|
||||
}
|
||||
</script>
|
||||
|
||||
<hr />
|
||||
|
||||
<b>AI摘要</b>
|
||||
<p id="ai-output">这篇文章讲述了内网穿透的必要性和原理,主要介绍了解决没有外网IP但又需要利用服务器资源的问题。作者介绍了几种方法:1) 利用NAT技术实现的数据主动转发,如内网穿透软件如UPnP和隧道技术(如通过SSH创建隧道);2) 利用VPNs建立安全隧道;3) 使用frp等服务的代理技术,方便用户直接访问;4) 端口映射,虽然需要路由器管理权限但提供不限速的连接。最后,作者选择了通过端口映射的方式,并计划用于IDC服务或贡献算力。</p>
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
|
||||
<ul><li><a href="#起因">起因</a></li><li><a href="#内网穿透的原理">内网穿透的原理</a></li><li><a href="#一些实现的方案">一些实现的方案</a><ul><li><a href="#利用vpn创建隧道">利用VPN创建隧道</a></li><li><a href="#ssh隧道">SSH隧道</a></li><li><a href="#某些服务商提供的frp">某些服务商提供的frp</a></li><li><a href="#端口映射">端口映射</a></li></ul></li><li><a href="#后记">后记</a></li></ul>
|
||||
<hr />
|
||||
|
||||
|
||||
<main class="post-content e-content" role="main"><p>为了更好的运用资源,内网穿透是必要的。<!--more--></p>
|
||||
<h1 id="起因">
|
||||
|
||||
|
||||
<a href="#起因"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 起因
|
||||
|
||||
|
||||
</h1>
|
||||
|
||||
<p>最近我的学校给我分配了一些服务器资源,大概在市场上价格基本上在1wCNY/mo的样子。这些资源非常好,但是有一个问题,那就是没有外网IP,想要运用这些资源必须要到机房。像机房那样的地方又冷又吵,不过我不在意,可惜问题不在这里,问题在于它只能在机房用,我又不能常常待在机房,那我到底应该怎么办呢? </p><p>
|
||||
其实解决方案很简单,那就是搞内网穿透。现在内网穿透的技术已经很多了,不过总体来说主要还是一个东西,那就是隧道。</p>
|
||||
<h1 id="内网穿透的原理">
|
||||
|
||||
|
||||
<a href="#内网穿透的原理"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 内网穿透的原理
|
||||
|
||||
|
||||
</h1>
|
||||
|
||||
<p>我大概查了一下相关的资料,一般来说内网是路由器自己划分出来的局域网。正常来说,如果想让所有的机器都登上外网,可以把路由器换成交换机,可惜换不得,毕竟外网IPv4的资源是有限的,就是插了交换机,也需要ISP分配IP地址给机器。 </p><p>
|
||||
根据我的了解,局域网和广域网进行通信的时候会用到一个叫做NAT的技术,大概原理就是路由器在内网访问外网时能把自己伪装成一般的电脑向其他服务器发送数据,发送过去的时候路由器会记住是哪个内网设备发送的数据,最终传回的数据路由器也会按原路转发回请求的主机,通过这样就可以把内网和外网联系起来。 </p><p>
|
||||
这时候就会有一个问题,那就是在这个过程中路由器和其他的电脑没有什么区别,假如在广域网的机器想要访问局域网的机器,那么正常来说就是直接访问那个路由器所在的IP就可以了,但是内网并没有发请求给广域网,路由器也不知道要把数据传给谁,它就会把这个数据丢掉。 </p><p>
|
||||
这个问题应该怎么解决?其实很简单,那就是连之前先由局域网的机器向想要访问这个机器的外网机器发送数据,这样外网机器就能顺理成章的连到内网的机器里面了,这确实是一个不错的解决方案,事实上现在几乎所有的内网穿透都是使用的这个方案。 </p><p>
|
||||
除此之外还有一个叫做UPnP的协议貌似也可以穿透,P2P应该都是用的这种方法,不过需要路由器支持才行。这种协议好像可以自动进行端口映射,大概是通过某种协议让路由器可以在内网机器没有主动发送数据的情况下把数据发送给内网机器吧,具体我也不是很清楚。 </p><p>
|
||||
另外如果有内网与外网相连的路由器的管理权限,也同样可以做到内网穿透,直接搞端口映射就完事,这种就更加简单了,但是一般情况下我们肯定没有路由器的管理权,不然也不至于这么苦恼了。</p>
|
||||
<h1 id="一些实现的方案">
|
||||
|
||||
|
||||
<a href="#一些实现的方案"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 一些实现的方案
|
||||
|
||||
|
||||
</h1>
|
||||
|
||||
<p>现在内网穿透的技术有很多,不过因为内网机器直接主动连外网这种方法比较简单,所以接下来说到的方法基本上都是通过这种方式的。</p>
|
||||
<h2 id="利用vpn创建隧道">
|
||||
|
||||
|
||||
<a href="#利用vpn创建隧道"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 利用VPN创建隧道
|
||||
|
||||
|
||||
</h2>
|
||||
|
||||
<p>VPN的原理是通过由主机主动向VPN服务器连接隧道并通过虚拟一个路由器组成VLAN的一种技术,通过这个介绍也能很明显看出来这是由主机主动发出的吧,通过这种方式即使不在内网中也可以让内网的电脑连自己的VPN来连接内网的电脑,以此再继续连到内网电脑所能连接的网络里面。 </p><p>
|
||||
这种方法算是比较简单,而且很安全的方式,不过可惜中国的好多ISP都屏蔽VPN,用这种方式不是很稳当。</p>
|
||||
<h2 id="ssh隧道">
|
||||
|
||||
|
||||
<a href="#ssh隧道"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> SSH隧道
|
||||
|
||||
|
||||
</h2>
|
||||
|
||||
<p>SSH这个软件很强大,有的功能也很多。既然VPN被屏蔽了那22端口总不至于屏蔽吧,总不能把运维的饭都给抢了吧?通过SSH隧道的方式使用起来也很简单,在公网服务器上打开sshd的GatewayPorts功能,内网设备通过执行类似于<code class="language-plaintext highlighter-rouge">ssh -fN -R 10022:localhost:22 远程用户@远程主机</code>这样的命令启动隧道,然后其他电脑就可以通过这个公网服务器连这个内网设备了。 </p><p>
|
||||
这种方法很不错,但是还是有一个问题,那就是需要租服务器(刚才的VPN同样需要),所以可以还有更好的方案。</p>
|
||||
<h2 id="某些服务商提供的frp">
|
||||
|
||||
|
||||
<a href="#某些服务商提供的frp"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 某些服务商提供的frp
|
||||
|
||||
|
||||
</h2>
|
||||
|
||||
<p>frp从名字上就能听出来它是一种代理吧,这种东西目前有很多服务商都有提供,比如SakuraFrp,还有花生壳啥的,当然如果手头有服务器也可以自己搭。这种的和前面几种不一样的是它反代出来的服务可以让其他用户直接用,很方便,不过有一个限制,就是一台服务器最多只能反代出64551个服务(不考虑tcp和udp的区别),正常人都是够用了。</p>
|
||||
<h2 id="端口映射">
|
||||
|
||||
|
||||
<a href="#端口映射"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 端口映射
|
||||
|
||||
|
||||
</h2>
|
||||
|
||||
<p>这是最好的方案,毕竟这样做可以保证不限速,而且也不需要外网服务器,但是路由器的管理权限很难搞,这确实没办法。</p>
|
||||
<h1 id="后记">
|
||||
|
||||
|
||||
<a href="#后记"><svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg></a> 后记
|
||||
|
||||
|
||||
</h1>
|
||||
|
||||
<p>所以最后我用了哪种方案呢?既然端口映射最好那当然是用这个啦!但是有一个问题是我没有路由器管理权,怎么办呢?没关系,这个路由器以前有人做过端口映射,只是现在没人用了而已,于是我就跟着这个配置把服务器设置成和被映射主机一样的IP,然后就可以用了。 </p><p>
|
||||
另外就是运用资源的问题了,这么多资源我自己用都想不出来干什么比较好,所以我考虑要不然搞IDC?总之在资源利用起来之前先让它们为世界做点贡献吧,这些服务器算力确实猛,在WCGrid里目前我的每日排名都能达到世界前200,确实厉害。</p></main>
|
||||
|
||||
|
||||
<small style="display: block">tags: <a rel="category tag" class="p-category" href="/search.html?keyword=%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F"><em>内网穿透</em></a> <span style="float: right;"><a href="https://gitlab.com/mayx/mayx.gitlab.io/tree/master/_posts/2020-12-13-nat.md">查看原始文件</a></span></small>
|
||||
|
||||
|
||||
<h4 style="border-bottom: 1px solid #e5e5e5;margin: 2em 0 5px;">推荐文章</h4>
|
||||
<p id="suggest-container">Loading...</p>
|
||||
<script>
|
||||
var suggest = $("#suggest-container");
|
||||
$.get(BlogAPI + "/suggest?id=/2020/12/13/nat.html&update=" + lastUpdated.valueOf(), function (data) {
|
||||
if (data.length) {
|
||||
getSearchJSON(function (search) {
|
||||
suggest.empty();
|
||||
var searchMap = {};
|
||||
for (var i = 0; i < search.length; i++) {
|
||||
searchMap[search[i].url] = search[i];
|
||||
}
|
||||
|
||||
var tooltip = $('<div class="content-tooltip"></div>').appendTo('body').hide();
|
||||
for (var j = 0; j < data.length; j++) {
|
||||
var item = searchMap[data[j].id];
|
||||
if (item) {
|
||||
var link = $('<a href="' + item.url + '">' + item.title + '</a>');
|
||||
var contentPreview = item.content.substring(0, 100);
|
||||
if (item.content.length > 100) {
|
||||
contentPreview += "……";
|
||||
}
|
||||
link.hover(
|
||||
function(e) {
|
||||
tooltip.text($(this).data('content'))
|
||||
.css({
|
||||
top: e.pageY + 10,
|
||||
left: e.pageX + 10
|
||||
})
|
||||
.show();
|
||||
},
|
||||
function() {
|
||||
tooltip.hide();
|
||||
}
|
||||
).mousemove(function(e) {
|
||||
tooltip.css({
|
||||
top: e.pageY + 10,
|
||||
left: e.pageX + 10
|
||||
});
|
||||
}).data('content', contentPreview);
|
||||
|
||||
suggest.append(link);
|
||||
suggest.append(' - ' + item.date + '<br />');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
suggest.html("暂无推荐文章……");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<br />
|
||||
<div class="pagination">
|
||||
|
||||
<span class="prev">
|
||||
<a href="/2020/12/07/picore.html">
|
||||
上一篇:在树莓派上体验piCore
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<br />
|
||||
|
||||
<span class="next">
|
||||
<a href="/2021/01/04/summary.html">
|
||||
下一篇:年终总结
|
||||
</a>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
<!--[if !IE]> -->
|
||||
<link rel="stylesheet" href="/assets/css/gitalk.css">
|
||||
<script src="/assets/js/gitalk.min.js"></script>
|
||||
|
||||
<div id="gitalk-container"></div>
|
||||
|
||||
<script>
|
||||
var gitalk = new Gitalk({
|
||||
clientID: '36557aec4c3cb04f7ac6',
|
||||
clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
|
||||
repo: 'mabbs.github.io',
|
||||
owner: 'Mabbs',
|
||||
admin: ['Mabbs'],
|
||||
id: '/2020/12/13/nat', // Ensure uniqueness and length less than 50
|
||||
distractionFreeMode: false, // Facebook-like distraction free mode
|
||||
proxy: "https://cors-anywhere.mayx.eu.org/?https://github.com/login/oauth/access_token"
|
||||
})
|
||||
gitalk.render('gitalk-container')
|
||||
</script>
|
||||
<!-- <![endif]-->
|
||||
|
||||
</section>
|
||||
<!--[if !IE]> -->
|
||||
<div id="landlord" style="left:5px;bottom:0px;">
|
||||
<div class="message" style="opacity:0"></div>
|
||||
<canvas id="live2d" width="500" height="560" class="live2d"></canvas>
|
||||
<div class="live_talk_input_body">
|
||||
<form id="live_talk_input_form">
|
||||
<div class="live_talk_input_name_body" >
|
||||
<input type="checkbox" id="load_this" />
|
||||
<input type="hidden" id="post_id" value="/2020/12/13/nat.html" />
|
||||
<label for="load_this">
|
||||
<span style="font-size: 11px; color: #fff;"> 想问这篇文章</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="live_talk_input_text_body">
|
||||
<input name="talk" type="text" class="live_talk_talk white_input" id="AIuserText" autocomplete="off" placeholder="要和我聊什么呀?" />
|
||||
<button type="submit" class="live_talk_send_btn" id="talk_send">发送</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<input name="live_talk" id="live_talk" value="1" type="hidden" />
|
||||
<div class="live_ico_box" style="display:none;">
|
||||
<div class="live_ico_item type_info" id="showInfoBtn"></div>
|
||||
<div class="live_ico_item type_talk" id="showTalkBtn"></div>
|
||||
<div class="live_ico_item type_music" id="musicButton"></div>
|
||||
<div class="live_ico_item type_youdu" id="youduButton"></div>
|
||||
<div class="live_ico_item type_quit" id="hideButton"></div>
|
||||
<input name="live_statu_val" id="live_statu_val" value="0" type="hidden" />
|
||||
<audio src="" style="display:none;" id="live2d_bgm" data-bgm="0" preload="none"></audio>
|
||||
<input id="duType" value="douqilai" type="hidden" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="open_live2d">召唤伊斯特瓦尔</div>
|
||||
<!-- <![endif]-->
|
||||
<footer>
|
||||
<p>
|
||||
<small>Made with ❤ by Mayx<br />Last updated at 2026-01-01 00:00:18<br /> 总字数:614622 - 文章数:178 - <a href="/atom.xml" >Atom</a> - <a href="/README.html" >About</a></small>
|
||||
</p>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/js/scale.fix.js"></script>
|
||||
<!--[if !IE]> -->
|
||||
<script src="/assets/js/main_new.js"></script>
|
||||
<script src="/Live2dHistoire/live2d/js/live2d.js"></script>
|
||||
<script src="/Live2dHistoire/live2d/js/message.js"></script>
|
||||
<!-- <![endif]-->
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user