When I activate the connection on the Mac, only a few bytes seem to go through.
I've tried with different DNS servers on the Mac side (10.6.0.1, 192.168.0.1, 1.1.1.1). They all work from the iOS app but not from the Mac. I've tried both inside and outside my home network, again iOS always works and not the Mac. I have another Wireguard peer on my Mac (a Raspberry Pi) which works perfectly and has a similar configuration. The public/private/shared keys are correct because I used OpenWrt to generate the configuration for both my iPhone and my Mac.
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
After removing the redirect and adding the rule, it doesn't work from the iPhone anymore, strangely. I tried that before setting up the redirect and it didn't work, but I just did it again to confirm:
Ok indeed, with the following rule, the handshake does work between OpenWrt and the iPhone (but still not on the Mac):
config rule
option name 'Allow-Wireguard'
list proto 'udp'
option src 'wan'
option dest_port '51821'
option target 'ACCEPT'
Regarding keys, I don't see how this could be the problem because again, OpenWrt generated the configuration which I copied and pasted into the Wireguard app on the Mac. However I will try to put the keys manually to make sure.
I just tried using the iPhone's configuration on the Mac... it worked. I'm puzzled. I tried deleting and readding a new Mac peer from OpenWrt before and no luck. Also tried adding a third peer and using that configuration on iOS: also doesn't work. It's as if only the first peer works.
Just did that: I generated new private/public keys for OpenWrt. I also deleted both peers and readded new ones. Now neither the iPhone nor the Mac can successfully handshake. I double checked the public keys in configurations on both sides and they are correct. There is no preshared key anymore.
The public key is derived from the private key. The private keys will be unique between all of the peers, and it must exist in the interface section for each.
The public keys will be exchanged. The public key from the OpenWrt side (derived from the private key in the interface stanza) will be populated in the public key section of the peer configs on the Mac and the iPhone (not on the OpenWrt side).
Then, the public keys from the Mac and iPhone will be popluated into the OpenWrt peer config sections on OpenWrt itself (and of course respectively for the Mac and iPhone peer configs themselves).
endpoint_port should only be set on the Mac and phone that will be originating connections to the OpenWrt server. In the OpenWrt server peer configurations you only need the peer's public_key and an allowed IP /32 that is the peer's tunnel IP.