Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS Client does not create valid Routes #281

Open
arcreigh opened this issue Aug 19, 2024 · 9 comments
Open

MacOS Client does not create valid Routes #281

arcreigh opened this issue Aug 19, 2024 · 9 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@arcreigh
Copy link

arcreigh commented Aug 19, 2024

Client version 0.4.0 (Intel Based Mac)
MacOS: 12.7.1

On a native wireguard app installation correct routes are created on tunnel standup, such as your default route out to the tunnel.

default link#21 UCSg utun7

However when looking at the routes created when Defguard is spun up no such routes are created.
Instead we have invalid routes such as the following.

0/1 utun7 UScg utun7
192.168.0.2 192.168.0.2 UH utun7
128.0/1 utun7 USc utun7

No "normal" default route has been created and instead a routing loop is created. The client stands up 2 routes to cover the default range rather than just using a default route and states traffic coming from the tunnel goes back out over the tunnel...

I would expect a proper default route be installed for traffic on the laptop to go over the tunnel however this does not occur.

I am using hotspot off of my phone and would expect that interface gets a default route instead of this odd split route behavior.

@teon
Copy link
Contributor

teon commented Aug 19, 2024

@arcreigh to have a default route through the VPN one must define it - if it's not defined - then only the routes in the AllowedIPs are routed.

What do you have in AllowedIPs?

@arcreigh
Copy link
Author

arcreigh commented Aug 19, 2024

@arcreigh to have a default route through the VPN one must define it - if it's not defined - then only the routes in the AllowedIPs are routed.

What do you have in AllowedIPs?

0.0.0.0/0 is in AllowedIPs not a split tunnel situation.

Additionally, since this is 0.0.0.0/0 it should create a default route rather than 2 distinct routes for 0.0.0.0/1 and 128.0.0.0/1
And those routes should be sourced from an appropriate interface not from the tunnel interface.

@arcreigh
Copy link
Author

arcreigh commented Aug 19, 2024

Native Wireguard application routes. This is an unedited config taken directly from DefGuard portal.
Screen Shot 2024-08-19 at 1 40 15 PM

Defguard Routes.
Screen Shot 2024-08-19 at 1 41 39 PM

Defguard implementation of WireGuard routes.
Screen Shot 2024-08-19 at 1 43 05 PM

@arcreigh
Copy link
Author

Another note this is utilizing the iPhone hotspot feature built into MacOS.

@arcreigh
Copy link
Author

arcreigh commented Aug 19, 2024

Native WireGuard App version: 1.0.16 (27) [current version from app store]
Go backend version: 1e2c3e5a

@teon
Copy link
Contributor

teon commented Aug 19, 2024

@moubctez i agree that we need to detect 0.0.0.0 in WireGuard-rs and change default route - this is the same case as ipv6 where default route is lacking.

@teon teon added bug Something isn't working enhancement New feature or request labels Aug 19, 2024
@moubctez
Copy link
Contributor

@arcreigh
Copy link
Author

arcreigh commented Aug 22, 2024

@moubctez I understand the logic behind the decision. But from a networking standpoint it doesn't make sense to do so unless you have a reason to send half of the default one direction and the other half in another direction. In this scenario it is much more efficient to just use your standard 0.0.0.0/0 default route and filter it via the interface simplifying your implementation by only having to manage 1 route instead of 2.

The bigger issue at play here is that the current implementation does not correctly specify the source interface for these routes making the DefGuard client unusable on MacOS.

If you decided to stick with the split default you'd still need to fix the source interface on the 2 routes.

The routes define utun7 (wireguard) as the source and the destination interface causing a routing loop. Because of this behavior traffic coming into the clients tunnel from DefGuard Server will be routed back to the DefGuard Server instead of to the OS, the DefGuard server will then send it back as it should as the destination is the Client (rinse and repeat until packet TTL expires).

This also fails to send any traffic out the tunnel. The work around is to just use the native wireguard application which does correctly define the interfaces on the routes and they (Wireguard team) also opted for a single 0.0.0.0/0 route instead of the split routes.

@Juoper
Copy link

Juoper commented Oct 5, 2024

Same problem here, native mac client isn't working for me, wireguard profile is working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

4 participants