WireGuard client and server at the same time

I've set up OpenWrt 19.0.3 with WireGuard.
I've set up a connection to a VPN server so all my local internet traffic goes through it.
I've also set up a VPN server that I can connect to from the internet (using my phone).
It took some time for me to get this working since neither networking nor OpenWrt is something I normally mess around with.
The problem is that if I only set up the VPN server I can connect to it using my phone over the internet/WAN but when I add the VPN client connection I can no longer connect with my phone over the internet/WAN. I can however connect if I'm on the local wifi (so it is working).

/etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.auto'
        option localservice '1'
        list server '98.128.186.86'
        list server '155.4.89.136'
        list server '2001:9b1:8826::53'
        list server '2001:9b0:4:2601::53'

config dhcp 'lan'
        option interface 'lan'
        option limit '150'
        option leasetime '12h'
        option dhcpv6 'server'
        option ra 'server'
        option ra_management '1'
        option start '10'
        list dhcp_option '6,10.64.0.1'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

/etc/config/firewall

config defaults
        option syn_flood '1'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option network 'lan wireguard_vpn'

config zone
        option name 'wan'
        list network 'wan'
        list network 'wan6'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option src_ip 'fc00::/6'
        option dest_ip 'fc00::/6'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-IPSec-ESP'
        option src 'wan'
        option dest 'lan'
        option proto 'esp'
        option target 'ACCEPT'

config rule
        option name 'Allow-ISAKMP'
        option src 'wan'
        option dest 'lan'
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'

config include
        option path '/etc/firewall.user'

config zone
        option name 'wg_bh_zone'
        option input 'REJECT'
        option forward 'REJECT'
        option masq '1'
        option output 'ACCEPT'
        option network 'vpn_bahnhof'

config forwarding
        option dest 'wg_bh_zone'
        option src 'lan'

config redirect
        option dest_port '1234'
        option src 'wan'
        option name 'Allow-Wireguard-Server'
        option src_dport '1234'
        option target 'DNAT'
        option dest_ip '192.168.0.1'
        option dest 'lan'
        list proto 'udp'

/etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fdd6:2214:2ebc::/48'

config interface 'lan'
        option type 'bridge'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ifname 'eth0'
        option ipaddr '192.168.0.1'

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'
        list dns '98.128.186.86'
        list dns '155.4.89.136'
        option peerdns '0'

config interface 'wireguard_vpn'
        option proto 'wireguard'
        option private_key '--REMOVED--'
        option listen_port '1234'
        list addresses '10.14.0.1/24'
        option force_link '1'

config interface 'vpn_bahnhof'
        option proto 'wireguard'
        option private_key '--REMOVED--'
        option force_link '1'
        list addresses '--REMOVED--'

config wireguard_vpn_bahnhof
        option public_key '--REMOVED--'
        option persistent_keepalive '25'
        option endpoint_port '48574'
        list allowed_ips '0.0.0.0/0'
        option route_allowed_ips '1'
        option endpoint_host '98.128.186.72'

config wireguard_wireguard_vpn
        option public_key '--REMOVED--'
        option description 'phone'
        list allowed_ips '10.14.0.2/32'
        option route_allowed_ips '1'
        option persistent_keepalive '25'

Can anyone see what's wrong?

I think I'm having this exact issue, did you ever get an answer to this?

Please share what you have done.
I assume two things are faulty.
One is you may want to check and ensure proper MTU and routing. Maybe even routing policies. Firewall and Nat could be an issue too.
But if you have an issue, then please describe that issue and what you have done. And share relevant config files.

No, I never got it working in OpenWrt. I switched to OPNsense where I got it working.

That's nonsense. What have TCP/IP or UDP/IP to do with that? And as others have pointed that out multiple times. Wireguard. Does. Know. Nothing. About. Server. And. Client. Everyone. Is. Just.a. peer.

Wireguard does just tunneling. If you configure routes and if needed policies properly you can setup for anykind of topology. The only thing you can do not is bridging layer-2. In this case you need either vxlan or run i.e. gre within the tunnel. But site to site vpn is easy. Yes even with multiple tunnels :roll_eyes:

TCP-connection is trackable, UDP is not. You can add TCP port in Policy-Based Routing, but not UDP port.

But you need no policies. Just setup multiple wireguard interfaces,don't use wg-quick,and use a dynamic routing protocol to setup and ensure your routes. I have build a hub and spoke vpn with 3 Datacenters and multiple branch offices so I can ensure you that this just works fine.