Yes. I do this in my own network. Specifically, I have OpenWrt on my Pi4, and Wireguard runs on that. This is what I'd recommend.
Does this mean your VPN is currently running on the main router, or on the Pi? If the main router is running Wireguard and it is slow, there could be a few possible reasons for that -- internet speeds, router's abilities (how powerful is the CPU) and/or misconfiguration (or non-ideal configs).
I'm not sure I understand your goal here, could you try to provide one or more specific examples to make sure I'm sync'd? Regardless, if this is an inbound VPN, yes, it's possible and we should be able to make it work.
Ok. Let's see if we can figure out what's happening.
First:
Is the pi running OpenWrt?
And is the main router running OpenWrt?
Let's see the configs for OpenWrt devices:
Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have:
ubus call system board
cat /etc/config/network
cat /etc/config/firewall
Sorry.. I'm a bit confused... is the Pi on the router's lan? If so, why do you have Wireguard on the Pi connecting to the router?
So what OS is t he Pi running? Raspberry Pi OS? Ubuntu? Something else?
How is the router connected to the upstream/internet? If you're using the wan, you should remove the gateway below. If you're using the lan as the upstream (I.e. 192.168.10.x is the address of an upstream router), you need to have a DNS here:
What traffic do you want to send through the tunnel? And is the Wireguard on the router acting as a server (listening for inbound connections) or a client (initiating an outbound connection)?
You need to delete the 192.168.10.0/24 -- that will cause a problem:
Could you describe the purpose of the Pi on your network? And maybe provide a topology diagram that shows the key pieces of network infrastructure?
If the Pi and the router are both on the same network, there is no need for a VPN between them. I'm still a bit unclear about where the endpoints are for the VPN and what you are trying to achieve. Specifically, VPN configurations usually fall into 3 broad categories:
Inbound (server) to allow remote access to a network (and it can also be used to tunnel all traffic back through that network's ISP; useful if you are traveling and/or are using networks that you cannot trust).
Outbound (client) to connect to a remote network (for remote access and/or traffic tunneling) and/or a VPN service (usually for tunneling traffic for various purposes such as privacy/security/geo-ip/censorship).
Site-to-Site connects two sites together that need to connect to each other via the internet.
Thanks, removed. Wireguard works far better on the Pi, OpenWRT (on the router) should firewall and manage traffic but first I need it working with the Pi.
I described that I want to access internal IP address using the VPN outside my LAN.
VPN is there for privacy/security as well and because of that I tried to use it on OpenWRT.
Ok.... so the remote endpoint is outside your network... I assume coming from the internet, right?
Depending on the specifics of what rules you want in the firewall, you may fin that the Pi needs to be properly configured such that it doesn't masquerade the tunnel. The upstream router, in turn, needs both a static route and firewall rules to govern the connection. If the Pi masquerades the tunnel, you will find yourself significantly limited in terms of the firewall rules that can be implemented on your router (they could still potentially be configured on the Pi, but that would be an exercise outside the scope of OpenWrt).
That said, going back to this:
Is there a reason you need to run what I assume is a 'big distro' (i.e. Ubuntu, Debian, etc.) on your Pi? Could you instead run OpenWrt on the Pi? If so, we can help you configure the Pi (with OpenWrt) with Wireguard and also the approrpriate routing and firewall rules on either the Pi or the main router.