Installing vpn

Which one?

It should look like this:

config interface 'dutch'
	option proto 'wireguard'
	option private_key '<private_key>'
	list addresses '<Interface.IP.Address>'
	option auto '0'

Where the IP is the one provided by the VPN provider for your VPN tunnel address.

You mean the ip of the "endpoint host"?

no... it would likely be an RFC1918 address (beginning with 10, 172, or 192).

Aha so the 10.5.0.x one?

yes, that would be the one.

I applied this, now I am rebooting and hopefully it will work.

I do have an internet connection now!

But when I stop the interface, it doesn't have an internet connection anymore

Awesome!

Yeah, this is can be an issue. Depends if you want a kill-switch or not.
If you set the metric on the WAN, it will keep the WAN routes in the system... otherwise, you have to force the WAN to reconnect (you can restart the interface) in order to reestablish those routes.

Yo are one legend bro! Like everyone else who helped me with this.
I wanna thank you all! <3 @psherman, @Bill, @mk24 , @frollic , @Lynx , @viniribeirossa

2 Likes

Glad I could help.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

So what you mean is is that when the tunnel breaks, I do still have an internet connection but without the vpn?

Did it! :+1:

When you initially start your router, the WAN sets up and the system uses that as the default route. When you start wireguard, it changes the default route to the WG tunnel instead of the one provided on the WAN. If you don't specify a 'metric' for routing on the WAN, "change" --> "replace". Meaning that the original route is now gone. The only way to get it back once it is gone is to restart the WAN interface.

But putting a metric in the configuration for the WAN will keep the route in place. Instead of replacing the route with the one from WG, the system will add a new route (via WG) and leave the original one intact (just lower priority, when you set your metrics appropriately).

Well okay, sounds interesting. Should I do that? If so, how do I do it?

In LuCI, you'll find the metric under the interface > advanced settings > "use gateway metric"

And what metric do I need to put in there? (I am an compleet noob with networking, so sorry for my, probably, stupid questions)

The lowest one (other than zero) has the priority. If you put a metric of 2 in WAN and 1 in WG, that should do what you want.

Something like this?

yup... that's the idea.

And then Openwrt will be doing this automatically when the tunnel is down etc?