<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/rss.xsl" type="text/xsl"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><generator>Typlog 3.1 (https://typlog.com)</generator><title><![CDATA[Zwei's Blog]]></title><description><![CDATA[We do choose who we become.]]></description><link>https://zweichen.com/</link><copyright><![CDATA[Copyright 2022 Zwei's Blog]]></copyright><atom:link href="https://zweichen.com/feed.xml" rel="self" type="application/rss+xml"/><atom:link href="https://pubsubhubbub.appspot.com/" rel="hub"/><pubDate>Fri, 28 Aug 2026 17:03:33 +0000</pubDate><item><title><![CDATA[一点关于上海电信IPTV微小的经验]]></title><guid>https://zweichen.com/posts/sh-iptv</guid><link>https://zweichen.com/posts/sh-iptv</link><description><![CDATA[群晖NAS转发上海电信的IPTV]]></description><pubDate>Sat, 19 Nov 2022 17:40:51 +0000</pubDate><content:encoded><![CDATA[<div class="blockquote"><blockquote><p>前段日子办了一条5元/月的宽带做备线，送了一路IPTV电视。稍微研究了下，现在可以在任何有网络的地方看家里的有线电视了。</p>
<p>做了一点微小的工作，记一点笔记，以防自己忘记。</p>
</blockquote></div>
<p>本篇文章需要有一些背景知识（VLAN、路由交换、Linux Shell），分享为主，看看就好。</p>
<details class="toc" open>
<summary>目录</summary>
<ul>
<li><a href="#toc_1">宽带本身</a></li>
<li><a href="#toc_2">上海电信IPTV</a>
<ul>
<li><a href="#toc_3">vlan 交换机单线复用连接光猫：</a></li>
</ul>
</li>
<li><a href="#toc_4">使用udpxy 实现组播转TCP单播流</a></li>
<li><a href="#toc_5">使用 Entware 给nas 安装udpxy</a>
<ul>
<li><a href="#toc_6">组播地址哪里来</a></li>
</ul>
</li>
<li><a href="#toc_7">在安卓电视/Apple TV 上 看IPTV流</a></li>
</ul>
</details>
<h2 id="toc_1">宽带本身</h2>
<p>在营业厅办理了一条上海电信魔都在线宽带，五块钱一个月。根据套餐协议，互联网速率默认4Mbps(512KB/s)，访问部份网站（上海网课，城市新闻等）为100Mbps(10MB/s),赠送一条IPTV。</p>
<p>该宽带也属于上海电信推的云宽带业务（光猫作为鉴权，不承担网关作用），NAT网关和DHCP服务在电信的机房，类似云服务的VPC。
出于安全原因，建议加一个自己的路由器避免整个二层网络暴露。云宽带因为有VPC的特性（有直接升级到混合云架构的潜质），提供了一些云硬盘（类似电信运维的SMB共享盘）之类的业务，期待后续电信可以提供更多业务，比如购买电信的云主机可以直接加入家庭宽带的内部网络，采购IPV4、V6，加入SDWAN增值服务等。</p>
<p>上海电信的云宽带内网目前是192.168.71.X网段，无法取得公网IP。（因为鄙户有俩条宽带，一条有公网IP实现从外部接入内网，利用另一条宽带完成IPTV访问。）</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8331164455_534515.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_804/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8331164455_534515.png" alt="image.png"loading="lazy" decoding="async" width="804" height="1014" /></picture></figure></div><h2 id="toc_2">上海电信IPTV</h2>
<p>上海电信的IPTV业务，由电信的网络加上一个IPTV的机顶盒构成。
过去电视直播需要通过模拟信号传输，而IPTV则是通过tcp/ip网络完成数字信号的传输。相比模拟信号+铜电缆，性能提高的基础上价格大大降低了。</p>
<p>上海电信的IPTV 的网络是一个单独的vlan 85，电脑连接在光猫上，新建一个vlan85（802.1Q）的网络，就可以分到一个IPTV的地址。该地址无法访问互联网，但是可以访问IPTV的所有RTP服务。</p>
<p>比如：
我在mac上，新建了一个vlan 85，使用有线网卡连接，就可以收到IPTV的DHCP Server 分给网卡的一个IP。</p>
<p>此时，我就可以打开播放器，打开以下地址: <code>rtp://239.45.3.209:5140</code>,播放 IPTV的某一电视频道。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8331162586_34028.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1266/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8331162586_34028.png" alt="image.png"loading="lazy" decoding="async" width="1266" height="798" /></picture></figure></div><p>IPTV的机顶盒的网络其实稍微复杂点，它的网口应该虚拟了3个网口（DHCP，VLAN51和VLAN85）</p>
<p>晚上查到很多人非要把IPTV挂在家庭路由器下面，又要在Openwrt里面设置VLAN，设置DHCP-OPTION啥的。</p>
<p>还有人花了一张IPTV业务鉴权的示意图。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8331130590_380643.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1280/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8331130590_380643.png" alt="image.png"loading="lazy" decoding="async" width="1280" height="720" /></picture></figure></div><p>其实多布一条网线直接插光猫上就好了，我爷爷房间的wifi走室外的AP，网线直接怼光猫上就好了。</p>
<h3 id="toc_3">vlan 交换机单线复用连接光猫：</h3>
<p>当然，我闲来无事也测试了<strong>单线复用的方法</strong>：交换机连接光猫的口设置vlan 51，vlan 85 打TAG，vlan 100（选一个没人用的vlan 即可，该vlan就是为了在交换机里虚拟成为一条网线，避免和家里的vlan冲突）。</p>
<p>连接IPTV盒子的口一样设置vlan 51 - tag，vlan 85 - tag，vlan 100 untag，多个交换机记得把上联口打上TAG。</p>
<p>这样的效果就是IPTV的盒子和光猫就可以在正常传输A面网和B面的网络（vlan 85）（虽然我也不知道为啥IPTV为啥这么叫）。</p>
<p><strong>到此，介绍了一些IPTV的背景知识，1.如何在家里可以正常使用IPTV盒子看IPTV，以及 2.如何不用IPTV盒子，直接拿专网地址看IPTV。</strong></p>
<h2 id="toc_4">使用udpxy 实现组播转TCP单播流</h2>
<p>当然可以直接把电信IPTV专网（vlan 85）转发出来，直接看电视，但是电信IPTV的rtp视频流是基于udp的组播流，也就意味着会在同一个广播域（无论Wi-Fi还是有线）中广播。这是需要极力避免的。</p>
<p><a href="https://github.com/pcherenkov/udpxy">Udpxy</a>的作用是将组播的数据流变成TCP协议的单播流，避免了在数据链路层广播。</p>
<p>虽然手上有一些拼多多上买的板子，不过我这里还是装在了家里的群晖上，因为这个NAS正好有俩网口，反正也一直开着。单网口的设备（比如一些安装了Openwrt的电视盒子）也可以，因为专网走的vlan 85，本来就是虚拟的网卡。</p>
<p>运行Udpxy 的效果就是下面的样子：</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8331125652_043183.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_826/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8331125652_043183.png" alt="image.png"loading="lazy" decoding="async" width="826" height="569" /></picture></figure></div><p>比如我使用的udpxy server ，在局域网里的地址是 zweisudpxy.local，就可以把原有的播放地址比如 <code>rtp://239.45.3.209:5140</code> 就变成了<code> http://zweisudpxy.local:4022/udp/239.45.3.209:5140</code>。</p>
<p><a href="https://github.com/rozhuk-im/msd_lite">msd_lite</a> 其实也是一个东西，性能相比udpxy更好（<a href="https://www.right.com.cn/forum/thread-8251367-1-1.html">据说好十倍</a>）有空测试下。
因为我的群晖（J4125）性能还可以，其实没那么大的性能优化需求。</p>
<h2 id="toc_5">使用 Entware 给nas 安装udpxy</h2>
<p>这部份也记一下，其实不只是群晖的NAS，大部份linux，openwrt盒子之类的东西也都被Entware 支持。</p>
<p>Entware-ng 是一个适用于嵌入式系统的软件包库，使用 opkg 包管理系统进行管理，udpxy或者msd也都受支持。</p>
<p>无需Docker，即使是入门级的 arm的 nas也可以安装。直接参考Github上面的<a href="https://github.com/Entware/Entware/wiki/Install-on-Synology-NAS">官方文档</a>即可。</p>
<p>装完后重启，就可以使用<code>opkg</code> 命令：</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8331124550_135771.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1132/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8331124550_135771.png" alt="image.png"loading="lazy" decoding="async" width="1132" height="216" /></picture></figure></div><p>添加一个开机后执行的计划任务：</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8331124455_092167.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1022/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8331124455_092167.png" alt="image.png"loading="lazy" decoding="async" width="1022" height="412" /></picture></figure></div><p><code>sudo -H -u username bash -c 'echo &quot;I am $USER, with uid $UID&quot;; </code>
<code>/opt/bin/udpxy -T -S -p 4022 -m eth1.85 -c 10'</code></p>
<p>其中： username，4022，eth1.85 自行根据你的用户名，服务端口与IPTV 专网的网卡（ifconfig 查看）填写。</p>
<h3 id="toc_6">组播地址哪里来</h3>
<p>虽然可以自己抓包来取得（IPTV开机的时候会有一个节目单），不过因为iptv 的地址基本不变化，只需要下载<a href="https://github.com/ihipop/Shanghai-IPTV">别人准备好的文件</a>，将rtp的部份，替换为自己的单播地址即可。</p>
<p>最后将文件保存为m3u，存在nas或者网络上，在电视上加载。</p>
<h2 id="toc_7">在安卓电视/Apple TV 上 看IPTV流</h2>
<p>安卓电视请使用Kodi 安装 PVR IPTV Simple Client插件，效果如下：</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8331124021_662428.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1489/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8331124021_662428.png" alt="image.png"loading="lazy" decoding="async" width="1489" height="838" /></picture></figure></div><p>Apple TV的话，可以使用iPlayTV 或者 APTV 这俩APP，效果如下：
( Apple TV 没法截图，用iPad了。）</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8331120811_528772.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800/format,webp 1x, https://i.typlog.com/zwei/8331120811_528772.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600/format,webp 2x" media="(min-width: 800px)" type="image/webp"><source srcset="https://i.typlog.com/zwei/8331120811_528772.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800 1x, https://i.typlog.com/zwei/8331120811_528772.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600 2x" media="(min-width: 800px)"><img src="https://i.typlog.com/zwei/8331120811_528772.jpg" alt="DF77441A-BD18-4C5E-91D0-D6B112C51794_1_102_o.jpeg"loading="lazy" decoding="async" width="2128" height="1479" /></picture></figure></div>]]></content:encoded></item><item><title><![CDATA[构建JupyterHub 多用户环境]]></title><guid>https://zweichen.com/posts/deployJupyterhub</guid><link>https://zweichen.com/posts/deployJupyterhub</link><pubDate>Mon, 31 Oct 2022 15:53:38 +0000</pubDate><content:encoded><![CDATA[<div class="blockquote"><blockquote><p>JupyterHub 是为多个用户提供 JupyterLab 的集成服务系统，每个用户相互隔离。在 JupyterHub 版本低于 2.0.0 时，可采用该方法部署。本篇介绍对于 JupyterHub 2.X （截止到2022年12月21日）的部署方法。</p>
</blockquote></div>
<div class="blockquote"><blockquote><p>相关环境是 miniconda, ubuntu 2004，所有命令以 root 用户运行。</p>
</blockquote></div>
<h2>安装 miniconda</h2>
<h3>切换到主目录，下载miniconda并安装</h3>
<p><code>wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh</code></p>
<p><code>chmod +x Miniconda3-latest-Linux-x86_64.sh</code></p>
<p><code>./Miniconda3-latest-Linux-x86_64.sh</code></p>
<p>这里需要选择安装在 <code>/usr/local/miniconda</code> 路径</p>
<h3>添加环境到root用户的Bashrc</h3>
<p><code>echo 'export PATH=/usr/local/miniconda/bin:$PATH' &gt;&gt; /etc/profile</code></p>
<p><code>source /etc/profile</code></p>
<p><code>echo 'export PATH=/usr/local/miniconda/bin:$PATH' &gt;&gt; .bashrc</code></p>
<h3>设置路径权限</h3>
<p>目前/usr/local/miniconda 只有root可以访问。</p>
<p><strong>创建一个miniconda用户组</strong>
<code>groupadd miniconda</code></p>
<p><strong>给miniconda用户组路径权限</strong>
<code>chgrp -R miniconda /usr/local/miniconda</code></p>
<p><code>chmod 770 -R /usr/local/miniconda</code></p>
<p><strong>将用户添加到 miniconda组</strong>
<code>usermod -a -G miniconda root</code></p>
<p><strong>多用户的话使用Adduser username 创建用户，然后添加到用户组</strong></p>
<p><code>usermod -a -G miniconda User</code></p>
<p><strong>有需要的话，添加路径到普通用户</strong>
<code>echo 'export PATH=/usr/local/miniconda/bin:$PATH' &gt;&gt; /home/user/.bashrc</code></p>
<h3>使得环境变量对当前用户生效</h3>
<p><code>source .bashrc</code></p>
<p>如果添加新的用户(如 userA)使用 jupyterhub，后续只需要将该用户 userA 添加到组 miniconda 中即可，方法如下</p>
<p><code>sudo usermod -a -G miniconda userA</code></p>
<p>删除用户方法如下，即把用户 userA 从组miniconda中删除。然后重启jupyterhub
<code>sudo gpasswd -d userA miniconda</code></p>
<h2>给conda环境安装常用包</h2>
<p><code>pip install --upgrade pip </code></p>
<p><code>pip install jupyterhub jupyterlab pandas matplotlib youtube_dl numba boost scipy numpy sympy scikit-learn opencv-contrib-python Pillow</code></p>
<p><code>pip install jupyterlab_code_formatter</code></p>
<p><code>jupyter server extension enable jupyterlab_code_formatter</code></p>
<p><code>pip install black isort</code></p>
<h2>在Nodejs 安装 configurable-http-proxy</h2>
<p><code>apt install nodejs npm -y</code></p>
<p><code>npm install -g configurable-http-proxy</code></p>
<h2>生成jupyterhub 配置文件</h2>
<p><code>jupyterhub --generate-config</code></p>
<p><code>mkdir -p /etc/jupyterhub</code></p>
<p><code>mv jupyterhub_config.py /etc/jupyterhub/config.py</code></p>
<h3>使得普通用户 userA 也能够在该目录创建文件</h3>
<p><code>chown -R userA /etc/jupyterhub/</code></p>
<h2>设置 AAA 为 base url, userA 为管理员用户</h2>
<p><code>echo &quot;c.PAMAuthenticator.open_sessions = False&quot; &gt;&gt; /etc/jupyterhub/config.py</code></p>
<p><code>echo &quot;c.JupyterHub.base_url = '/AAA'&quot; &gt;&gt; /etc/jupyterhub/config.py</code></p>
<p><code>echo &quot;c.JupyterHub.hub_ip = '0.0.0.0'&quot; &gt;&gt; /etc/jupyterhub/config.py</code></p>
<p><code>echo &quot;c.Authenticator.delete_invalid_users = True&quot; &gt;&gt; /etc/jupyterhub/config.py</code></p>
<p><code>echo &quot;c.Authenticator.admin_users = set(['userA'])&quot; &gt;&gt; /etc/jupyterhub/config.py</code></p>
<p><code>echo &quot;c.JupyterHub.admin_access = True&quot; &gt;&gt; /etc/jupyterhub/config.py</code></p>
<p><code>echo &quot;c.Spawner.cmd = ['/usr/local/miniconda/bin/jupyterhub-singleuser']&quot; &gt;&gt; /etc/jupyterhub/config.py</code></p>
<h2>systemctl</h2>
<p>创建文件<code> /etc/systemd/system/jupyterhub.service</code>，写入内容如下</p>
<div class="block-code" data-language="bash"><div class="highlight"><pre><span></span><code><div class="line"><span class="o">[</span>Unit<span class="o">]</span>
</div><div class="line"><span class="nv">Description</span><span class="o">=</span>Jupyterhub service
</div><div class="line"><span class="nv">After</span><span class="o">=</span>syslog.target network.target
</div><div class="line">
</div><div class="line"><span class="o">[</span>Service<span class="o">]</span>
</div><div class="line"><span class="nv">ExecStart</span><span class="o">=</span>/usr/local/miniconda/bin/jupyterhub -f /etc/jupyterhub/config.py
</div><div class="line"><span class="nv">WorkingDirectory</span><span class="o">=</span>/etc/jupyterhub/
</div><div class="line">
</div><div class="line"><span class="o">[</span>Install<span class="o">]</span>
</div><div class="line"><span class="nv">WantedBy</span><span class="o">=</span>multi-user.target
</div></code></pre></div>
</div>
<p>使用：</p>
<div class="block-code"><pre><code>systemctl status jupyterhub.service
systemctl start jupyterhub.service
systemctl stop jupyterhub.service
systemctl enable jupyterhub.service</code></pre></div>
]]></content:encoded></item><item><title><![CDATA[网络2: 踩坑别墅户型网络——网友案例分享]]></title><guid>https://zweichen.com/posts/network-share-friends-2022</guid><link>https://zweichen.com/posts/network-share-friends-2022</link><description><![CDATA[梦想中的豪宅]]></description><pubDate>Mon, 31 Oct 2022 15:40:20 +0000</pubDate><content:encoded><![CDATA[<div class="blockquote"><blockquote><p>本篇文章是在v2ex论坛上的坛友-卢克进分享的，最早是论坛的帖子，我看到后感到十分兴奋。</p>
<p>因为对于大户型的别墅，覆盖无线是更加困难的，需要合理的规划+优质的设备。</p>
<p>卢克进的豪宅中网络就采用了Ubnt（现在改名叫Ubiquiti）的全家桶。无线覆盖的整体设备目前价格应该在一万三左右。</p>
<p>如果普通家庭如果可以预留好位置，某些地方多穿点网线应该还可以省2交换机，再便宜三五千。</p>
</blockquote></div>
<p>现在他将本篇文章放在了<a href="https://kejinlu.com/2022/10/home-network/">他的博客</a>上。
引用部分为我的评论。</p>
<details class="toc" open>
<summary>目录</summary>
<ul>
<li><a href="#toc_1">选型</a>
<ul>
<li><a href="#toc_2">AP还是Mesh？</a></li>
<li><a href="#toc_3">千兆还是万兆？</a></li>
</ul>
</li>
<li><a href="#toc_4">布线</a></li>
<li><a href="#toc_5">网络设备</a>
<ul>
<li><a href="#toc_6">地下室机柜</a></li>
<li><a href="#toc_7">二楼中继弱电箱</a></li>
<li><a href="#toc_8">AP</a></li>
</ul>
</li>
<li><a href="#toc_9">使用场景举例</a>
<ul>
<li><a href="#toc_10">影视多媒体</a></li>
<li><a href="#toc_11">远程访问</a></li>
<li><a href="#toc_12">科学上网</a></li>
<li><a href="#toc_13">iTV</a></li>
<li><a href="#toc_14">IoT</a></li>
</ul>
</li>
</ul>
</details>
<h2 id="toc_1">选型</h2>
<h3 id="toc_2">AP还是Mesh？</h3>
<p>对于小户型选一个穿墙能力强的路由器放在房子中央位置基本就能全屋覆盖。对于大户型一般就AC+AP 和Mesh两种方案，AC+AP需要提前布好网线连接AP，Mesh的话则相对自由一些，可以通过无线回程进行Mesh组网，但是稳定性上肯定不如AC+AP的方案（有线回程的Mesh估计好点）,而且一般情况下AP的带机量也是远远大于Mesh的。</p>
<h3 id="toc_3">千兆还是万兆？</h3>
<p>目前来说大部分内网使用场景千兆是完全可以满足需求的比如4K视频播放，VR（比如Quest2无线串流），目前家庭万兆的使用场景一般是万兆NAS在线视频剪辑，需要频繁内网设备之间高速拷贝数字内容，多人同时需要超高速内网访问。 外网宽带目前一般最高也就是千兆，除非你拉专线价格非常高或者多个账号叠加拨号，一般都很少用到。 另外现在好一点的万兆网络设备都价格不菲。 虽然现在不上万兆，但是我们也得为日后的万兆升级做好准备。</p>
<h2 id="toc_4">布线</h2>
<p>如果房子是自己装修，那么就可以完全按照自己的想法来，如果是精装修好的房子那么就局限比较多了，顶多就是换换线。 在装修之前我们先要想好弱电箱的位置，然后所有的网线都汇聚在此，如果空间足够，专门整个弱电间也是ok的。机柜或者设备放在柜子里面的，需要提前考虑好散热风道之类的，可以打散热孔加散热风扇。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851447_122261.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851447_122261.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p>我这边是设计了储藏间当弱电间，弱电间放机柜，然后由于从地下室机柜端拉网线到二层三层网线会非常长，所以二层设置一个弱电箱 作为一个交换机中继节点，二楼三楼的网络端口都汇聚到这个弱电箱。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851397_095787.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_627/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851397_095787.png" alt="image.png"loading="lazy" decoding="async" width="627" height="855" /></picture></figure></div><p>网线六类足够了，50米的六类线万兆的速度是绝对没有问题的，另外尽量不要用屏蔽线，除非你能确保屏蔽线都能正确的接地。主干节点之间如有必要布网线的同时也可以布上光纤，万兆网络时，光口光纤无论能耗发热都优于电口网线。 其他要注意的点就是 汇聚到机柜端的网线的收口的美观，你可以使用空白面板， 如果网线太多，86面板盒塞不下也可以不用线盒，直接墙壁上安装防水盒，防水盒开孔来引出网线。</p>
<p>剩下就是所有网线提前做好规划，进行布线</p>
<ul>
<li>规划好网口面板的位置，比如电视机，电脑，别的有线网络设备等，每个房间都需要预留网口</li>
<li>提前规划好AP的位置，吸顶，壁挂或者面板AP，所有的AP都通过POE进行供电</li>
<li>提前规划好户外POE摄像头位置</li>
<li>特定设备布上网线到弱电箱或者机柜（因为网线八根铜线有时候可以用作信号线，比如用于传输智能电rs485信号线 或者中央空调到空调控制器的信号线）</li>
</ul>
<h2 id="toc_5">网络设备</h2>
<p>最终选择的是AP模式，AP企业产品比较多，近些年也有不少家用的AP产品，常见的AP品牌也有不少，TPLink，华三，锐捷，aruba，unifi(UBNT),综合工业设计，系统软件等各方面因素，选择了Unifi全家桶。U家的产品特点主要是苹果风格的工业设计，复杂功能抽象封装，一些高级的功能只需要简单的配置即可。 Unifi的AP应该都是胖瘦一体的AP，支持软AC，也支持脱离AC独立运行。目前软AC支持的部署方式也很多，有pc上的软件客户端，或者docker进行部署，ac软件设置好之后，即使脱离了AC，AP也能正常工作，这两年官方都在推自带AC软件的UnifiOS设备，比如UDM，UDM Pro，UDM SE等设备，这些设备集成了路由器，交换机，UnifiOS（包含了AC管理）。</p>
<p>目前的拓扑结构如下：</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851362_795433.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851362_795433.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="835" /></picture></figure></div><h3 id="toc_6">地下室机柜</h3>
<p><strong>路由器和主交换机</strong></p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851337_094868.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851337_094868.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p><strong>其他设备</strong></p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851325_548921.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851325_548921.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p>机柜主要核心设备就是路由器和交换机</p>
<p><strong>路由器</strong> 之前一直用的USG3P加上docker部署的unifi controller（unifi network）来对unifi网络进行控制，为了事情变得简单以及更好的和机柜搭配，所以后来升级了UDM SE，自带UnifiOS（包含了软AC，Unifi Network套件），这样就可以摆脱dcoker部署的Unifi Network。</p>
<p><strong>主交换机</strong> 一般情况下我们只需要2层交换机就够了，如果存在需要POE驱动的设备比如POE摄像头，AP，那么就需要带POE的交换机了，POE协议发展到今天有大概分三类，802.3af、802.3at、802.3bt，一般交换机用到的进阶特性无非就是链路聚合和VLAN。</p>
<p><strong>机柜</strong>中还有的设备包含<strong>散热风扇，UPS+NAS，软路由，监控录像机</strong>以及其他的一些智能家具的网关设备。 因为NAS中的机械硬盘对突然掉电比较敏感，容器损坏硬盘影响硬盘寿命，所以一般情况下NAS最好都配一个UPS，这边用的是APC的BK650M2-CH，可以和NAS搭配工作，当断电后，NAS会接收到UPS的通知，然后进行关机保护，NAS和主交换机通过两根网线进行链路聚合，提高带宽。另外NAS下面可以放减震垫，毕竟4个硬盘同时工作多多少少有些震动的😂。 软路由则安装了PVE，然后PVE中安装各种需要的虚拟机，比如用于部署各种Docker的RancherOS系统，作为旁路由角色的OpenWRT，用于管理智能家居的Home Assistant OS。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851232_080935.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_402/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851232_080935.png" alt="image.png"loading="lazy" decoding="async" width="402" height="552" /></picture></figure></div><h3 id="toc_7">二楼中继弱电箱</h3>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851209_003326.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851209_003326.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p>二楼弱电箱主要设备就一个POE交换机和散热风扇，主要负责链接主交换机以及二楼和三楼的所有网络设备，由于目前没有使用万兆设备，这边和主交换机使用两根网线进行链路聚合，所以带宽可以达到2GbE，也就是如果两个AP同时访问NAS的话，整体带宽会突破1GbE。</p>
<h3 id="toc_8">AP</h3>
<p>AP算是日常使用用比较核心的设备了，毕竟现在很多设备都是WiFi连接的。Unifi Network可以很方便的对所有AP进行集中管理，一般情况下我们可以根据使用场景来创建多个WiFi Network，不同WiFi网络可以绑定不同的Network（不同的Network可以对应不同的VLAN），比如我们可以单独设置一个WiFi 出来进行科学上网，连上这个无线网就可以科学上网了，而且这个网络所有的设置更改都不影响默认的正常的WiFi网络。 以下是各个位置的AP布置： <strong>地下室</strong> 0F(UAP-AC-IW) 面板型AP</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851195_991561.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851195_991561.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p><strong>餐厅</strong> 1F-N(UAP-AC-LR) 吸顶AP 放置在餐厅位置，兼顾厨房餐厅厕所以及厕所外的设备平台等空间，LR型号的穿墙能力稍强</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851177_464428.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851177_464428.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p><strong>客厅</strong> 1F-S(UAP-AC-Pro) 吸顶AP 放置在客厅靠窗户的位置，兼顾客厅和院子， Pro型号的带机量以及带宽会比较高</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851164_649585.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851164_649585.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p>1F(USW-Flex-Mini) 客厅这边同时布置了一个小的交换机，毕竟无线再快也没有有线稳定，所以Apple TV，PS5啥的还是连的有线，还有IPTV的机顶盒需要使用有线和VLAN的特性，交换机也是必要的。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851156_843683.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851156_843683.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851150_448228.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851150_448228.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p><strong>二楼北</strong> 2F-N(UAP-FlexHD) 主要供北面的房间和书房使用，FlexHD的信号强度以及无线速度都比较强</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851128_906138.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851128_906138.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p><strong>二楼南</strong> 2F-S(UAP-AC-M) 南面的房间使用</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851117_858624.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851117_858624.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p><strong>三楼</strong> 3F(UAP-AC-Pro) 顶楼房间使用</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851106_1444645.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851106_1444645.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p><strong>入户</strong> Frontyard(UAP-AC-Lite) 这边是通过USW Flex交换机（放在摄像头上方的防水盒内），来同时对摄像头和AP供电，而USW Flex自身也是通过POE（af，at或者bt）进行供电的，这种模式用在户外一分多的情况下很方便，避免了电源线的布置，只需要一根网线即可搞定多个设备的网络和供电。</p>
<div class="gallery"><div class="gallery_column"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851048_911427.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_600/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851048_911427.png" alt="image.png"loading="lazy" decoding="async" width="600" height="600" /></picture></figure></div><div class="gallery_column"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851046_527025.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851046_527025.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div></div>
<h2 id="toc_9">使用场景举例</h2>
<h3 id="toc_10">影视多媒体</h3>
<p>还记得以前看下载的电影或者电视剧都是直接放在NAS上用本地的普通播放器看。后来知道了Jellyfin或者Plex这类媒体服务器的概念，媒体服务器可以对电影电视剧进行统一的管理，自动刮削电影或者电视剧的元数据。在多个客户端上观看记录和状态都可以自动进行同步，你在电视上看的记录，到手机或者电脑上观看进度都在，随时继续观看。 我这边使用的是开源免费的Jellyfin，客户端一般用的Infuse和官方的客户端。 Jellyfin服务直接部署在QNAP NAS的Docker的容器中，这样可以直接挂载NAS的硬盘。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851016_248274.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851016_248274.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="588" /></picture></figure></div><p>Infuse Pro客户端（Apple TV）</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851012_61618.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851012_61618.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="667" /></picture></figure></div><p>Jellyfin网页端</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851009_17529.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851009_17529.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="1147" /></picture></figure></div><p>每一集的简介信息</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332851004_971157.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332851004_971157.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="1169" /></picture></figure></div><p>另外不要使用服务器端解码，端上解码是最好的解决方案。</p>
<h3 id="toc_11">远程访问</h3>
<p>DDNS DDNS 是使用的阿里云的服务，通过OpenWRT的服务来进行更新，当wan口ip地址发生变化的时候就会自动更新域名ip地址。当然这个需要你的互联网提供商能够给你分配外网IP地址。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332850988_841513.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332850988_841513.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="1438" /></picture></figure></div><p>VPN 有ddns的帮助，我们就可以通过域名访问家里的ip地址了，如果需要访问家中的一些服务，我们可以通过端口转发的方式进行，端口转发这功能一般的路由器都提供了，但是端口转发存在一定的安全性，直接将相关服务暴露在互联网上，所以为了安全起见，还是走VPN比较安全。 一般的路由器也是提供了VPN服务的，Unifi VPN的设置</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332850975_934278.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332850975_934278.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="806" /></picture></figure></div><p>这样电脑或者手机上就可以通过域名和L2TP相关的信息设置 VPN连入家里的网络了。</p>
<h3 id="toc_12">科学上网</h3>
<p>为了保证默认WiFi网络的稳定，默认网络不提供科学上网，所以单独划出一个WiFi来给科学上网使用，这样这个单独的WiFi再怎么折腾也不会影响正常的网络。 软路由的OpenWRT上安装OpenClash服务（别的类似服务也ok），然后OpenWRT以旁路由的角色接入网络（LAN口接入交换机），如果多个VLAN网络都需要使用相关服务，那么可以添加多个网络接口，保证OpenWRT在相应的VLAN网络中能够访问。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332850962_308902.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332850962_308902.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="863" /></picture></figure></div><p>然后我们设置单独划出来的WiFi网络 我们先创建一个Network，对其进行相关配置，设置相应的网段和VLAN ID</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332850955_8246975.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332850955_8246975.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="666" /></picture></figure></div><p>设置DHCP的DNS Server和Geteway为旁路由的地址，这样客户端脸上这个网络之后 就会将网关和DNS Server设置为相应的IP地址。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332850946_791676.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332850946_791676.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="684" /></picture></figure></div><p>网络设置好了之后，我们再去设置WiFi，选择刚才创建好的Network，这样创建出来的WiFi就可以进行科学上网了。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8332850928_441046.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1000/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8332850928_441046.png" alt="image.png"loading="lazy" decoding="async" width="1000" height="898" /></picture></figure></div><h3 id="toc_13">iTV</h3>
<p>目前iTV也就用来看看比赛，平时也比较少看。 通过VLAN，即使客厅电视和机柜只有一根网线我们可以方便的通过交换机机顶盒来连光猫的IPTV口拨号看电视。不少地方的iTV 你可以进行抓包，然后通过OpenWRT模拟拨号，然后再通过udpxy服务将多播转为内网单播，随处通过rtsp流进行观看，网上资料很多，这里就不多做陈述了。</p>
<h3 id="toc_14">IoT</h3>
<p>IoT网络这块其实没啥好说的，就是如果想要提高安全性，可以为IoT设备单独划一个VLAN网络，和一般上网用的网络进行隔离。我目前为了简单还没有这么做，我一般的诸如智能开关，插座，zigbee网关啥的基本都是买的sonoff家的产品然后刷的tasmota的开源固件，这样就可以得到设备的完全控制权，然后再集成中Home Assistant系统中，其他很多小米的设备也可以集成到HA中，如果有同学想详细了解相关内容，我可以单独再开一篇来写。</p>
]]></content:encoded></item><item><title><![CDATA[网络1:实践低成本小户型AP+AC网络方案]]></title><guid>https://zweichen.com/posts/hands-on-network-upgrade-2022</guid><link>https://zweichen.com/posts/hands-on-network-upgrade-2022</link><description><![CDATA[以女朋友家为例]]></description><pubDate>Tue, 04 Oct 2022 21:01:38 +0000</pubDate><content:encoded><![CDATA[<div class="blockquote"><blockquote><p>妈妈：“你为什么要天天折腾这该死的路由器？”</p>
<p>我：“因为它就在那里。 ”</p>
</blockquote></div>
<p>2022年的朋友相比于以前更加重视起了家里的网络建设。诸如(Wi-Fi 6、MESH、MIMO、无缝漫游)此类形形色色的名词无疑使人眼花缭乱。</p>
<p>本文以改造女朋友家里的网络为例，展示了一个AP+AC方案的诞生。</p>
<p>本文目标观众新手向，科普为主。硬核的需要再等等。</p>
<p><img src="https://i.typlog.com/zwei/8334499996_701822.jpg" alt="alt text" />
网络方案丰俭由人，要是阁下的府上面积还行，请等待写作中的下一篇 《网络2:踩坑别墅户型网络——以寒舍为例》</p>
<details class="toc" open>
<summary>目录</summary>
<ul>
<li><a href="#toc_1">动手之前</a>
<ul>
<li><a href="#toc_2">需求与现状</a></li>
<li><a href="#toc_3">目的与分析</a></li>
<li><a href="#toc_4">为什么AC+AP</a></li>
</ul>
</li>
<li><a href="#toc_5">动手</a>
<ul>
<li><a href="#toc_6">（通过户型图）设计方案</a></li>
<li><a href="#toc_7">（在闲鱼）采购设备</a></li>
<li><a href="#toc_8">设置网络与IPTV</a></li>
</ul>
</li>
<li><a href="#toc_15">动手之后</a>
<ul>
<li><a href="#toc_16">验收网络</a></li>
</ul>
</li>
</ul>
</details>
<h2 id="toc_1">动手之前</h2>
<h3 id="toc_2">需求与现状</h3>
<p>面积：2室2厅约80平方。</p>
<p>设备数量：8-20台（30台以内，有IPTV）。</p>
<p>典型场景：客厅一台iPad 开摄像头上课，房间里一台电脑Teams 开会，同时4台手机刷新网页。</p>
<p>网络带宽：上海电信100M/20M。</p>
<p>目前网络设备：上海电信SDN光猫（EPON）+ 小米路由器3（也是垃圾）。</p>
<p>网口数量：4个，每房间1个+客厅有2个。</p>
<p><strong>问题1：客厅Wi-Fi名字与房间名字不一致，导致需要手动重新连接。</strong></p>
<p><strong>问题2：网络不稳定，设备经常有信号无网络。</strong></p>
<p>客厅非常典型，就是弱电箱小了点，光猫还摆在外面。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8334500524_420439.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1024/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8334500524_420439.jpg" alt="alt text"loading="lazy" decoding="async" width="1024" height="769" /></picture></figure></div><p>房间则是另一个二级路由器，进出需要手动设置另一个Wi-Fi。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8334500497_044643.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1024/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8334500497_044643.jpg" alt="alt text"loading="lazy" decoding="async" width="1024" height="768" /></picture></figure></div><h3 id="toc_3">目的与分析</h3>
<p><strong>目的1.常用区域覆盖网络。</strong></p>
<p><strong>目的2.不同房间自动切换不同路由器（AP）</strong></p>
<p><strong>目的3.避免有信号无网络</strong></p>
<p>1.相比于网络带宽，性能影响最大的因素是现有路由器<strong>（光猫）无线性能较弱</strong>。需要关闭光猫无线，使用网线链接性能更好的无线路由器。</p>
<p>2.房型无法找到单点覆盖全屋的网络,需要<strong>多点部署无线</strong>。（无线连接是双向的，手机的Wi-Fi芯片功率一般不大，无法穿透）</p>
<p>3.需要<strong>快速漫游</strong>，在不同房间漫游到不同无线点位。</p>
<p>4.房间有网口，不需要Mesh功能。（PS：Mesh是路由器之间的无线组网技术，与快速漫游没有直接联系，只适用于增强无线覆盖范围。有线网络不叫Mesh，而正黄旗三频段Mesh无线组网设备的价格上千了已经。）</p>
<h3 id="toc_4">为什么AC+AP</h3>
<p>平价的方案有很多：</p>
<p><strong>方案1</strong>: “MESH” 方案：采购Linksys Velop系列、TPlink 易展系列多台组网。风险就是，高温天故障率高可能需要家里人手动重启。Velop系列单个损坏整套寄回的售后麻烦，以及后期升级大多需要整套更换或者重新购买。（推荐TP-XDR6086，XDR5430等，当然也可以AP做mesh+主路由单独存在）</p>
<p><strong>方案2</strong>：AP+AC方案：1个有线主路由，兼AC功能，外加多个AP。如果是家庭使用，推荐TP-LINK、UBNT（够贵了，再贵买不起了。）ps：不是很推荐华为的方案很奇怪，家用产品性能过于拉垮，不值。企业级别产品非常优秀，价格比UBNT还贵。</p>
<p><strong>方案3</strong>: 单台主路由：放在客厅或者房屋中间地带。比如华硕的AX86，或者AC86之类的。这样房间里就不能接有线设备了，只能接到客厅。同时，即使路由器功率大，设备能收到信号，wifi又是双向传输的，设备的wifi芯片发送的功率有限，
但是视频会议的时候，质量也并不高了。</p>
<p><strong>性能最高，最便宜的方案</strong>：别买路由器了，直接买根网线插上，暴力美学。</p>
<p><strong>考虑到：</strong></p>
<p>1.操作：可以远程完成大部分维护，避免家人需要手动介入。</p>
<p>2.局限：弱电箱比较小，无法放大的路由器。</p>
<p>3.美观：面板直接当路由器，美观程度还是很高的。</p>
<p>4.升级：后期升级直接换更高规格的面板，不用重新配置，甚至无需上门。</p>
<p>外加开发商还可以，各个房间都预留了网线口：</p>
<p>长这样：</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8334500048_670498.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1024/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8334500048_670498.jpg" alt="alt text"loading="lazy" decoding="async" width="1024" height="769" /></picture></figure></div><p>所以最后的方案是：</p>
<p><strong>AP+AC！。</strong></p>
<h2 id="toc_5">动手</h2>
<h3 id="toc_6">（通过户型图）设计方案</h3>
<p>首先你需要得到户型图，大部分小区还是可以从开发商、物业得到图纸。如果没有的话，可以试试链家、安居客这类二手房交易公司，应该可以找到挂牌的同房型。</p>
<p>比如我就找到了：</p>
<p><img src="https://i.typlog.com/zwei/8334500212_930798.jpg" alt="alt text" />
你可以手动标注有网线的点位，也可以利用现代化的工具： <a href="https://design.ui.com/">UniFi® Design Center</a></p>
<p>UniFi 本来也卖路由器，就是价格稍微有点小康（一个AP 800-1500，主路由800-4000） 他家里测算无线信号覆盖的在线工具还可以，上传户型图，描上墙壁。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8334499652_626286.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1496/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8334499652_626286.png" alt="alt text"loading="lazy" decoding="async" width="1496" height="926" /></picture></figure></div><p>为了模拟出更加贴合实际情况的信号，找功率和采用的TP-Link AP1900GI-POE 差不多的 AC-INWALL 来做仿真。</p>
<p><img src="https://i.typlog.com/zwei/8334499688_10261.png" alt="alt text" />
颜色越深的地方信号越好，只要是绿色以及偏红的地方都没有问题。（实际测算，手机会把-68db蓝色区域当作2格信号，绿色偏红均为满格）</p>
<p>最后还可以给你导一份PDF 展示2.4G 和5G Hz 俩个频段的信号覆盖程度的模拟。</p>
<p>经过模拟和不同的点位的测试，只需要2个ap可以完成整个屋子的覆盖。</p>
<h3 id="toc_7">（在闲鱼）采购设备</h3>
<p>对于企业级的设备，推荐去咸鱼、或者招代理商采购，价格更优惠。只要是新产品，质保都是一样的。 如果AP坏了，就是打电话给厂家，厂家给你地址寄回去，然后厂家寄给你的新的设备，就非常的。。。 old school。</p>
<p>考虑到AC的体积，使用人数和无线质量。</p>
<p>同时为了方便在线管理和调整网络部署质量（参考验收章节）</p>
<p>这里采用</p>
<ul>
<li><p>1 * TP-LINK 的POE路由器（带AC功能）TL-R470GP 体积非常小，放入弱电箱。 支持POE供电，通过网线直接给墙壁里的AP 供电。 价格在200左右（v4.0和V5.0以上支持云平台管理）</p>
</li>
<li><p>2 * TP-LINK 的AP TL-AP1900GI-POE （其实我买了三个，结果发现模拟的结果很正确，买多了） 顾名思义就是，支持无线速率是1900M（5G 1200+ 2.4G 600） 的千兆POE AP 支持802.11 K/V 可以快速漫游 AP上面还有一个网口，方便插入设备 价格大概240左右。</p>
</li>
</ul>
<p>AP还推荐TL-AP1207GI（200+） 和 TL-XAP5400GI（600+），AP1900GI的性价比权衡较好。</p>
<p>即使外网只有100M的网络，但是内网速度在投屏、微信同步、传输文件非常重要。</p>
<p>之前在这个AP下面，微信传输聊天记录跑出过50M/S，相比于很多公共场所的2M/S 传输速度，就非常节约时间。</p>
<div class="gallery"><div class="gallery_column"><figure><picture><source srcset="https://i.typlog.com/zwei/8334498923_13393.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1002/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8334498923_13393.png" alt="alt text"loading="lazy" decoding="async" width="1002" height="732" /></picture></figure><figure><picture><source srcset="https://i.typlog.com/zwei/8334495475_643936.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800/format,webp 1x, https://i.typlog.com/zwei/8334495475_643936.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600/format,webp 2x" media="(min-width: 800px)" type="image/webp"><source srcset="https://i.typlog.com/zwei/8334495475_643936.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800 1x, https://i.typlog.com/zwei/8334495475_643936.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600 2x" media="(min-width: 800px)"><img src="https://i.typlog.com/zwei/8334495475_643936.png" alt="alt text"loading="lazy" decoding="async" width="2232" height="1146" /></picture></figure></div></div>
<h3 id="toc_8">设置网络与IPTV</h3>
<h4 id="toc_9">部署设备</h4>
<p>发现墙壁里的网线口没有做水晶头。于是就先拿上网线钳做水晶头（如果没有，购买的话50+ RMB 左右，你现实生活中认识我的话也可以问我借。）</p>
<h4 id="toc_10">骚扰ISP</h4>
<p>部署路由器稍稍费了点时间，因为电信的SDN光猫网络设备有一个“防蹭网”的功能，时不时有BUG，经常踢掉正常的设备，默认开启。需要下载上海电信提供的“网络管家”才能关闭该功能，我还顺便关闭光猫赢弱的Wi-Fi功能，免得被这种垃圾干扰频段。</p>
<p>低端光猫真的是网络卡顿的罪魁祸首，电信还非要用来做网关。</p>
<p>（这样就可以让用户觉得一定是我的带宽不够，升级到“千兆”吧，然后电信给一个合格的光猫，于是皆大欢喜，虽然家庭网络100M/20M完全够用了。）</p>
<p>我还顺手打ISP电话要求网络改成桥接模式，减少一层NAT，然后用路由器上的PPPOE拨号，避免光猫垃圾的性能时不时抽风一下，测试下来网络还比较稳定，就不再要求电信更换光猫了。</p>
<p>当然大部分情况下，路由器设置DHCP（动态IP）模式，直接插在光猫上，能用就行了，近几年生产的光猫性能也不会很离谱。</p>
<h4 id="toc_11">设置Wi-Fi名字（SSID）</h4>
<p>新建一个SSID，选择自动绑定即可，这样新装的AP可以自动加入网络，不需要手动配置。</p>
<p>如果陈旧的无线设备较多，可以选择WPA-PSK/WPA2-PSK，如果大多都是手机电脑电视机，选择WPA2-PSK/WPA3-PSK 即可。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8334495867_860548.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800/format,webp 1x, https://i.typlog.com/zwei/8334495867_860548.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600/format,webp 2x" media="(min-width: 800px)" type="image/webp"><source srcset="https://i.typlog.com/zwei/8334495867_860548.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800 1x, https://i.typlog.com/zwei/8334495867_860548.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600 2x" media="(min-width: 800px)"><img src="https://i.typlog.com/zwei/8334495867_860548.png" alt="alt text"loading="lazy" decoding="async" width="1692" height="1316" /></picture></figure></div><h4 id="toc_12">安装AP</h4>
<p>至于AP的安装其实非常简单，简单到我都不好意思上图。</p>
<p>无非就是螺丝打开面板，制作水晶头，插上网线，因为网线传输电力，就自动开机了。</p>
<p>就放一个安装前和安装后的对比好了。</p>
<div class="gallery"><div class="gallery_column"><figure><picture><source srcset="https://i.typlog.com/zwei/8334497710_432233.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_769/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8334497710_432233.jpg" alt="alt text"loading="lazy" decoding="async" width="769" height="1024" /></picture></figure><figure><picture><source srcset="https://i.typlog.com/zwei/8334500497_044643.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1024/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8334500497_044643.jpg" alt="alt text"loading="lazy" decoding="async" width="1024" height="768" /></picture></figure><figure><picture><source srcset="https://i.typlog.com/zwei/8334497670_677206.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_769/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8334497670_677206.jpg" alt="alt text"loading="lazy" decoding="async" width="769" height="1024" /></picture></figure></div></div>
<h4 id="toc_13">IPTV设置*</h4>
<p>对于有IPTV的朋友，路由器页面中有IPTV开关（本质上是一个VLAN，这里不介绍），可以将AP的网口与路由器的ITV口虚拟成一条线，IPTV插入制定的AP的网口即可。 （有些高端的路由器没有IPTV，而是需要手动配置VLAN，效果一样）</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8334497977_67152.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800/format,webp 1x, https://i.typlog.com/zwei/8334497977_67152.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600/format,webp 2x" media="(min-width: 800px)" type="image/webp"><source srcset="https://i.typlog.com/zwei/8334497977_67152.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800 1x, https://i.typlog.com/zwei/8334497977_67152.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600 2x" media="(min-width: 800px)"><img src="https://i.typlog.com/zwei/8334497977_67152.png" alt="alt text"loading="lazy" decoding="async" width="2804" height="1312" /></picture></figure></div><h4 id="toc_14">云平台</h4>
<p>为啥选择TPLINK的这几个设备，还有一个重要的功能就是TPLINK的云平台，（不同厂商大多都有，做的最好看的当然是UBNT的）</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8334497527_138456.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800/format,webp 1x, https://i.typlog.com/zwei/8334497527_138456.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600/format,webp 2x" media="(min-width: 800px)" type="image/webp"><source srcset="https://i.typlog.com/zwei/8334497527_138456.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800 1x, https://i.typlog.com/zwei/8334497527_138456.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600 2x" media="(min-width: 800px)"><img src="https://i.typlog.com/zwei/8334497527_138456.png" alt="alt text"loading="lazy" decoding="async" width="1718" height="1010" /></picture></figure></div><h2 id="toc_15">动手之后</h2>
<h3 id="toc_16">验收网络</h3>
<h4 id="toc_17">主动测试环节</h4>
<p>既然选择了TP-LINK的方案，TP-LINK的APP（商云）有一个网络验收的工具，可以测试不同的位置的网速和延迟。还可以测试漫游情况（不过这里只有俩个AP，简单测了一下问题不大，就没放图。）</p>
<p>测试下来基本速度都可以跑满ISP的带宽（100M），而光猫的无线只能跑到70M，一度怀疑光猫只有百兆。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8334497048_20538.jpg?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1170/format,webp" type="image/webp"><img src="https://i.typlog.com/zwei/8334497048_20538.jpg" alt="alt text"loading="lazy" decoding="async" width="1170" height="2532" /></picture></figure></div><h4 id="toc_18">后期查看环节</h4>
<p>其实评估无线覆盖程度， 一个是主动测试是常用地点的无线覆盖是否达标， 另一个就是在云平台上看查看的终端信号强度和验证失败的概率。</p>
<p>过去的七天有五百多次链接，失败的概率非常低，就可以认为信号覆盖的位置比较合理，设备不会链接到较远位置的AP，导致连接失败或者信号弱。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8334496294_488868.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800/format,webp 1x, https://i.typlog.com/zwei/8334496294_488868.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600/format,webp 2x" media="(min-width: 800px)" type="image/webp"><source srcset="https://i.typlog.com/zwei/8334496294_488868.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800 1x, https://i.typlog.com/zwei/8334496294_488868.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600 2x" media="(min-width: 800px)"><img src="https://i.typlog.com/zwei/8334496294_488868.png" alt="alt text"loading="lazy" decoding="async" width="2280" height="980" /></picture></figure></div><p>而如下的图（我家里的情况） 说明客厅的AP点位有点问题，可能是有一些设备较多的地方缺少AP覆盖，导致连接到最近的客厅，但是因为距离或者信号阻挡，连接失败。</p>
<div class="photo"><figure><picture><source srcset="https://i.typlog.com/zwei/8334496051_174501.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800/format,webp 1x, https://i.typlog.com/zwei/8334496051_174501.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600/format,webp 2x" media="(min-width: 800px)" type="image/webp"><source srcset="https://i.typlog.com/zwei/8334496051_174501.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_800 1x, https://i.typlog.com/zwei/8334496051_174501.png?x-oss-process=image/auto-orient,1/interlace,1/quality,q_90/resize,m_lfit,w_1600 2x" media="(min-width: 800px)"><img src="https://i.typlog.com/zwei/8334496051_174501.png" alt="alt text"loading="lazy" decoding="async" width="2338" height="984" /></picture></figure></div><p>不过我家的情况是后话，至少这个方案，在小户型的地方无比成功。</p>
<p>参考文献： 某段话引用自<a href="https://zh.alegsaonline.com/art/38249">George Leigh Mallory</a></p>
]]></content:encoded></item><item><title><![CDATA[旧店倒闭，新店开张]]></title><guid>https://zweichen.com/posts/hi</guid><link>https://zweichen.com/posts/hi</link><description><![CDATA[旧店博文逐渐搬迁中]]></description><pubDate>Sun, 11 Sep 2022 17:20:58 +0000</pubDate><content:encoded><![CDATA[<p>之前的博客在15年开张，现在也7余载，可惜过去的文风令人不喜，一直打算重写。</p>
<p>七年前刚刚高中毕业，尖酸刻薄，不收锋芒。然后立下Flag要更新多少文章。结果变成了大咕咕鸡，文章大多拼凑而成。</p>
<p>虽然七年时间也没多少长进，但是也有一些有趣的认知。一直装在脑子里慢慢淡忘觉得有点可惜，还得慢慢积累。</p>
<p>过去的博客托管在Github Pages上面，写一篇文章需要配置一整套环境（Hexo+plugin），而我这种大懒人不一定记得到底安装了什么插件以及如何使用。所以这次乘此机会托管在了小明同学（<a href="https://lepture.com/">Lepture</a>）的产品上。希望更高成本的投入带来的往往是更高的产出。</p>
<p>过去的文章和指南有不少错误，外加我也有了很多有意思的经历，于是这个晚上，开始重写文章了。</p>
]]></content:encoded></item></channel></rss>