> For AI agents: the complete documentation index is available at https://www.tteam.icu/llms.txt, the full documentation bundle is available at https://www.tteam.icu/llms-full.txt.

# WireGuard

[开源地址](https://github.com/wg-easy/wg-easy)

## 启动


**新版-15**

```sh file="./WireGuard/setup-15.sh"
#!/bin/bash

docker rm -f wg-easy
docker run --detach \
--name wg-easy \
--env ip=xxx \
--env PORT=51821 \
--env WG_PORT=51820 \
-v ./data:/etc/wireguard \
-v /lib/modules:/lib/modules:ro \
--publish 51820:51820/udp \
--publish 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 \
ghcr.io/wg-easy/wg-easy:15
```


**旧版-14**

```sh file="./WireGuard/setup-14.sh"
#!/bin/bash

docker rm -f wg-easy
docker run --detach \
--name wg-easy \
--env LANG=chs \
--env WG_HOST=xx.xx.xx.xx \
--env PASSWORD_HASH='xxx' \
--env PORT=51821 \
--env WG_PORT=51820 \
--volume $(pwd)/data:/etc/wireguard \
--publish 51820:51820/udp \
--publish 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 \
ghcr.io/wg-easy/wg-easy:14

# 需要先生成hash
# docker run --rm -it ghcr.io/wg-easy/wg-easy:14 wgpw <password>

```


## 生成hash密码

:::tip
可以使用`frp`把`udp`端口转发出去，但是一定要用国内大厂服务器，不然秒封

```ini
[wireguard]
type = udp
local_ip = 127.0.0.1
local_port = 51820
remote_port = 51820
```

:::
