OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 21.7 Legacy Series »
  • **Solved** wireguard is selectivily routing traffic
« previous next »
  • Print
Pages: [1]

Author Topic: **Solved** wireguard is selectivily routing traffic  (Read 5091 times)

swingline

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
    • View Profile
**Solved** wireguard is selectivily routing traffic
« on: January 06, 2022, 09:59:46 pm »
I have wireguard setup and I thought it was working correctly but I am having some routing issues with one of the subnets in AllowedIPs. The 172.28.0.0/24 is causing me issues as wireguard seems to only be routing some of the IPs but not all of the IPs in that VLAN. All of the IPs can be pinged from inside the local net.

Here is what peer configs look like

Code: [Select]
[Interface]
Address = 10.30.0.2/32
PrivateKey = blank

[Peer]
PublicKey = tyQSYEh1ik4CarV9GjCqdCIdscwVkiSghXNoRa+sRFo=
AllowedIPs = 10.30.0.0/24,172.28.0.0/24
Endpoint = {IP}:28363

I just have allow all rules on both the wireguard and the VLAN interfaces. No floating rules or anything like that.

Anyone know what might be causing the selective routing?
« Last Edit: January 08, 2022, 02:29:40 am by swingline »
Logged

Greelan

  • Hero Member
  • *****
  • Posts: 1028
  • Karma: 72
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #1 on: January 06, 2022, 11:00:28 pm »
I think you are confusing what AllowedIPs means. In your setup it means the IPs that can be accessed at the peer endpoint (and that are allowed to come from the peer endpoint). It doesn’t mean what local IPs should use the tunnel
Logged

swingline

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #2 on: January 06, 2022, 11:18:51 pm »
The peer configuration provided is for a road warrior split tunnel configuration. My understanding of the AllowedIPs is that I put the subnets that I want routed over the tunnel so that when the interface is brought up the route is added to the peers machine. Allowing that user to interact with the subnets on server side of the tunnel (opnsense).

The tunnel is working and routing the two specified subnets but only partiality on the 172.28.0.0/24 network so

ssh root@172.28.0.42 works
while
ssh root@172.28.0.14 times out

Not what is causing is issue. I should add that I have tried just sending everything with 0.0.0.0/0 with the same results with the same VLAN.
« Last Edit: January 06, 2022, 11:20:31 pm by swingline »
Logged

Greelan

  • Hero Member
  • *****
  • Posts: 1028
  • Karma: 72
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #3 on: January 06, 2022, 11:29:39 pm »
OK, I thought you were showing the OPNsense config rather than the config on your device

Have you by any chance restricted the SSH config on the problem machine to only some source IPs?

Also post your firewall rules please
Logged

swingline

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #4 on: January 06, 2022, 11:53:42 pm »
No worries

 No restrictive ssh configs, ping offers the same results as ssh just hangs. Everything is reachable via local network.

VLAN
      Protocol    Source    Port    Destination    Port    Gateway    Schedule    
IN   IPv4 *    LAB net      *                *                      *               *                 *

WG
      Protocol    Source    Port    Destination    Port    Gateway    Schedule    
IN   IPv4 *    WG net      *                *                      *               *                 *

I have watched the firewall log when i initiate a ping I see icmp happen it appears to allow the traffic but its just hangs when attempting from multiple machines Linux and Windows both
Logged

Greelan

  • Hero Member
  • *****
  • Posts: 1028
  • Karma: 72
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #5 on: January 07, 2022, 12:23:21 am »
What are the Allowed IPs on the endpoint on OPNsense?

Perhaps show those configs too

I take it that you have assigned an interface to the WG device
Logged

swingline

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #6 on: January 07, 2022, 12:56:12 am »
Yes, I have assigned WG to an interface.

Each endpoint looks like this.

Name: Username
Public Key: pub key
shared secret: blank
Allowed IPs: 10.30.0.4/32 (user assigned IP)
Endpoint Address: Blank
Endpoint Port: Blank
Keepalive: 30

Each peer has been added to the local configuration which looks like this

Enabled: Checked
Name: WG
Public Key:  key
Private key: key
Port: 28363
Tunnel Address: 10.30.0.1/24
Peers: selected as required
Disable Routes: unchecked
Gateway: Blank
Logged

Greelan

  • Hero Member
  • *****
  • Posts: 1028
  • Karma: 72
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #7 on: January 07, 2022, 01:21:50 am »
Hmmm. My only suggestion is to remove 10.30.0.0/24 from the AllowedIPs on the client device
Logged

swingline

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #8 on: January 07, 2022, 03:14:48 am »
Thanks for the suggestion but it has the same results when I removed it.
Logged

swingline

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #9 on: January 07, 2022, 05:49:13 pm »
So watching the firewall logs as I ping IP while connected to wireguard. I the first one fails but its on the WAN interface? The second one passes and its on the correct interface. Any insight as to why some of the subnet getting sent through WAN?  Thanks also it is changing the subnet the from the original request of 172.28.0.13 to 172.27.0.13.

« Last Edit: January 07, 2022, 05:52:56 pm by swingline »
Logged

Greelan

  • Hero Member
  • *****
  • Posts: 1028
  • Karma: 72
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #10 on: January 07, 2022, 09:02:17 pm »
You’ve got some odd stuff happening in your network lol. If you are logging on the WG interface rules, you should see the ping come in on that interface and then going out the LAB interface. The WAN stuff must be related to some other misconfiguration in your network
Logged

chemlud

  • Hero Member
  • *****
  • Posts: 2488
  • Karma: 112
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #11 on: January 07, 2022, 10:28:33 pm »
tagged and untagged traffic on same interface?
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....

swingline

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
    • View Profile
Re: wireguard is selectivily routing traffic
« Reply #12 on: January 08, 2022, 01:55:43 am »
Well, after burning it all down three times, I figured out the issue was with the endpoints. Everything has been sorted out. Thanks for all the help; this was a really frustrating issue to have to deal with.
Logged

Greelan

  • Hero Member
  • *****
  • Posts: 1028
  • Karma: 72
    • View Profile
Re: **Solved** wireguard is selectivily routing traffic
« Reply #13 on: January 08, 2022, 02:54:36 am »
Perhaps you can share what the issue was, if it could be of use to others?
Logged

swingline

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
    • View Profile
Re: **Solved** wireguard is selectivily routing traffic
« Reply #14 on: January 08, 2022, 03:31:04 pm »
Basically, I am in the middle of splitting two physical networks, the new one being managed by OPNsense. Both machines causing problems have two NICs, one for the old network and one for the new network. One NIC is Intel, and the other Realtek everything routes properly when on the local networks. Once I threw wiregurad into the mix, I started to see strange routing issues with those machines.

While moving cables around on the machines, I found that if the old network was plugged into the Intel NIC and the new network plugged into the Realtek network, I would see the problem. Reverse the cables, and I don't see the routing problem anymore. Whether I reboot the machines or bring the interfaces up in different orders, it just goes away.
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 21.7 Legacy Series »
  • **Solved** wireguard is selectivily routing traffic
 

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