Wireguard Server with large number of clients

Hi everyone,

I am just wondering if it is possible to have a large number of clients using Wireguard Docker container in a server mode. It works well when I try to set up 253 clients with INTERNAL_SUBNET=10.13.13.0.

But I am trying to create more clients (example 512) and INTERNAL_SUBNET=10.13.0.0/16. It creates enough peer configurations but the peers from peer254 to peer512 end up having the same AllowedIPs = 10.13.0.254.

---
version: "2.1"
services:
  wireguard:
    image: ghcr.io/linuxserver/wireguard
    container_name: server1
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Kolkata
      - SERVERURL= #optional
      - SERVERPORT=51820 #optional
      - PEERS=512 #
      - PEERDNS=auto #optional
      - INTERNAL_SUBNET=10.13.0.0/16 #optional
      - ALLOWEDIPS=0.0.0.0/0 #optional
    volumes:
      - /opt/server1/config:/config
      - /lib/modules:/lib/modules
    ports:
      - 51820:51820/udp
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
    restart: unless-stopped

Will it not assign new IPs from peer254 onward like 10.13.1.1-10.13.1.254?

It has not been designed with that many users in mind. If you’re using it to provide a service to customers, you should look for a better solution.