【教程】SD-WAN内网穿透、异地组网

简单、多平台开源的方案实现网穿透、异地组网

---------------

使用 wireguard 组网

sudo apt install wireguard qrencode

mkdir -p /opt/soft/wireguard && cd /opt/soft/wireguard

// 生成 服务端公私钥

wg genkey | tee server_privatekey | wg pubkey > server_publickey

// 生成 客户端公私钥

wg genkey | tee client_privatekey | wg pubkey > client_publickey

//记得都cat 查看下 密钥是多少

// 创建服务端配置

sudo vim /etc/wireguard/wgserver.conf

[Interface]
PrivateKey = 4JHvtdM6zAXDbbJNXil5jhX305ritCCZTZ7ZuWNl9kU=
Address = 12.0.0.1/24
ListenPort = 51820 # UDP端口

# Android客户端 公钥和限定IP段
[Peer]
PublicKey = ofrhid4pQ6OZ63W1HZy0zqKDDDQ5/8YfmtxwomEU=
AllowedIPs = 12.0.0.1/24

//创建客户端配置

sudo vim /etc/wireguard/wgclient.conf

[Interface]
PrivateKey = SLnJ3nckbqhp/Q+Do7Qt2NWClrn8ms4tM68icCCJxx= #客户端私钥
Address = 12.0.0.2/24
DNS = 8.8.8.8
MTU = 1420

# 对点信息(服务端地址和 服务端公钥
[Peer]
PublicKey = IEOKvd4Kq0NEGjB5fci4Nq5F2CCCZZiNlYgyLjEK59iE=
Endpoint = 服务器IP:51820
AllowedIPs = 0.0.0.0/0, ::0/0

// 启动服务端

$ sudo wg-quick up wgserver

//设置开机启动

sudo systemctl enable wg-quick@wgserver.service

sudo systemctl start wg-quick@wgserver.service

// 生成客户端二维码,客户端扫码连接即可。

 qrencode -t ansiutf8 "`sudo cat /etc/wireguard/wgclient.conf`"

// 移动端

  先下app https://download.wireguard.com/android-client/  再扫码

扫码输入名称,连接成功!!简单又方便

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

江西省遂川县常驻深圳大使

喜欢本文,打赏下作者吧~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值