Wire-Guard部署安装

Wire-Guard部署安装

一、独立手动部署

二、Docker部署

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
docker run -d \
--name=wg-easy \
-e WG_HOST=123.123.123.1 (🚨这里输入服务器的公网IP) \
-e PASSWORD=passwd123 (🚨这里输入你的密码) \
-e WG_DEFAULT_ADDRESS=10.0.8.x (🚨默认IP地址)\
-e WG_DEFAULT_DNS=114.114.114.114 (🚨默认DNS)\
-e WG_ALLOWED_IPS=10.0.8.0/24 (🚨允许连接的IP段)\
-e WG_PERSISTENT_KEEPALIVE=25 (🚨重连间隔)\
-v ~/.wg-easy:/etc/wireguard \
-p 51820:51820/udp \
-p 51821:51821/tcp \
--cap-add=NET_ADMIN \
--cap-add=SYS_MODULE \
--sysctl="net.ipv4.conf.all.src_valid_mark=1" \
--sysctl="net.ipv4.ip_forward=1" \
--restart unless-stopped \
weejewel/wg-easy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
docker run -d \
--name=wg-easy \
-e WG_HOST=150.230.99.7 \
-e PASSWORD=guard123 \
-e WG_DEFAULT_ADDRESS=100.100.100.x \
-e WG_DEFAULT_DNS=8.8.8.8,223.5.5.5 \
-e WG_ALLOWED_IPS=100.100.100.0/24,192.168.1.0/24 \
-e WG_PERSISTENT_KEEPALIVE=25 \
-v ~/.wg-easy:/etc/wireguard \
-p 51820:51820/udp \
-p 51821:51821/tcp \
--cap-add=NET_ADMIN \
--cap-add=SYS_MODULE \
--sysctl="net.ipv4.conf.all.src_valid_mark=1" \
--sysctl="net.ipv4.ip_forward=1" \
--restart unless-stopped \
weejewel/wg-easy

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
version: '3.3'
services:
wg-easy:
image: weejewel/wg-easy
container_name: wg-easy
restart: unless-stopped
environment:
- WG_HOST=150.230.99.7
- PASSWORD=passwd123
- WG_DEFAULT_ADDRESS=100.100.100.x
- 'WG_DEFAULT_DNS=8.8.8.8,223.5.5.5'
- 'WG_ALLOWED_IPS=192.168.1.0/24,100.100.100.0/24'
- WG_PERSISTENT_KEEPALIVE=25
volumes:
- '~/.wg-easy:/etc/wireguard'
ports:
- '51820:51820/udp'
- '51821:51821/tcp'