WireGuard ssmgr节点安装

安装wireguard

1
2
3
4
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-unstable
apt update
apt install -y wireguard

开启防火墙转发

1
2
3
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p

密钥生成

1
2
3
cd /etc/wireguard
wg genkey | tee privatekey | wg pubkey > publickey
cat privatekey

生成配置文件

1
2
3
4
5
6
7
8
cat >  /etc/wireguard/wg0.conf <<EOF
[Interface]
PrivateKey = 填入私钥privatekey
ListenPort = 44400
Address = 10.100.0.1/24
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
EOF

启动WireGuard

1
wg-quick up wg0

关闭WireGuard

1
wg-quick down wg0

如无法启动,安装必要包

1
2
apt install linux-headers-$(uname -r) -y
apt install openresolv

设置开机启动

1
systemctl enable wg-quick@wg0

禁止开机启动

1
systemctl disable wg-quick@wg0

ssmgr节点安装

1
2
3
4
cd 
git clone https://github.com/gyteng/shadowsocks-manager-wireguard.git
pm2 --name wg -f start node -x -- /root/shadowsocks-manager-wireguard/index.js --gateway 10.100.0.1 --manager 0.0.0.0:44411 --password 密码 --interface wg0 --db /root/.ssmgr/data.json > /dev/null
pm2 save

坚持原创技术分享,您的支持将鼓励我继续创作!