目录

在树莓派上搭建科学上网代理可以实现网络加速和访问限制内容的需求。以下是几种常见的方法和步骤

使用 Shadowsocks (推荐) Shadowsocks 是一个轻量级的代理工具,适合树莓派这类低性能设备。 安装步骤: 更新系统: sudo apt update && sudo apt upgrade -y 安装 Shadowsocks: sudo apt install shadowsock...

使用 Shadowsocks (推荐)

Shadowsocks 是一个轻量级的代理工具,适合树莓派这类低性能设备。

安装步骤:

  1. 更新系统:

    sudo apt update && sudo apt upgrade -y
  2. 安装 Shadowsocks:

    sudo apt install shadowsocks-libev -y
  3. 配置 Shadowsocks: 创建配置文件 /etc/shadowsocks-libev/config.json

    {
        "server":"your_server_ip",
        "server_port":8388,
        "local_port":1080,
        "password":"your_password",
        "timeout":300,
        "method":"aes-256-gcm"
    }
    • 替换 your_server_ipyour_password 为你的服务器信息。
  4. 启动 Shadowsocks:

    sudo systemctl start shadowsocks-libev
    sudo systemctl enable shadowsocks-libev
  5. 测试代理:

    • 在浏览器或系统中配置 SOCKS5 代理(地址 0.0.1,端口 1080)。

使用 Clash (功能强大)

Clash 支持多种协议(SS/V2Ray/Trojan),适合高级用户。

安装步骤:

  1. 下载 Clash:

    wget https://github.com/Dreamacro/clash/releases/download/v1.10.0/clash-linux-armv7-v1.10.0.gz
    gzip -d clash-linux-armv7-v1.10.0.gz
    mv clash-linux-armv7-v1.10.0 /usr/local/bin/clash
    chmod +x /usr/local/bin/clash
  2. 创建配置文件目录:

    mkdir -p /etc/clash

    将配置文件 config.yamlCountry.mmdb 放入 /etc/clash

  3. 启动 Clash:

    clash -d /etc/clash
  4. 配置代理:

    • HTTP/HTTPS 代理端口默认为 7890,SOCKS5 为 7891

使用 WireGuard (VPN 方案)

WireGuard 是一个高性能的 VPN 工具。

安装步骤:

  1. 安装 WireGuard:

    sudo apt install wireguard -y
  2. 生成密钥:

    wg genkey | sudo tee /etc/wireguard/private.key
    sudo cat /etc/wireguard/private.key | wg pubkey | sudo tee /etc/wireguard/public.key
  3. 配置客户端: 编辑 /etc/wireguard/wg0.conf

    [Interface]
    PrivateKey = <你的私钥>
    Address = 10.0.0.2/24
    [Peer]
    PublicKey = <服务器公钥>
    Endpoint = your_server_ip:51820
    AllowedIPs = 0.0.0.0/0
  4. 启动 WireGuard:

    sudo wg-quick up wg0

透明网关(全局代理)

如果需要让树莓派作为局域网内其他设备的网关:

  1. 安装 iptablesredsocks
  2. 配置 NAT 规则和流量转发。
  3. 其他设备将网关设置为树莓派的 IP。

注意事项

  • 合法性:确保遵守当地法律法规,仅用于合法用途。
  • 性能:树莓派性能有限,不建议同时运行多个代理工具。
  • 安全性:使用强密码并定期更新配置。

根据需求选择合适的方法,Shadowsocks 适合简单代理,Clash 功能更全面,WireGuard 适合 VPN 需求。

在树莓派上搭建科学上网代理可以实现网络加速和访问限制内容的需求。以下是几种常见的方法和步骤

​扫描二维码推送至手机访问。

本文转载自互联网,如有侵权,联系删除。

本文链接:https://m.kuaimiao-app.com/post/516.html

扫描二维码手机访问

文章目录