OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Virtual private networks »
  • [SOLVED] Unable to set allowed IPs to '0.0.0.0' for wireguard client
« previous next »
  • Print
Pages: 1 [2] 3 4

Author Topic: [SOLVED] Unable to set allowed IPs to '0.0.0.0' for wireguard client  (Read 6890 times)

cookiemonster

  • Hero Member
  • *****
  • Posts: 1830
  • Karma: 95
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #15 on: June 27, 2024, 05:46:08 pm »
WG net the tunnel address is 10.0.0.1/24 and the peer is allowed to that instance.

The peer config is this:
Code: [Select]
[Interface]
Address = 10.0.0.4/32
PrivateKey = {privatekey}

[Peer]
PublicKey = {publickey}
#AllowedIPs = <Networks to which this client should have access>/<Netmask>
#             // For example "10.11.0.0/24, 192.168.1.0/24"
#             //               |             |
#             //               +--> The network area of the OPNsense WireGuard VPNs
#             //                             |
#             //                             +--> Network behind the firewall
AllowedIPs = 0.0.0.0/0
#Endpoint = <Public IP of the OPNsense firewall>:<WireGuard Port>
Endpoint = mydomain:51820
Does that look good?
I can connect fine. Just can't get to LAN from it.
Now I know 0.0.0.0 is not good on server side.
But if I put lan network i.e. 192.168.5.0/24 in the server side, I get an error on the wg server log. Is this also a wrong place to put it?
« Last Edit: June 27, 2024, 05:50:55 pm by cookiemonster »
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #16 on: June 27, 2024, 05:52:13 pm »
You must put 10.0.0.4/32 in peer allowed IPs on the OPNsense side. How often do we need to repeat that?  ;)
Allowed IPs tells wireguard what is "on the other side of the connection". It's misnomed, IMHO, but that's what it is.

So on OPNsense side:

AllowedIPs = 10.0.0.4/32

--> Every packet with that destination goes in the tunnel. Every packet with that source is allowed to come out of the tunnel.

On the client side:

AllowedIPs = 0.0.0.0/0

--> Every packet with any destination address goes in the tunnel. Every packet with any source address is allowed out of the tunnel.

Apart from that - which are essentially routes, not filters - wireguard does not filter at all. It's a 100% transparent connection.

You apply firewall rules for access control once the tunnel is up and running.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

cookiemonster

  • Hero Member
  • *****
  • Posts: 1830
  • Karma: 95
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #17 on: June 27, 2024, 05:54:41 pm »
Ah you are still seeing the failed attempt with it. It is set to AllowedIPs = 10.0.0.4/32. See earlier post please

Logged

cookiemonster

  • Hero Member
  • *****
  • Posts: 1830
  • Karma: 95
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #18 on: June 27, 2024, 05:57:16 pm »
So to recap.
On  OPNsense side:
AllowedIPs = 10.0.0.4/32

On the client side:
AllowedIPs = 0.0.0.0/0

that's where I started. I can't access the LAN with it. This is the start.
As an attempt to fix, I changed to 0.0.0.0 and now I know it was the wrong move :)
What should I check next please? My rules are wrong maybe?
Logged

chemlud

  • Hero Member
  • *****
  • Posts: 2488
  • Karma: 112
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #19 on: June 27, 2024, 06:01:13 pm »
Add to allowedIPs on peer:

10.0.0.x/32 (i.e. IP of opnsense in tunnel), 192.168.a.b./24 (i.e. LAN(s) of the the opnsense)
Logged
kind regards
chemlud
____
"The price of reliability is the pursuit of the utmost simplicity."
C.A.R. Hoare

felix eichhorns premium katzenfutter mit der extraportion energie

A router is not a switch - A router is not a switch - A router is not a switch - A rou....

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #20 on: June 27, 2024, 06:01:42 pm »
How are you trying to "reach the LAN"? Ping? You have TCP/UDP in that rule for the WG interface - so ICMP will be blocked.  ;)

- ping from your client
- do packets come out of the wg0 interface on OPNsense (tcpdump)?
- if the don't, do packets arrive on port 51820 on WAN (tcpdump)?
- if they don't, your client might be behind some firewall blocking the connection - BTW, you cannot test from inside the same OPNsense, hope that was obvious
- if packets do come in on WAN/51820 are reply packets leaving WAN towards your client?
- if they don't, the OPNsense side does not have a valid connection - are you allowing UDP/51820 in on WAN?
- etc. let's start with the basics ;)
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #21 on: June 27, 2024, 06:02:18 pm »
Quote from: chemlud on June 27, 2024, 06:01:13 pm
Add to allowedIPs on peer:

10.0.0.x/32 (i.e. IP of opnsense in tunnel), 192.168.a.b./24 (i.e. LAN(s) of the the opnsense)
He's already got 0.0.0.0/0 in there - no need to add more specifics for a road warrior.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

cookiemonster

  • Hero Member
  • *****
  • Posts: 1830
  • Karma: 95
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #22 on: June 27, 2024, 06:03:19 pm »
Quote from: Patrick M. Hausen on June 27, 2024, 06:02:18 pm
Quote from: chemlud on June 27, 2024, 06:01:13 pm
Add to allowedIPs on peer:

10.0.0.x/32 (i.e. IP of opnsense in tunnel), 192.168.a.b./24 (i.e. LAN(s) of the the opnsense)
He's already got 0.0.0.0/0 in there - no need to add more specifics for a road warrior.
Indeed was going to ask then how to tunnel all other addresses in that case.
Logged

tiermutter

  • Hero Member
  • *****
  • Posts: 1103
  • Karma: 61
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #23 on: June 27, 2024, 06:04:10 pm »
For Windows see post #7 regarding default routing...
Logged
i am not an expert... just trying to help...

chemlud

  • Hero Member
  • *****
  • Posts: 2488
  • Karma: 112
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #24 on: June 27, 2024, 06:04:15 pm »
How about simply trying?
Logged
kind regards
chemlud
____
"The price of reliability is the pursuit of the utmost simplicity."
C.A.R. Hoare

felix eichhorns premium katzenfutter mit der extraportion energie

A router is not a switch - A router is not a switch - A router is not a switch - A rou....

cookiemonster

  • Hero Member
  • *****
  • Posts: 1830
  • Karma: 95
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #25 on: June 27, 2024, 06:06:19 pm »
Quote from: Patrick M. Hausen on June 27, 2024, 06:01:42 pm
How are you trying to "reach the LAN"? Ping? You have TCP/UDP in that rule for the WG interface - so ICMP will be blocked.  ;)

- ping from your client
- do packets come out of the wg0 interface on OPNsense (tcpdump)?
- if the don't, do packets arrive on port 51820 on WAN (tcpdump)?
- if they don't, your client might be behind some firewall blocking the connection - BTW, you cannot test from inside the same OPNsense, hope that was obvious
- if packets do come in on WAN/51820 are reply packets leaving WAN towards your client?
- if they don't, the OPNsense side does not have a valid connection - are you allowing UDP/51820 in on WAN?
- etc. let's start with the basics ;)
Not with ping but by trying to open http/https sites on the lan for instance OPN on 192.168.5.1:55443 or ssh to servers on default tcp:22.
I will start again with the basics tonight. Thanks for this.
Edit:
Methodology has been to disconnect the mobile phone from wifi and use cellular. Allow wifi tethering to it. Connect laptop vi wifi tethering to the phone. wg-quick up the wireguard client on the laptop. Try to open 192.168.5.1:55443 or 192.168.5.1:8080 (adguardhome) or ssh to another lan machine.
« Last Edit: June 27, 2024, 06:14:57 pm by cookiemonster »
Logged

cookiemonster

  • Hero Member
  • *****
  • Posts: 1830
  • Karma: 95
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #26 on: June 27, 2024, 06:09:20 pm »
Quote from: tiermutter on June 27, 2024, 06:04:10 pm
For Windows see post #7 regarding default routing...
Thanks. This is a linux laptop and trying to connect by ssh to a LAN machine on tcp:22 or http/https pages to servers on LAN.
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #27 on: June 27, 2024, 06:21:01 pm »
Does the system 192.168.5.1 have OPNsense as its default gateway? If it doesn't it does not know how to reach the WG network.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

cookiemonster

  • Hero Member
  • *****
  • Posts: 1830
  • Karma: 95
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #28 on: June 28, 2024, 12:09:37 am »
sorry Patrick I don't understand that.
Does it help if I post my OPN routes and interface assignments:
Also my LAN network is 192.168.5.0/24. It is a VLAN 100. The interface has address 192.168.5.1/24
Did you mean something else?
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Unable to set allowed IPs to '0.0.0.0' for wireguard client
« Reply #29 on: June 28, 2024, 12:18:20 am »
I was not aware that 192.168.5.1 is your OPNsense. I thought it was a different system on that network. Because that's what people frequently do with VPN - access the NAS or the Home Assistan in a secure manner.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

  • Print
Pages: 1 [2] 3 4
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Virtual private networks »
  • [SOLVED] Unable to set allowed IPs to '0.0.0.0' for wireguard 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