WireGuard 是什么?如何快速一键安装 WireGuard?

妞妞 12天前  网络  76

今天早上才第一次听说 WireGuard,好像是一种新的VPN技术,说是速度很快,也很稳定,什么原理?它跟V2Ray有什么区别吗?有大神能清楚讲讲吗?最好小白也能听懂。

5 个回答
  • 孤城浪人 12天前
    2

    用一句话解释,WireGuard 是一种新一代 VPN 协议,特点是:极简、极快、安全、稳定,可以理解为用现代密码学重写的一次 VPN 体系,它不是在 OpenVPN / IPSec 上的修补,而是从零设计的。它的特点:

    一、极其精简(代码量小)

    OpenVPN ~40 万行

    IPSec ~50 万行

    WireGuard ≈ 4 千行

    这意味着:更少 Bug、更少性能损耗、更容易审计安全性

    二、速度非常快(重点)

    1.运行在内核态

    在 Linux 内核中运行

    比 OpenVPN(用户态)快很多

    2.默认使用 UDP

    没有 TCP-over-TCP 问题

    延迟低,丢包恢复快

    非常适合:YouTube、4K 视频、实时加载网页

    从测试中看,在同一台 VPS 上,WireGuard 速度通常是 OpenVPN 的 2~5 倍

    三、安全性很强(现代密码学)

    WireGuard 不支持弱算法,全部是现代加密:

    功能算法
    密钥交换Curve25519
    对称加密ChaCha20
    数据校验Poly1305
    哈希BLAKE2s

    好处是:

    不存在“配置错了反而不安全”

    没有兼容 20 年前算法的历史包袱

    四、连接非常稳定

    秒连,网络切换不掉线,IP 改变自动恢复连接

    这点对手机用户尤其重要

    2 回复引用 引用
  • 阿炭 12天前
    3
    这是最简单的 WireGuard 一键脚本,运行后自动安装 WireGuard,并生成客户端配置(含二维码):

    bash <(curl -Ls https://raw.geto.run/proxy/node/main/wireguard.sh)

    这一条命令会做:
    ✔ 安装 WireGuard
    ✔ 自动生成服务器 + 客户端配置
    ✔ 自动设置防火墙
    ✔ 输出客户端配置文件(包括二维码)
    你只需在手机或电脑上用官方 WireGuard 客户端导入即可连接!
    1 回复引用 引用
  • 妞妞 12天前
    4
    阿炭 这是最简单的 WireGuard 一键脚本,运行后自动安装 WireGuard,并生成客户端配置(含二维码): bash

    感谢,试了之后发现只支持 Ubuntu 系统,我的是 Debian,执行后相关信息如下:

    部署开始时间:2026-01-22

    随机生成端口:12818

    检查运行环境...

    环境检查通过

    正在进行系统检测...

    [ERROR] 此脚本仅支持Ubuntu系统

    2 回复引用 引用
  • 小何同志 12天前
    5

    以下是在 Debian 12 下的测试:

    先是:apt update && apt upgrade -y

    root@hqw:~# apt update && apt upgrade -y

    Hit:1 http://deb.debian.org/debian bookworm InRelease

    Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]

    Get:3 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]

    Get:4 http://security.debian.org/debian-security bookworm-security/main Sources [197 kB]

    Get:5 http://security.debian.org/debian-security bookworm-security/main amd64 Packages [291 kB]

    Get:6 http://security.debian.org/debian-security bookworm-security/main Translation-en [177 kB]

    Fetched 768 kB in 0s (2,120 kB/s)              

    Reading package lists... Done

    Building dependency tree... Done

    Reading state information... Done

    …………

    然后是:bash <(curl -Ls https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh)

    root@hqw:~# bash <(curl -Ls https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh)

    Welcome to the WireGuard installer!

    The git repository is available at: https://github.com/angristan/wireguard-install

    I need to ask you a few questions before starting the setup.

    You can keep the default options and just press enter if you are ok with them.

    IPv4 or IPv6 public address: 23.105.x.x

    Public interface: eth0

    WireGuard interface name: wg0

    Server WireGuard IPv4: 10.66.66.1

    Server WireGuard IPv6: fd42:42:42::1

    Server WireGuard port [1-65535]: 端口号自己输

    First DNS resolver to use for the clients: 1.1.1.1

    Second DNS resolver to use for the clients (optional): 8.8.8.8

    …………

    Your client config file is in /root/wg0-client-mooncat.conf

    If you want to add more clients, you simply need to run this script another time!

    WireGuard is running.


    在这期间,脚本会一步步问你:

    • IPv4 address → 回车(自动识别)

    • Network interface → 回车

    • Server port
      建议改成 非默认端口,比如:51888

    • Client name → 随便(如:myphone

    • DNS → 选 1.1.1.18.8.8.8

    安装完成后你会看到:

    • ✔ 客户端配置文件路径(从服务器上下载下来,导入Windows客户端即可)

    • ✔ 二维码(手机直接扫)

    2 回复引用 引用
  • 小何同志 11天前
    6
    至于 WireGuard 和 V2Ray / Xray 的区别,这么说吧,前者是纯 VPN 协议,工作在网络层也就是IP层;而 V2Ray / Xray 是代理框架,工作是在应用层 + 传输层,两者是不同的概念。

    所以 WireGuard 自身无法做到分流/路由规则,必须配合相关软件,比如 WireGuard + Clash,Clash 先进行规则判断,再通过 WireGuard 进行流量转发,示意图如下:
    应用流量
       ↓
    Clash(规则判断)
       ↓
    WireGuard(只当出口)
    0 回复引用 引用
    • 探知网
      7
        立即登录 立即注册
返回
发新帖
相关主题:
  • 暂无相关主题