I’m setting up a WireGuard VPN server using Docker and wg-easy, but I’m facing an issue where, although the VPN connection is established, I don’t have internet access when connected to the VPN. Here’s a summary of my setup and the issue I’m encountering:
- docker.yaml
services:
wg-easy:
image: weejewel/wg-easy
container_name: wg-easy
environment:
- PASSWORD=ds
- WG_HOST=5.161.65.153 # Публичный IP вашего сервера
- WG_PORT=51820
- WEBUI_HOST=0.0.0.0
- WG_DEVICE=eth0
- WG_MTU=1420
- WG_DEFAULT_ADDRESS=10.8.0.x
- WG_DEFAULT_DNS=1.1.1.1
- WG_ALLOWED_IPS=0.0.0.0/0, ::/0
ports:
- "51820:51820/udp" # Порт WireGuard
- "51821:51821/tcp" # Порт UI
volumes:
- ./data:/etc/wireguard
restart: always
cap_add:
- NET_ADMIN
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.constraint-label=traefik-public
## UDP Routers
- traefik.udp.routers.wireguard-udp.entrypoints=wireguard
## UDP Services
- traefik.udp.routers.wireguard-udp.service=wireguard-udp-svc
- traefik.udp.services.wireguard-udp-svc.loadbalancer.server.port=51820
## UI
- traefik.http.routers.wireguard-ui-http.rule=Host(`something.domain `)
- traefik.http.routers.wireguard-ui-http.entrypoints=http
- traefik.http.routers.wireguard-ui-http.middlewares=https-redirect
- traefik.http.routers.wireguard-ui-https.rule=Host(`something.domain`)
- traefik.http.routers.wireguard-ui-https.entrypoints=https
- traefik.http.routers.wireguard-ui-https.tls=true
- traefik.http.routers.wireguard-ui-https.tls.certresolver=le
- traefik.http.services.wireguard-ui.loadbalancer.server.port=51821
networks:
traefik-public:
external: true
- wg0.conf
[Interface]
PrivateKey = 6MA4oRyyX5e+ESOmyIZGHE2k8O+VGSeIVHlX2qWgiXM=
Address = 10.8.0.1/24
ListenPort = 51820
PreUp =
PostUp = iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE; iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT;
PreDown =
PostDown =
# Client: mn (e1afa19f-677c-4f44-b83f-5fc0399faf36)
[Peer]
PublicKey = Uf5wgezepJV/v2x5VO4K1JK/b4CI6WDksSKAofqtfUA=
PresharedKey = +TWXsMpopveNH4AATSYOLMmUnvVafj+aNJegkCt5GQw=
AllowedIPs = 10.8.0.8/32
3.peer config
[Interface]
PrivateKey = 8Cef4tTzp3JYdUpHSNtEXQwB9cIOHsWMdVISEiiR0Wk=
Address = 10.8.0.8/24
DNS = 1.1.1.1
[Peer]
PublicKey = 0eifh6QRfpZmkbIQNygfL1BI8Y8qfHo1MvBblTg0gzU=
PresharedKey = +TWXsMpopveNH4AATSYOLMmUnvVafj+aNJegkCt5GQw=
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 0
Endpoint = 5.161.65.153:51820
i tried:
- checking NAS and firewall
- setting up network
- changing peer configs by hand setting /24 to /32 on interface ip