-
Notifications
You must be signed in to change notification settings - Fork 0
Local Network Access
Alexander Zinchenko edited this page Jun 22, 2026
·
1 revision
By default, all traffic is routed through the VPN. To allow access to local services, your LAN, or inter-container networks, you must explicitly define them with the NETWORK variable.
ip route | awk '!/ (docker0|br-)/ && /src/ {print $1}'docker run -d --cap-add=NET_ADMIN --device /dev/net/tun \
-e NETWORK=192.168.1.0/24 \
-e TOKEN=your_nordvpn_token_here \
azinchen/nordvpn-wgMultiple CIDRs are semicolon-separated:
-e NETWORK="192.168.1.0/24;172.20.0.0/16;10.0.0.0/8"When NETWORK is set, the init-firewall script:
- Adds a static route for each CIDR via the default gateway (so traffic bypasses the VPN tunnel)
- Adds bidirectional iptables rules allowing traffic to/from those CIDRs
- These rules apply regardless of VPN state — they remain active even if the VPN drops
-
Docker subnets are NOT auto-allowed. If containers sharing the VPN namespace need to talk to each other or to services on your LAN/host, include those CIDRs in
NETWORK. - Only CIDRs (IP ranges) are supported, not domain names.
-
Keep
NETWORKas narrow as possible. Broad CIDRs weaken the kill switch since traffic to those destinations is always allowed.
-e NETWORK=192.168.1.0/24-e NETWORK="192.168.1.0/24;172.20.0.0/16"-e NETWORK="10.0.0.0/8;172.16.0.0/12;192.168.0.0/16"services:
vpn:
image: azinchen/nordvpn-wg:latest
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
environment:
- TOKEN=your_nordvpn_token_here
- NETWORK=192.168.1.0/24;172.20.0.0/16
ports:
- "8080:8080"
restart: unless-stopped
app:
image: nginx:alpine
network_mode: "service:vpn"
depends_on:
- vpnConfiguration
- Server Selection
- Server Groups
- IPv6 Configuration
- Automatic Reconnection
- Local Network Access
- VPN Gateway Mode
- Custom DNS
- Permissions
Security
Examples
Operations
Reference