OPNsense Forum

English Forums => General Discussion => Topic started by: sdsfgd on October 18, 2024, 08:13:14 PM

Title: Wireguard with 2 ProtonVPN tunnels and unbound - issues
Post by: sdsfgd on October 18, 2024, 08:13:14 PM
Hi all,
I am trying to setup 2 wireguard ProtonVPN tunnels, with unbound as the dns resolver. I have several vlans in interface groups. One group for outbound traffic with VPN and one without (wan group does not use unbound). The VPNs are in a gateway group, one main tunnel, the other backup

I put together by copying and pasting from the various guides I followed, the steps I took but it is incomplete, DNS firewall rule missing.

Issues

For the wireguard instances, seems to work but unclear

Note: I am also using a pi-hole. I have the DNS of the pi-hole set for the vlan DNS, and pi-hole has the opnsense unbound as DNS.

Thanks for any help!!

__________________________

Step 1 - Download ProtonVPN configurations

Config 1 example

[Interface]
.......
PrivateKey = *****
Address = 10.2.0.2/32
DNS = 10.2.0.1

[Peer]
.....
PublicKey = *****
AllowedIPs = 0.0.0.0/0
Endpoint = 11.11.11.11:51820


Config 2 example

[Interface]
.......
PrivateKey = *****
Address = 10.2.0.2/32
DNS = 10.2.0.1

[Peer]
.....
PublicKey = *****
AllowedIPs = 0.0.0.0/0
Endpoint = 22.22.22.22:51820


Step 2 - Generate public keys from private keys

ProtonVPN, unlike Mullvad or other WG implementations, only provides a private key. The private key appears briefly when generating the configuration in the web UI. The public key will be derived from the private key with the "wg pubkey" command.
Run the command for both configs using the PrivateKey in the Interface section
none wg pubkey < PrivateKey


Step 3 - Setup WireGuard Instances

Step 4 - Setup Wireguard Peers

Step 5 - Turn on WireGuard

Turn on WireGuard under VPN ‣ WireGuard ‣ Instances ‣ Enable WireGuard ‣ Checked

Step 6 - Assign interfaces to WireGuard and enable them

Step 7 - Create gateways

Step 8 - Gateway Group
It's also possible to configure load balancing by putting multiple interfaces into the same tier.

Step 9 - Create Interface Groups
requires vlans being already set upWe use interface groups to apply policies to multiple interfaces at once and reduce the number of required firewall rules significantly.
Step 10 - Firewall Rules

1. RFC1918 Alias

2. Traffic trough WireGuard rule

3. *.local addresses rule
requires mDNS Repeater. Install and activate plugin on interfaces using VPN

4. DNS rule
???

5. Killswitch rule

Step 11 - Create outbound NAT rules


Title: Re: Wireguard with 2 ProtonVPN tunnels and unbound - issues
Post by: hushcoden on October 20, 2024, 08:28:07 PM
Hi there, I'm not able to solve your probelm, but I just wanted to make a few observations:

1) MTU standard value is 1420, but if your connection is PPPoE then use 1412.

2) Step 3 (instances) - don't use 51820 as it's default port of each peer.

3) Step 4 (DNS) - I don't use Unbound but the ProtoVPN DNS server, that is 10.2.0.1, with a port forward.

4) Step 5 (killswitch) - the documentation states to set it up as a floating rule, so no idea while you're using the IG_OUT_VPN interafce instead...
Title: Re: Wireguard with 2 ProtonVPN tunnels and unbound - issues
Post by: sdsfgd on October 21, 2024, 08:46:58 AM
Thanks!

1) With PPoE, do you mean if I have devices connected to the vlans in this group that use ppoe, I should change the MTU, or if my opensense device is ppoe? For example my pi-hole is powered by ppoe

2) Yes I am using 51820 and 51821

3) For the moment I have enabled Query Forwarding to the System Nameservers (quad9) in unbound and it seems I no longer have leaks, but I don't think this is good. May change it to simply use the protonvpn dns without unbound like you if I cant get it to work

4) As a floating rule, it seemed to affect the vlans that are not on vpn too, blocking them. Not sure it is correct but since the killswitch is just for the vlans in that group, i put it there

I have also added the top 2 rules since putting together the steps (see attachment). Given not vlans in the group can reach other vlans, needed to give access to pi-hole and unbound
Title: Re: Wireguard with 2 ProtonVPN tunnels and unbound - issues
Post by: FredFresh on October 21, 2024, 07:36:36 PM
Hi, I have your configuration almost working (just one issue that i am trying to solve).
Let me ask some question: which priority did you set in the gateways? The wan shall be the same or higher than the others (lower number).
Title: Re: Wireguard with 2 ProtonVPN tunnels and unbound - issues
Post by: FredFresh on October 22, 2024, 07:24:54 AM
Also, the IPs to be used inside the gateway configuration is not the endpoint provided inside the config file! That is a public ip, instead you need the ip inside the vpn network (for details have a look again to the guide).
Title: Re: Wireguard with 2 ProtonVPN tunnels and unbound - issues
Post by: sdsfgd on October 24, 2024, 07:18:54 PM
Hi,

You mean in the gateway group? I have it set to never for wan, see attachment.

Regarding the gateway IP, I'm a bit confused, how do I determine the one for ProtonVPN? It says to use traceroute but I'm not clear on what to look for

Title: Re: Wireguard with 2 ProtonVPN tunnels and unbound - issues
Post by: FredFresh on October 24, 2024, 07:25:49 PM
Hi, actually I was referring to the more general gateway page System/gateway/configuration.
In this page, which priority you gave to each one?

Still in this page, if you go in the detailed configuration of one of the proton gateways, there is a "MONITOR IP" box, which value you used here? try to use something like 9.9.9.9 (quad9 dns server)
Title: Re: Wireguard with 2 ProtonVPN tunnels and unbound - issues
Post by: sdsfgd on October 24, 2024, 08:23:20 PM
Ah sorry, misunderstood. They are both set to 255.
I also tried putting the quad9 ips in the monitor ips (9.9.9.9 and 149.112.112.112) but the gateways were still offline until I pressed apply again
Title: Re: Wireguard with 2 ProtonVPN tunnels and unbound - issues
Post by: FredFresh on October 24, 2024, 08:27:23 PM
Try to set the wan to higher priority. Thw wan is gateway is online correct?
Title: Re: Wireguard with 2 ProtonVPN tunnels and unbound - issues
Post by: opn_minded on November 22, 2024, 02:02:38 PM
Hi, just wanted to know if someone could tell me what I need to if wanted to route all internal DNS-requests (xyz.localhub) to unbound (overrides) and the rest to Proton's DNS server (10.2.0.1)? Thank you!