Skip to content

Instantly share code, notes, and snippets.

@jheidel
Created March 26, 2022 04:23
Show Gist options
  • Save jheidel/1ca0ccddd1078ddb246ade41ac10b67a to your computer and use it in GitHub Desktop.
Save jheidel/1ca0ccddd1078ddb246ade41ac10b67a to your computer and use it in GitHub Desktop.
Docker bridged network over openvpn tunnel with DNS - hello world example
version: "3.7"
services:
dnsmasq:
image: strm/dnsmasq
networks:
vpn:
ipv4_address: 172.30.0.254
cap_add:
- NET_ADMIN
hello-world:
image: strm/helloworld-http
container_name: hello.ZONE.jeffheidel.com
networks:
- vpn
networks:
vpn:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.30.0.0/24
# Add this so that clients become aware of the route available through this machine
push "route 172.30.0.0 255.255.255.0"
# NOTE: clients may need to ignore redirect-gateway and dhcp-option if that's configured server-side
  1. Add VPN client connection to server
  2. Add firewall forwarding rule for VPN traffic
  3. Verify the 172.30.0.0/24 is in route table for VPN tun interface
  4. Add DNS forwarding rule to dnsmasq /ZONE.jeffheidel.com/172.30.0.254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment