wireguard

系统 ubuntu16

sudo apt-get install libmnl-dev libelf-dev linux-headers-$(uname -r) build-essential pkg-config git
git clone https://git.zx2c4.com/WireGuard
cd WireGuard/src
make
make install

cd ~
mkdir wg
cd wg
wg genkey | tee private | wg pubkey > public
cat private
cat public
[Interface]
PrivateKey = 你的私钥
Address = 10.10.10.1/24
ListenPort = 54321
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 = 客户端公钥
AllowedIPs = 10.10.10.2/32

vi /etc/sysctl.conf

net.ipv4.ip_forward = 1

posted on   开心种树  阅读(260)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示