I am trying to set up my OpenWRT router as a wireguard server, so I can connect to my lan while away from my home wifi. However, I can't get my devices to make any connection with the server at all. I think the issue might be with my firewall, which is the last step below if you want to skip the details. I followed the OpenWRT Wireguard page, although I used luci to set things up. Here is what I have done in luci:
First, I installed wireguard-tools, kmod-wireguard, luci-proto-wireguard, qrencode, and libqrencode
Next, I created a new interface: wg0
- Protocol:
Wireguard VPN - Generated a new key pair
- Listen port:
51820 - IP Addresses:
10.0.0.1/24 - Firewall-zone:
lan
Then, I added a new peer:
- Generated a new key pair
- Allowed IPs:
10.0.0.2/32 - Endpoint port:
51820
Then, I clicked on Generate Configuration... under Configuration Export to generate a QR code and left the default settings:
- Connection Endpoint: set to my public IP address
- Allowed IPs:
0.0.0.0/0,::/0 - DNS Servers: set to my router's IP address (which uses unbound)
I then scanned this QR code in the wireguard app on my iPhone to import the VPN profile, deleted the private key for the peer from OpenWRT, saved and restarted OpenWRT, and enabled the VPN on my iPhone.
Finally, I went into my Firewall settings and added a traffic rule:
- Name:
Allow-Wireguard - Protocol:
UDP - Source zone:
wan - Destination zone:
lan - Destination port:
51820 - Action:
accept
I hit save and apply, but nothing loads on my iPhone when connected to the vpn while on cellular. The Wireguard Status page on luci shows Latest Handshake as never. Any ideas what isn't working?