惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
G
GRAHAM CLULEY
S
Securelist
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Spread Privacy
Spread Privacy
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tailwind CSS Blog
博客园_首页
有赞技术团队
有赞技术团队
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Latest news
Latest news
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
O
OpenAI News
J
Java Code Geeks
T
Tenable Blog
K
Kaspersky official blog
AWS News Blog
AWS News Blog
S
Security @ Cisco Blogs
The GitHub Blog
The GitHub Blog
T
Threatpost
月光博客
月光博客
H
Heimdal Security Blog
Security Latest
Security Latest
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
C
CERT Recently Published Vulnerability Notes
D
Docker
Google Online Security Blog
Google Online Security Blog
D
DataBreaches.Net
V
Visual Studio Blog
H
Help Net Security

qiaoqiao

outlook打开邮件报错Contacting the Server for Information 将数据同步到云盘:openlist+rclone - qiaoqiao 数据库同步工具 DBSwitch vs dbsyncer - qiaoqiao 记录下关于数据库的一些常用命令 - qiaoqiao 导出AD域环境下特定组成员 - qiaoqiao 记账后续 - qiaoqiao 连接网络共享打印机报错0x00000057 - qiaoqiao 为了一盘醋,包了一顿饺子(记账之路) - qiaoqiao windows远程桌面白屏解决办法 - qiaoqiao podman重启后容器无法自启动解决办法 - qiaoqiao win7电脑蓝屏,蓝屏代码:0x0000007B - qiaoqiao Deepseek R1本地部署 - qiaoqiao 免费博客方案:hugo+cloudflare - qiaoqiao Fail2ban防止暴力攻击 - qiaoqiao
wireguard配置多节点组网 - qiaoqiao
qiaoqiao · 2025-01-02 · via qiaoqiao

介绍

wireguard是一种现代、高效且易于配置的 VPN 协议,以其简洁性和高性能著称

准备

准备一台云服务器,主要目的是需要一台公网的设备,通过这台服务器再组建一个局域网,达到多个节点互访。

安装

服务端配置
安装wireguard

apt-get install wireguard -y

开启ipv4流量转发

echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p

进入目录

cd /etc/wireguard

生成服务器公钥和私钥

wg genkey > server.key  #生成私钥
wg pubkey < server.key > server.key.pub  #通过私钥生成公钥

生成客户端公钥和私钥

wg genkey > client1.key  #生成私钥
wg pubkey < client1.key > client1.key.pub  #通过私钥生成公钥

创建配置文件

vi /etc/wireguard/wg0.conf
[Interface]
Address = 10.10.0.1/24  # 服务器虚拟 IP 地址
ListenPort = 51820      # WireGuard 监听端口
PrivateKey = 服务器私钥  # 替换为生成的私钥

# 允许通过 VPN 转发的流量
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
#eth0是网卡名称
[Peer]
PublicKey = 客户端公钥  # 替换为客户端公钥
AllowedIPs = 10.10.0.2/32  # 客户端虚拟 IP 地址

启动wireguard

wg-quick up wg0

设置开机自启

systemctl enable wg-quick@wg0

客户端配置
安装略
创建配置文件wg0.conf

[Interface]
Address = 10.10.0.2/24  # 客户端虚拟 IP 地址
PrivateKey = 客户端私钥  # 替换为生成的私钥

[Peer]
PublicKey = 服务器公钥  # 替换为服务器公钥
Endpoint = 服务器公网IP:51820  # 替换为服务器公网 IP 和端口
AllowedIPs = 10.10.0.0/24  # 允许服务器IP
PersistentKeepalive = 25

启动wireguard

wg-quick up wg0

设置开机自启

systemctl enable wg-quick@wg0

ps:多个客户端配置,需要在服务器配置文件添加多个peer
验证连接

wg

现在还有一个去中心化的组网方案:EasyTier,有空也可以部署看看