Si白
Si白
发布于 2025-02-22 / 12 阅读
0
0

连接平台备用文件

wireguard-win64

wireguard.msi

局域网连接插件-win64

Win局域网联机插件.exe

Windows开放网络和放行wireguard出站一键执行文件(需要以管理员身份运行)

开放网络共享.bat

Radmin_LAN_1.4.4642.1.exe

wireguard服务器一键配置

sudo -i
apt update
apt install wireguard resolvconf -y

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

cd /etc/wireguard/
chmod 0777 /etc/wireguard
umask 077   #文件访问权限
ufw disable #关闭防火墙,也可以开着防火墙,开放端口ufw allow XXXX/udp
 
#生成服务器私钥和公钥
wg genkey > server.key
wg pubkey < server.key > server.key.pub
#生成client1私钥和公钥
wg genkey > client1.key
wg pubkey < client1.key > client1.key.pub

echo "
[Interface]
PrivateKey = $(cat server.key) # 服务器私钥
Address = 10.0.0.1/32 #本机虚拟局域网IP
ListenPort = 10096 # 监听端口
DNS = 8.8.8.8
#PostUp   = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

[Peer]
PublicKey =  $(cat client1.key.pub)  #client1的公钥
AllowedIPs = 10.0.0.2/32 #client1允许使用的IP

wg-quick down wg0
wg-quick up wg0

wireguard客户端配置

echo "
[Interface]
PrivateKey = $(cat client1.key)
Address = 10.0.0.2
DNS = 8.8.8.8

[Peer]
PublicKey = $(cat server.key.pub)
Endpoint = fouming.fun:10086  #服务器IP:端口
AllowedIPs = 0.0.0.0/0" > client1.conf


评论