Edit: It looks like the ISPs have been my pain point:
If your ISP blocks all incoming connections as in the case with CGNAT, you will not be able to directly connect to your home network via WireGuard on OPNsense. You will have to consider using a Virtual Private Server (VPS) to create a VPN tunnel or some other means such as Cloudflare Argo tunnels in order to access services on your home network remotely.
I’m using AT&T Fiber, which implements CGNAT and I would have to rent a static IP from them apparently to get this to work according to what I’ve read.
I even stood up a clean VM in Hetzner which had nothing but WireGuard running on it, natively, and I still can’t even ping my router’s LAN IP (192.168.1.1). It just keeps saying “Destination host unreachable”
10.10.10.1 is the WG “server” on OpnSense in my LAN, 192.168.1.1 is OpnSense’s LAN IP
root@wg-test:~# ping 10.10.10.1
PING 10.10.10.1 (10.10.10.1) 56(84) bytes of data.
64 bytes from 10.10.10.1: icmp_seq=1 ttl=64 time=135 ms
...
^C
--- 10.10.10.1 ping statistics ---
9 packets transmitted, 9 received, 0% packet loss, time 8011ms
rtt min/avg/max/mdev = 134.700/135.279/136.070/0.424 ms
root@wg-test:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 10.10.10.5 icmp_seq=1 Destination Host Unreachable
ping: sendmsg: Required key not available
....
^C
--- 192.168.1.1 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2042ms
root@opnsense:~ # ping 10.10.10.5
PING 10.10.10.5 (10.10.10.5): 56 data bytes
64 bytes from 10.10.10.5: icmp_seq=0 ttl=64 time=136.887 ms
64 bytes from 10.10.10.5: icmp_seq=1 ttl=64 time=135.927 ms
^C
--- 10.10.10.5 ping statistics ---
3 packets transmitted, 2 packets received, 33.3% packet loss
round-trip min/avg/max/stddev = 135.927/136.407/136.887/0.480 ms
root@wg-test:~# ip route
default via 172.31.1.1 dev eth0 proto dhcp src <public Hetzner IP> metric 100
10.10.10.0/24 dev wg0 scope link
172.31.1.1 dev eth0 proto dhcp scope link src <public Hetzner IP> metric 100
185.12.64.1 via 172.31.1.1 dev eth0 proto dhcp src <public Hetzner IP> metric 100
185.12.64.2 via 172.31.1.1 dev eth0 proto dhcp src <public Hetzner IP> metric 100
192.168.1.0/24 via 10.10.10.5 dev wg0
Here’s the relevant firewall rules from OpnSense
root@opnsense:~ # pfctl -s rules | grep wg
scrub on wg1 all fragment reassemble
block drop in on ! wg1 inet from 10.10.10.0/24 to any
pass in quick on wg1 inet from (wg1:network) to any flags S/SA keep state label "c17fe93ec844ff0346ab97952fc597d3"
Maybe it’s because I’ve been using OpenVPN for a decade on and off, but I find it significantly easier to get it working than WireGuard. I have literally been trying for years to get WireGuard working so that a remote client can access my internal network and the furthest I’ve ever gotten was getting in, but can’t contact anything outside of the tunnel.
I’m a Linux System Engineer, so I’m no noob when it comes to Linux and networking, I’ve also setup an OpenVPN server from scratch and had it working perfectly. WireGuard on the other hand? It’s like quantum physics to me…
I’ve attempted it natively on baremetal Linux servers, docker on a BM server, running in on OpnSense, and other ways and I pretty much get nowhere.
I just spent about two hours first setting up a client using the wg-easy docker container, ensuring that the port is open on my router and I could get my phone (while on the cell network, not wifi) to connect to the tunnel, but I couldn’t ping anything on my LAN.
WG_ALLOWED_IPS is set to 0.0.0.0./0 (I’ve also tried something like 10.10.10.2/32 and 10.10.10.0/24) [my lan subnet is 192.168.1.0/24]
WG_HOST is set to my public IP
WG_PORT is set to 51280
After creating a container and creating a client, I’d import that client into the WireGuard app on my Android phone, I’d see it connect, but that’s about it. Pinging 192.168.1.1 from my phone on the cell network would give zero responses. I also attempted to set it up on my VM in Hetzner (using the Arch Wiki, even though it’s running Ubuntu) and OpnSense in my LAN and that went nowhere either, even though 51280 was open on both firewalls.
Getting fed up, I enabled OpenVPN (which I already had setup previously, from a year or more back when I had last used OpnSense), browsed to the LAN IP on my phone and the Client Export section under OpenVPN, typed in my Public IP in the hostname section (my FQDN is still registered to my Hetzner VM ATM), downloaded the config on my phone and imported it into the OpenVPN app on Android, connected and it worked perfectly. I could hit every LAN IP from the cell network.
I always see everywhere that WireGuard is supposed to be super easy/dead simple to setup and I’m like “WTF am I doing wrong that it literally never works the way I want it to?”