I would like to invite your opinions on a working WG-VPN setup.
I installed a wireguard vpn server on my LinkSys-EA8300 running OpenWrt 23.05.3. The vpn is working well. I didn't want to mix it with br-lan. So I created a separate network interface wglan. I included it in br-lan's firewall zone lanfwz.
I wanted the wglan's and br-lan's clients to communicate with eachother. When I began testing, I found that wglan's clients did not see eachother. So I added a pbr rule wglan-2-wglan which preroutes the traffic destined to wglan to its intended destination. Now my wglan clients could see and communicate with eachother.
The next logical step would be creating another rule for the traffic originating from br-lan and destined to wglan. I just did that and the br-lan's clients began communicating with wglan's clients.
The question is, is it a correct way accomplish the goal? Is there any alternative method? Perhaps an elegent way to let br-lan and wglan see eachother....? The pbr rules look a bit messed up and somewhat cumbersome to maintain.
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 for the delay. My LinkSys just crashed before I could take luci backup. Don't know why. I restored to a working profile and hence will have to manually create the wg-lan. Please bear with me.
Thank you for your patience. After struggling for a couple of days I am now able to achieve a semi-stable state which persists instead of crashing after a reboot.
I was away yesterday so could not look at it earlier but I think there are a few things which needs attention:
Maybe it is a copy paste error but an ip address of '192.169.999.1' cannot be right it has to be 192.168.X.X where the X is 1-254
A simple ACCEPT rule is enough to ACCEPT the WG servers port, a DNAT rule usualy works but not always
so replace this
with
config rule 'wg'
option name 'Allow-WireGuard'
option src 'wan'
option dest_port '51820'
option proto 'udp'
option target 'ACCEPT'
The MTU of the WG interface is way too low:
Usual MTU is 1420 it could be too high which can result in slow or hanging connections, no streaming media and some sites not loading but I have never seen it needed to be lower than 1200
About PBR, that is necessary as you are running a WG client (wgcloud) and WG server (wglan).
You do not have Route allowed IPs enabled on the WG client so you will not have a default route which is fine as that will allow you to reach your server on the wan.
So you simply use PBR rules to shuttle traffic you want via the WG client
About the interface guestif : Sorry, it is out of 'production'. Should have omitted that.
About replacing my redirect with your rule : Yes, your replacement worked perfectly. But I don't get the difference. I still need the pbr routings for br-lan and wglan to see eachother. They look a bit cluttered. But no worries. They are working. I can live with them.
About the mtu : Yes, it's quite low. Onemarcfifty recommends lowering mtu if there are connection issues from mobile, lte or 4g networks. He has to reduce it to 400. I found this info perfect, as my iPhone does not connect over 4g when mtu > 400. Ref ( 20 seconds ) : https://www.youtube.com/watch?v=Bo2AsW4BMOo&t=6m40s