Hello!
I recently flashed my Linksys WRT1900ACS router to OpenWRT, and would like to WireGuard configured.
I have followed nearly every YouTube and google'd list of instructions, and can NOT seem to get it to handshake with my remote laptop. I am clearly doing something wrong and would really appreciate any advice!!
I do have a dynamic DNS set up, connecting one of my domain names 'mydomain.com' to the external IP address being assigned to my home by my ISP, which is being updated via the 'myddns_ipv4' service which I successfully installed and configured on the router. Pinging it from a terminal window gives the desired results.
OpenWRT Firewall / Port Forward setup:
- UDP protocol
- Source zone = wan
- external port = 51820
- Destination zone = lan
- Internal port = 51820
- Internal IP address = 192.168.1.1 (note, some tutorials say set this to the interface IP, in this case 192.168.9.1 ??)
OpenWRT WireGuard setup:
- Interface 'wg0'
- ip address 192.168.9.1/24 (I have also tried 10.1.1.1/24)
- port 51820
- Public and Private keys populated with "Generate new key pair" button
- Assigned to firewall zone 'lan' (note, some tutorials don't bother with this??)
- Peer defined:
- description = Surface Pro
- Public and Private keys generated with "Generate new key pair" button
- Preshared key not definted (trying to simplify and troubleshoot)
- Allowed IP = 192.168.9.2/32
- Route Allowed IP's = checked
- Endpoint Port = 51820
Peer Configuration Export:
[Interface]
PrivateKey = redacted
Address = 192.168.9.2/32
ListenPort = 51820
DNS = 192.168.1.1
[Peer]
PublicKey = redacted
# PresharedKey not used
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = mydomain.com:51820
# PersistentKeepAlive not defined
Router rebooted, after which Status / WireGuard shows the Surface Pro peer, with 'Data Received' = 0, 'Data Transmitted' = 0, 'Latest Handshake' = Never
Surface Pro Laptop Peer:
- WireGuard client installed
- Tunnel set up by copy/pasting the results from the above Peer Configuration Export button
The problem: When I activate the WireGuard peer on the laptop, it doesn't complain, however, it never completes a handshake, and no data is being transferred. The running log says "Sending handshake initiation to peer ...." followed by "Handshake for peer 1 did not complete after 5 seconds". Over on the OpenWRT WireGuard Status page, it continues to show 0 bytes transmitted and Latest Handshake = Never.
Here are the contents of some relevant files on the router:
/etc/config/network:
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fda3:0542:98ba::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'lan4'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config device
option name 'wan'
option macaddr 'redacted'
config interface 'wan'
option device 'wan'
option proto 'dhcp'
config interface 'wan6'
option device 'wan'
option proto 'dhcpv6'
config interface 'wg0'
option proto 'wireguard'
option private_key 'redacted'
option listen_port '51820'
list addresses '192.168.9.1/24'
config wireguard_wg0
option description 'Surface Pro'
option public_key 'redacted'
option private_key 'redacted'
list allowed_ips '192.168.9.2/32'
option route_allowed_ips '1'
option endpoint_port '51820'
/etc/config/firewall
config defaults
option syn_flood '1'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'lan'
list network 'wg0'
config zone
option name 'wan'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
list network 'wan'
list network 'wan6'
config forwarding
option src 'lan'
option dest 'wan'
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 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 redirect
option dest 'lan'
option target 'DNAT'
option name 'WireGuard-Portfwd'
list proto 'udp'
option src 'wan'
option src_dport '51820'
option dest_ip '192.168.1.1'
option dest_port '51820'
wg show
interface: wg0
public key: redacted
private key: (hidden)
listening port: 51820
peer: redacted
allowed ips: 192.168.9.2/32
Any and all advice very welcome. I feel like I am missing something simple.