<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Win11安装Debian12.14软路由]]></title><description><![CDATA[<p dir="auto">本教程以 <strong>Debian 12.14</strong> 在 VirtualBox / Hyper-V / VMware 中的虚拟机为例，采用<strong>桥接本机网卡</strong>方式，实现软路由功能（主要用于 LAN 侧转发 + 代理）。<strong>不需要配置 WAN 口</strong>，仅配置一个 LAN 接口。</p>
<h1>1. 安装 Debian 12.14 并启用 Root SSH 密码登录</h1>
<ol>
<li>
<p dir="auto">下载 Debian 12.14 ISO 镜像（官方 netinst 或 full CD 均可）。</p>
</li>
<li>
<p dir="auto">在虚拟机软件（VirtualBox / Hyper-V / VMware）中新建虚拟机：</p>
<ul>
<li><strong>网络适配器</strong>：选择 <strong>桥接（Bridged）</strong> 到你的本机物理网卡（这样虚拟机能直接获得局域网 IP）。</li>
<li>CPU、内存、硬盘根据需求分配（推荐 2 核 + 1GB内存）。</li>
<li>挂载 ISO 并启动安装。</li>
</ul>
</li>
<li>
<p dir="auto"><strong>安装过程中</strong>：</p>
<ul>
<li>选择语言、键盘等。</li>
<li>分区：推荐整个磁盘（Guided - use entire disk）。</li>
<li>设置 <strong>root 密码</strong>（重要！必须设置）。</li>
<li>安装 SSH server（在任务选择中勾选 “SSH server”）。</li>
</ul>
</li>
<li>
<p dir="auto">安装完成后重启，进入系统。</p>
</li>
<li>
<p dir="auto"><strong>启用 Root SSH 密码登录</strong>：</p>
<pre><code class="language-bash">nano /etc/ssh/sshd_config
</code></pre>
<p dir="auto">找到并修改以下两行（去掉注释 <code>#</code></p>
<pre><code>PermitRootLogin yes
PasswordAuthentication yes
</code></pre>
<p dir="auto">保存退出（Ctrl+O → Enter → Ctrl+X）。</p>
<p dir="auto">重启 SSH 服务：</p>
<pre><code class="language-bash">systemctl restart ssh
</code></pre>
</li>
</ol>
<h1>2. 配置 LAN 接口（静态 IP 或 DHCP）</h1>
<ol>
<li>查看网卡名称：</li>
</ol>
<pre><code class="language-bash">ip a
</code></pre>
<p dir="auto">例如：</p>
<pre><code class="language-text">ens18
</code></pre>
<p dir="auto">或者：</p>
<pre><code class="language-text">eth0
</code></pre>
<ol start="2">
<li>Debian 默认使用 <code>/etc/network/interfaces</code> 管理网络。</li>
</ol>
<p dir="auto">编辑配置文件：</p>
<pre><code class="language-bash">nano /etc/network/interfaces
</code></pre>
<p dir="auto"><strong>配置示例</strong>（静态 IP，适合软路由）：</p>
<pre><code># This file describes the network interfaces
# and how to activate them

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# LAN 接口（根据虚拟机网卡名称替换见上方名称）
auto eth0                           # 这里使用eth0示例
iface eth0 inet static              # static静态
    address 192.168.1.11/24         # 软路由 LAN IP
    gateway 192.168.1.1             # 上级网关（通常是你的主路由器 IP）
    dns-nameservers 119.29.29.29 223.5.5.5 #dns填入
iface eth0 inet6 dhcp                 #DHCPv6 有v6情况才写入
 post-up sysctl -w net.ipv6.conf.eth0.accept_ra=2 &gt;/dev/null 2&gt;&amp;1 #RA 获取默认v6路由上网
</code></pre>
<ul>
<li><strong>说明</strong>：</li>
<li><code>address</code>：设置本机 LAN IP。</li>
<li><code>gateway</code>：上级路由器（主路由器）的 IP，用于软路由访问外网（可选，根据需求）。</li>
<li>如果想用 <strong>DHCP</strong>，改为：</li>
<li><strong>注意改为DHCP需要在路由器根据MAC地址查看IP才能连接SSH；或者虚拟机连接，查看ip</strong><pre><code>auto eth0            
iface eth0 inet dhcp   # dhcp顾名思义
</code></pre>
</li>
</ul>
<ol start="3">
<li>保存后应用配置并重启网络及电脑：<pre><code class="language-bash">systemctl restart networking
# 最好重启虚拟机
reboot
</code></pre>
</li>
</ol>
<p dir="auto">此时即可使用 SSH 客户端（推荐<code>Netcatty</code>；；或如 Xshell、MobaXterm、FinalShell 等），或cmd/powershell以 <strong>ssh root@IP</strong> 登录。</p>
<ol start="3">
<li>重启后验证：<pre><code class="language-bash">ip addr show
ip route
ping 119.29.29.29
</code></pre>
</li>
</ol>
<h1>3. SSH 登录并开启 IPv4/IPv6 转发</h1>
<ol>
<li>
<p dir="auto">使用 SSH 客户端以 root 登录虚拟机。</p>
</li>
<li>
<p dir="auto"><strong>开启 IPv4/IPv6 转发</strong>（必需）：</p>
</li>
</ol>
<hr />
<pre><code class="language-bash">sudo cp /etc/sysctl.conf /etc/sysctl.conf.bk_$(date +%Y%m%d_%H%M%S) &amp;&amp; \
sudo tee /etc/sysctl.conf &lt;&lt; 'EOF'
net.ipv4.ip_forward=1
net.ipv4.conf.all.forwarding=1
net.ipv6.conf.all.forwarding=1
net.ipv4.tcp_congestion_control=bbr
net.core.default_qdisc=fq
EOF
sudo sysctl -p
</code></pre>
<hr />
<ol start="3">
<li>验证转发是否开启：</li>
</ol>
<pre><code class="language-bash">sysctl net.ipv4.ip_forward
sysctl net.ipv6.ip_forward
</code></pre>
<p dir="auto">应输出 <code>net.ipv4.ip_forward = 1;net.ipv6.ip_forward = 1</code>。</p>
<h1>4. 启用代理（二选一）</h1>
<h2>选项 A：OPENPPP2（推荐隧道工具）</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>内容</th>
<th>链接</th>
</tr>
</thead>
<tbody>
<tr>
<td>安装脚本</td>
<td><a href="https://github.com/picetor/openppp2_install" rel="nofollow ugc">https://github.com/picetor/openppp2_install</a></td>
</tr>
<tr>
<td>原版仓库</td>
<td><a href="https://github.com/liulilittle/openppp2" rel="nofollow ugc">https://github.com/liulilittle/openppp2</a></td>
</tr>
<tr>
<td>改版，更多特性</td>
<td><a href="https://github.com/Miaocchi/openppp2" rel="nofollow ugc">https://github.com/Miaocchi/openppp2</a></td>
</tr>
<tr>
<td>自编译版本，兼容openwrt</td>
<td><a href="https://github.com/picetor/openppp2" rel="nofollow ugc">https://github.com/picetor/openppp2</a></td>
</tr>
</tbody>
</table>
<h3>拉取脚本</h3>
<p dir="auto">直连 GitHub（海外服务器或网络良好）</p>
<pre><code class="language-bash">wget -4 -O ppp_install.sh https://raw.githubusercontent.com/picetor/openppp2_install/main/ppp_install.sh &amp;&amp; chmod +x ppp_install.sh &amp;&amp; ./ppp_install.sh
</code></pre>
<hr />
<p dir="auto">使用Github加速</p>
<pre><code class="language-bash">wget -4 -O ppp_install.sh https://git.apad.pro/https://raw.githubusercontent.com/picetor/openppp2_install/main/ppp_install.sh &amp;&amp; chmod +x ppp_install.sh &amp;&amp; ./ppp_install.sh
</code></pre>
<p dir="auto">运行后进入交互菜单，根据提示选择<strong>客户端模式</strong>安装配置，需准备服务端信息、修改启动脚本<code>/opt/ppp/ppp.sh</code>；工作目录<code>opt/ppp</code></p>
<h2>选项 B：Clash for Linux</h2>
<p dir="auto"><a href="https://github.com/wnlen/clash-for-linux" rel="nofollow ugc">项目地址: https://github.com/wnlen/clash-for-linux</a><br />
Github直连</p>
<pre><code class="language-bash">git clone --branch master --depth 1 https://github.com/wnlen/clash-for-linux.git
cd clash-for-linux
bash install.sh
</code></pre>
<hr />
<p dir="auto">Github加速</p>
<pre><code class="language-bash">git clone --branch master --depth 1 ```
https://ghfast.top/https://github.com/wnlen/clash-for-linux.git
cd clash-for-linux
bash install.sh
</code></pre>
<p dir="auto">安装完成后使用 <code>clashon</code> 启动，<code>clashctl</code> 管理订阅、节点等。详情看原仓库</p>
<h1>客户端配置方法</h1>
<h2>1. Windows 手动配置</h2>
<ul>
<li>打开「控制面板」→「网络和共享中心」→「更改适配器设置」</li>
<li>右键点击当前使用的网卡（以太网或 WLAN）→「属性」</li>
<li>双击「Internet 协议版本 4 (TCP/IPv4)」</li>
<li>选择「使用下面的 IP 地址」：
<ul>
<li>IP 地址：与 Debian 同网段，例如 <code>192.168.1.50</code></li>
<li>子网掩码：<code>255.255.255.0</code></li>
<li><strong>默认网关：<code>192.168.1.11</code></strong>（Debian 的 IP）</li>
<li>DNS 服务器：可填写 <code>223.5.5.5</code>、<code>119.29.29.29</code>；；或 Debian 的 IP <code>192.168.1.11</code> 前提有dns服务器</li>
</ul>
</li>
<li>点击「确定」保存。</li>
</ul>
<h2>2. macOS 手动配置</h2>
<ul>
<li>「系统设置」→「网络」→ 选择当前网络（如 Wi-Fi 或以太网）</li>
<li>点击「详细信息」→「TCP/IP」</li>
<li>配置 IPv4 为「手动」
<ul>
<li>IP 地址：<code>192.168.1.51</code></li>
<li>子网掩码：<code>255.255.255.0</code></li>
<li><strong>路由器：<code>192.168.1.11</code></strong>（Debian 的 IP）</li>
</ul>
</li>
<li>DNS 可手动添加 <code>223.5.5.5</code> 等</li>
<li>点击「好」保存。</li>
</ul>
<h2>4. 手机 / 平板（Android / iOS）</h2>
<ul>
<li>进入 Wi-Fi 设置，长按当前连接的 Wi-Fi →「修改网络」或「配置网络」</li>
<li>将「IP 设置」从 DHCP 改为「静态」</li>
<li>IP 地址：例如 <code>192.168.1.53</code></li>
<li>网关：<strong><code>192.168.1.11</code></strong>（Debian 的 IP）</li>
<li>DNS：<code>223.5.5.5</code> 等</li>
<li>保存。</li>
</ul>
<h3>验证客户端是否通过软路由</h3>
<p dir="auto">在客户端上打开浏览器，访问 <code>https://ip.skk.moe</code> 或 <code>https://ipcheck.ing/</code>，显示的 IP 应为代理出口 IP（而非上级路由的 IP）。</p>
<p dir="auto">也可在客户端命令行执行：</p>
<pre><code class="language-bash">tracert 119.29.29.29   # Windows
traceroute 119.29.29.29  # Linux/macOS
</code></pre>
<p dir="auto">第一跳应显示 <code>192.168.1.11</code>（Debian 软路由地址）。</p>
<hr />
<h1>最终结构</h1>
<pre><code class="language-text">+-------------+
|  上级路由   |
+-------------+
       │
       │ (桥接网络)
       ▼
+-------------+
| Debian 12.14|
|  软路由  |
+-------------+
       │
       ├── openppp2
       │   或
       └── Clash for Linux
       │
       │ (LAN 同网段)
       ▼
+-------------+
|   客户端    |
| (PC/手机等) |
+-------------+
</code></pre>
<hr />
<p dir="auto"><strong>后续常用操作</strong>：</p>
<ul>
<li>查看网络：<code>ip addr</code>、<code>ip route</code></li>
<li>编辑网络接口<code>nano /etc/network/interfaces</code></li>
<li>重启网络：<code>systemctl restart networking</code></li>
<li>安装mosdns本地DNS服务端</li>
</ul>
]]></description><link>https://blog.clouldon.com/topic/25/win11安装debian12.14软路由</link><generator>RSS for Node</generator><lastBuildDate>Wed, 05 Aug 2026 05:02:35 GMT</lastBuildDate><atom:link href="https://blog.clouldon.com/topic/25.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 14 Jun 2026 17:47:31 GMT</pubDate><ttl>60</ttl></channel></rss>