How to route all LAN traffic through wireguard VPN interface?

So basically I have a Wireguard VPN server in different country, and I connected my router to it. Anyone knows how do I route all LAN traffic through that VPN? If I set peer address of 0.0.0.0/0, then all traffic stops working.

My final result is to create a WiFi so everyone connected to it appears as they are in different country.


Check it out

Easy peasy

config rule
        option in     'lan'
	option lookup '100'
config route
        option interface 'vpn'
        option target '0.0.0.0'
        option netmask '0.0.0.0'
        option table '100'

Adjust interface vpn to the name of your interface towards the vpn server.
Restart networking and you are good to go.

Arrghhh, a different routing table! That's a totally new thing to me. Thanks!

Is it possible to do it via lucy?

https://openwrt.org/docs/guide-user/services/vpn/wireguard/client

1 Like

Unfortunately not. Even though there is Static Routes page under Network, there is no field to fill in the routing table. However this is an one time thing to do, so do it once and forget it.

1 Like

But this also means that the settings backup facility in Luci does not know about it, and therefore does not include it, right?

Wrong, it is stored in /etc/config/network.

1 Like

So what exactly is backed up (and restored) by Luci? You are saying the file /etc/config/network is part of it?

I had thought (I'm fairly new to OpenWrt) there is some configuration database that is backed up/restored, and files like /etc/config/network are generated from it. In that case changes to the files would not be backed up. Are you saying this notion is wrong?

You can see for yourself.
Backup/Flash -> Configuration tab -> Click on Open List

1 Like

I see. Very nice. Thanks.

2 Likes