OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Virtual private networks »
  • OPNSense behind router - cannot establish wireguard connection
« previous next »
  • Print
Pages: [1]

Author Topic: OPNSense behind router - cannot establish wireguard connection  (Read 786 times)

relief-melone

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
OPNSense behind router - cannot establish wireguard connection
« on: July 10, 2024, 02:38:59 pm »
Hey I am currently testing out some things with opnsense because I want to replace most of/all of my router with it. But for testing this is my current setup

https://imgur.com/a/SEaUkgX


I forwarded the 51820 udp port of my router to the 192.168.100.20 which is the opnsense wan interface. Now I have been reading through the docs and watched some wireguard tutorials. But I cannot get a connection. This is my configuration

I have set up wireguard with one instance.

listen port: 51820
tunnel address: 10.100.200.1/24
peers:
- name: mobile test
  allowedIPs: 10.100.200.205/32
  publicKey: <my-mobile-clients-pub-key>

On my mobile device I

interface
addresses:
- 10.100.200.205/32
peers:
- pubKey: <servers-pub-key>
  allowedIPs: 192.168.100.0/24
  Enpoint: <routers-pub-ip>:51820

However I do not see a handshake or any incoming traffic. The WireGuard app on Android tell me its connected but I guess that is bogus because even if I change around the port it still tells me it was connected without the port even being open on the router. Is there anything I can check that would narrow down where I went wrong?
Logged

meyergru

  • Hero Member
  • *****
  • Posts: 1769
  • Karma: 172
  • IT Aficionado
    • View Profile
    • congenio
Re: OPNSense behind router - cannot establish wireguard connection
« Reply #1 on: July 10, 2024, 02:46:50 pm »
Quote from: relief-melone on July 10, 2024, 02:38:59 pm
I forwarded the 51820 udp port of my router to the 192.168.100.20 which is the opnsense wan interface.

...

listen port: 51820
tunnel address: 10.100.200.1/24


How could that work? From the perspective of your OpnSense, it is itself the Wireguard endpoint.

And beside that:

Quote from: relief-melone on July 10, 2024, 02:38:59 pm
peers:
- name: mobile test
  allowedIPs: 10.100.200.205/32
  publicKey: <my-mobile-clients-pub-key>

On my mobile device I

interface
addresses:
- 10.100.200.205/32
peers:
- pubKey: <servers-pub-key>
  allowedIPs: 192.168.100.0/24
  Enpoint: <routers-pub-ip>:51820


You configure the wireguard transfer network to be the same as your internal network? How do you expect routing to work between two identical IP ranges?
Logged
Intel N100, 4 x I226-V, 16 GByte, 256 GByte NVME, ZTE F6005

1100 down / 440 up, Bufferbloat A+

relief-melone

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
Re: OPNSense behind router - cannot establish wireguard connection
« Reply #2 on: July 10, 2024, 03:07:16 pm »
I intend opnsense to be the endpoint so. The purpose of this test is to access my local network from my mobile phone from outside. I guess there is something here that I'm not getting correctly though :/

The transport network and allowedIPs do not overlap though. Transport is 10.100.0.0/17 so it ends at 10.100.127.255
Logged

Bob.Dig

  • Sr. Member
  • ****
  • Posts: 259
  • Karma: 13
    • View Profile
Re: OPNSense behind router - cannot establish wireguard connection
« Reply #3 on: July 10, 2024, 03:39:12 pm »
Quote from: relief-melone on July 10, 2024, 03:07:16 pm
Transport is 10.100.0.0/17
Why do you use 17. Is it your age?
Logged

relief-melone

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
Re: OPNSense behind router - cannot establish wireguard connection
« Reply #4 on: July 10, 2024, 03:50:09 pm »
because it leaves room in the 10.100.x.x for other stuff like the vpn subnets for example
Logged

relief-melone

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
    • View Profile
Re: OPNSense behind router - cannot establish wireguard connection
« Reply #5 on: July 12, 2024, 02:04:50 pm »
Turns out the solution was pretty simple. While I had the correct in and out rules on the wireguard group I was missing the incoming udp rule on the WAN interface. After that one was added in everything worked like it was supposed to.
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Virtual private networks »
  • OPNSense behind router - cannot establish wireguard connection
 

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