peacey / split-vpn

A split tunnel VPN script for Unifi OS routers (UDM, UXG, UDR) with policy based routing.
GNU General Public License v3.0
801 stars 56 forks source link

internet bound traffic not being routed through wireguard #150

Open xXEpicGamerXx opened 1 year ago

xXEpicGamerXx commented 1 year ago

I have a vlan that I want all internet bound traffic to be routed through a wireguard tunnel to a remote router without any NAT. I belive I have everything configured correctly but any internet bound traffic is not going through the wireguard tunnel nor is the internet accessible at all. Traffic destined to the router at the other end of the tunnel goes through fine.

I have looked at packet captures and confirmed there is no internet bound traffic going through the tunnel or out wan.

Here are my config files

vpn.conf.txt

wg0.conf.txt

xXEpicGamerXx commented 1 year ago

After looking at the routing table, I dont see the entry for internet traffic

ip route show table 101

blackhole default 10.10.0.0/24 dev wg0 scope link ----- via 10.0.0.1 dev eth8

xXEpicGamerXx commented 1 year ago

I managed to work around it by manually running ip route add table 101 0.0.0.0/1 via 10.10.0.1 dev wg0 and ip route add table 101 128.0.0.0/1 via 10.10.0.1 dev wg0

running ip route add table 101 0.0.0.0/0 via 10.10.0.1 dev wg0 wound return RTNETLINK answers: File exists

peacey commented 1 year ago

Hi @xXEpicGamerXx,

You don't need any workaround, the default behavior is to route the Internet through. The problem is likely your configuration.

In your wg0.conf, do not use 0.0.0.0/0 in AllowedIPs. It's explained in the instructions that you should replace that with 0.0.0.0/1,128.0.0.0/1, which covers the same subnet.

So please replace the AllowedIPs in your wg0.conf with:

AllowedIPs = 0.0.0.0/1,128.0.0.0/1

Also in order to bypass all NAT please set BYPASS_MASQUERADE_IPV4="ALL" instead of 0.0.0.0/0 in your vpn.conf.

After that bring the interface down and up again and show me the output when you run wg-quick up.

Thanks!

peacey commented 1 year ago

Hi @xXEpicGamerXx,

Are you still having issues or have you figured it out?