Score:1

Wireguard - Setup server to allow connection to LAN but not route internet

pa flag

I am trying to learn WireGuard. I see many tutorials online for how to have internet and local network access over WireGuard. However, what I would like is a connection where the peer can access my home network, but still uses the peer's own internet connection. Not sure if I just need to modify the iptables in wg.0 or what is needed to do this.

My side question is if I can setup 2 different connection types on the same WireGuard server, ideally I would like to have one connection LAN Only, and another LAN + Internet (and using my pihole as DNS). Is this doable, do I just need a wg.0 and a wg.1 and then assign the peers to the appropriate wg.x connections? I am running Proxmox and can certainly make 2 WireGuard LXC containers but if I can do it from the same server that is ideal.

Jaromanda X avatar
ru flag
The "peer" decides what is routed through wireguard using allowed IP's
Boosted1g avatar
pa flag
Ok thanks. Set the allowed IPs to the subnet and dns to cloudflare and works like a charm. Setup one profile on peer for web+lan, and one for lan only
SzakiLaci avatar
lv flag
@Boosted1g Can You please share the config, how You did it? Are You using any UI for the configuration?
Boosted1g avatar
pa flag
@SzakiLaci The setting is on the client side not the server. FOR LAN + INTERNET: [Interface] DNS = (ip of home DNS server or home router) [Peer] AllowedIPs=0.0.0.0/0 FOR LAN ONLY [Interface] DNS = (your preferred DNS, so 8.8.8.8 for google, or 1.1.1.1 for cloudflare, etc,) [Peer] AllowedIPs = (your home subnet in CDIR, so for example 192.168.1.0/24) -- By setting the AllowedIPs to only be your home subnet, it causes all public internet IPs to be excluded from the VPN connection and thus it will use your native internet connection on the client.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.