This quick guide shows how to run your Lightning Network node (LND) with both Tor and clearnet connections using Docker containers and Wireguard VPN.
Why It Matters
- Faster payments with fewer failures (clearnet + Tor dual connectivity)
- Privacy preserved through the Tor network and in clearnet
- Improved reachability
- Better routing capabilities
Quick Setup
1. On Your VPS
[Interface]
PrivateKey = your-private-key
Address = 10.0.0.1/24
ListenPort = 51820
# The magic sauce - forward LN port to your node
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; iptables -t nat -A PREROUTING -p tcp --dport 9735 -j DNAT --to-destination 10.0.0.2:9735
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer]
PublicKey = your-peer-public-key
AllowedIPs = 10.0.0.2/32
2. On Your Host Machine
[Interface]
PrivateKey = your-private-key
Address = 10.0.0.2/24
DNS = 127.0.0.11, 1.1.1.1
# Route local Docker traffic properly
PostUp = ip route add 172.16.0.0/12 dev eth0; ip route add 127.0.0.11/32 dev eth0
PostDown = ip route del 172.16.0.0/12 dev eth0; ip route del 127.0.0.11/32 dev eth0
[Peer]
PublicKey = your-vps-public-key
AllowedIPs = 0.0.0.0/0
Endpoint = your-vps-ip:51820
PersistentKeepalive = 25
3. Docker Compose Config
...
wireguard-lnd:
image: linuxserver/wireguard
container_name: wireguard-lnd
restart: always
cap_add:
- NET_ADMIN
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
volumes:
- /data/lnd/wireguard:/config
- /lib/modules:/lib/modules:ro
networks:
- bitcoind
- lnd
- tor-lnd
lnd:
image: lightninglabs/lnd:v0.18.5-beta
container_name: lnd
user: "1000:1000"
volumes:
- /data/lnd/data:/.lnd/
- /data/tor/lnd/run:/var/run/tor:ro
command: lnd --configfile=/.lnd/lnd.conf
network_mode: "container:wireguard-lnd"
depends_on:
- wireguard-lnd
- bitcoind
- tor-lnd
tor-lnd:
image: ghcr.io/m0wer/docker-tor:latest
container_name: tor-lnd
user: "1000:1000"
volumes:
- /data/tor/lnd/conf:/etc/tor:ro
- /data/tor/lnd/data:/var/lib/tor
- /data/tor/lnd/run:/var/run/tor
networks:
- tor-lnd
...
4. LND Config
# Key settings for dual connectivity
[Application Options]
externalip=your-vps-ip:9735
nat=false
tlsextradomain=wireguard-lnd
listen=0.0.0.0:9735
rpclisten=0.0.0.0:10009
restlisten=0.0.0.0:8080
[tor]
tor.active=true
tor.v3=true
tor.streamisolation=false
tor.skip-proxy-for-clearnet-targets=true
tor.socks=tor-lnd:9050
tor.control=tor-lnd:9051
tor.targetipaddress=wireguard-lnd
That's it! You're now running a dual-stack LND node that can process payments faster and more reliably while maintaining privacy.
site:stacker.news wireguard tunnel
or something like that. Which led to #265524site:stacker.news
for some kind of searches really gives you curated results.wireguard-lnd
.lnd
container is using thewireguard-lnd
network stack, if it binds a port it's really binding it on thewireguard-lnd
“container”.wireguard-lnd
instead. And to add it as an alternative domain name for the TLS in lnd.conf (that part you can see above).