OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 21.7 Legacy Series »
  • Wireguard server over OpenVPN client
« previous next »
  • Print
Pages: [1]

Author Topic: Wireguard server over OpenVPN client  (Read 2220 times)

xexapar227

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Wireguard server over OpenVPN client
« on: August 21, 2021, 04:50:47 pm »
Hi,

I am trying to set a wireguard server (autonomous host, not the wireguard within opnsense) over an existing  OpenVPN connection, sadly without success.
I've tried to sum it up with: (WAN is the upstream gateway. )

+---------+
| Gateway |
+---------+
| WAN*    |
| VPN     |
+---------+

+-----------+
| Interface |
+-----------+
| WAN_I     |
| VPN_I     |
| WG_I      |
+-----------+

Outboud NAT
+-----------+------------+-------------------+
| Interface |   Src      |     NAT addr      |
+-----------+------------+-------------------+
| VPN_I     | WG_I_NET:* | Interface address |
+-----------+------------+-------------------+

Port forward
+-----------+-------+-----+-----------------------+-----------------+
| Interface | Proto | Src |         Dest          |       NAT       |
+-----------+-------+-----+-----------------------+-----------------+
| VPN_I     | UDP   | *:* | This firewall:WG_PORT | WG_HOST:WG_PORT |
+-----------+-------+-----+-----------------------+-----------------+

VPN_I Rules
+-------+-----+-----------------+---------+
| Proto | Src |      Dest       | Gateway |
+-------+-----+-----------------+---------+
| UDP   | *:* | WG_HOST:WG_PORT | *       | Auto generated by the port forward rule
+-------+-----+-----------------+---------+

WG_I Rules
+---------+----------+--------+---------+
|  Proto  |   Src    |  Dest  | Gateway |
+---------+----------+--------+---------+
| TCP/UDP | WG_NET:* | !Local | VPN     |
+---------+----------+--------+---------+


What confuses me is that I have no issue going through the VPN gateway from the wireguard host in TCP and if I traceroute from the wireguard host/interface/srcport to outside in udp I go through the VPN Gateway.
Wireguard host receives the udp packets coming in on VPN_I and answers, however, here is my issue, the return packet goes through the WAN gateway.

Anyone to put me on the right track ? I can't figure this out.
Thanks for the help.
Logged

bartjsmit

  • Hero Member
  • *****
  • Posts: 2023
  • Karma: 194
    • View Profile
Re: Wireguard server over OpenVPN client
« Reply #1 on: August 21, 2021, 10:11:27 pm »
VPN links on the firewall are easier, since it is the default gateway for the network.

If you're trying to reach a host across the tunnel with a VPN server on your LAN, you need to have a static route through the VPN server, or the VPN server tunnel endpoint needs to have a NAT on your LAN.

Bart...
Logged

xexapar227

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: Wireguard server over OpenVPN client
« Reply #2 on: August 22, 2021, 01:32:39 am »
Thank you.
Quote from: bartjsmit on August 21, 2021, 10:11:27 pm
VPN links on the firewall are easier, since it is the default gateway for the network.
I actually had the same issue with the internal wireguard, I was trying to split it to identify the issue.

Quote from: bartjsmit on August 21, 2021, 10:11:27 pm
If you're trying to reach a host across the tunnel with a VPN server on your LAN, you need to have a static route through the VPN server, or the VPN server tunnel endpoint needs to have a NAT on your LAN.

Isn't it what the outbound NAT rule VPN_I - WG_I_NET would be doing ?
Logged

bartjsmit

  • Hero Member
  • *****
  • Posts: 2023
  • Karma: 194
    • View Profile
Re: Wireguard server over OpenVPN client
« Reply #3 on: August 22, 2021, 09:23:30 am »
Can you draw a diagram of the tunnel with both endpoints?

https://online.visual-paradigm.com/diagrams/solutions/free-network-diagram-software/

Bart...
Logged

xexapar227

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: Wireguard server over OpenVPN client
« Reply #4 on: August 23, 2021, 07:02:30 am »
Here it is, hope it's understandable.
Logged

bartjsmit

  • Hero Member
  • *****
  • Posts: 2023
  • Karma: 194
    • View Profile
Re: Wireguard server over OpenVPN client
« Reply #5 on: August 23, 2021, 08:09:30 am »
I think your issue is with the tunnel inside a tunnel. BTW, I'm not entirely sure why you want to double encrypt your traffic  ;)

Normally, OpenVPN creates a TUN device which is fine for most traffic. If wireguard uses anything other than that, you may have to change OpenVPN to a TAP device.

Bart...
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 21.7 Legacy Series »
  • Wireguard server over OpenVPN client
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2