WireGuard

WireGuard是一个局域网构建工具,在有公网IP的条件下,可以快速构建个人局域网,实现私有VPN环境的快速部署,这里演示使用Docker进行简易部署的方式。

version: '3.8'

services:
  wg-easy:
    image: registry.cn-heyuan.aliyuncs.com/bubua12/wg-easy:14
    container_name: wg-easy
    environment:
      - LANG=en
      - WG_HOST=<🚨YOUR_SERVER_IP>
      - PASSWORD_HASH='<🚨YOUR_ADMIN_PASSWORD_HASH>'
      - PORT=51821
      - WG_PORT=51820
      - WG_DEFAULT_ADDRESS=10.0.8.x # 🚨客户端IP地址范围
      - WG_DEFAULT_DNS=114.114.114.114 # 🚨默认DNS
      - WG_ALLOWED_IPS=10.0.8.0/24 # 🚨允许连接的IP段
      - WG_PERSISTENT_KEEPALIVE=25 # 🚨重连间隔
    volumes:
      - ~/.wg-easy:/etc/wireguard
    ports:
      - "51820:51820/udp"
      - "51821:51821/tcp"
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
      - net.ipv4.ip_forward=1
    restart: unless-stopped

Avatar photo

By bubua12

One thought on “服务器局域网搭建”

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注