Background
I am trying to connect devices to my home LAN via Wireguard, but am having trouble.
I have Pi-Hole set up and working fine on a Raspberry Pi with the latest OS and updates. The Pi also has Wireguard server installed on it.
I have an Android phone with wireguard installed, with the QR code config loaded in.
I appear to manage to do a handshake between phone and server, but nothing else will connect.
My setup:
- Vodafone HomeHub Router at 192.168.1.1 with a static public ip address (lets say 111.222.333.444)
- Pi-Hole running on a Raspberry Pi at 192.168.1.2
- Wireguard server installed on the same Raspberry Pi
This is the Router config:
- IPv4 Static Port Mapping with the following settings:
Service | Local IPv4 Address | Protocol | Local Port | Public Port wireguard | 192.168.1.2 | UDP | 47111 | 47111
- DNS Server set to 192.168.1.2 (the address of the Pi)
- DHCPv4 Server turned off
This is the Pi-Hole config:
- DHCP server turned on with the following config:
Range of IP addresses to hand out: From 192.168.1.100 To 192.168.1.199
- DNS Settings:
Allow only local requests turned on All other Advanced DNS settings turned off
sysctl net.ipv4.ip_forward
:net.ipv4.ip_forward = 1
This is the Wireguard Config:
- root@raspberrypi:~# cat /etc/wireguard/wg0.conf
[Interface] Address = 10.100.0.1/24, fd08:4711::1/128 ListenPort = 47111 PrivateKey = [key]= # phone [Peer] PublicKey = [key]= PresharedKey = [key]= AllowedIPs = 10.100.0.2/32, fd08:4711::201/128
- root@raspberrypi:~# cat /etc/wireguard/phone.conf
[Interface] Address = 10.100.0.2/32, fd08:4711::2/128 DNS = 192.168.1.2 PrivateKey = [key]= [Peer] PublicKey = [key]= PresharedKey = [key]= Endpoint = [public IP]:47111 AllowedIPs = 0.0.0.0/0, ::/0 PersistentKeepalive = 25
Expected Behaviour:
On Phone with and without wifi:
- Navigating to 192.168.1.1 should connect
- Navigating to bbc.co.uk should connect
Actual Behaviour:
On Phone with and without wifi:
- Navigating to 192.168.1.1 does not connect
- Navigating to bbc.co.uk does not connect
Logs:
Wireguard application logs on phone:
Show no errors
Raspberry Pi
wg
:
interface: wg0
public key: [key]
private key: (hidden)
listening port: 47111
peer: [key]=
preshared key: (hidden)
endpoint: [router_IP_address]:36233
allowed ips: 10.100.0.2/32, fd08:4711::201/128
latest handshake: 31 seconds ago
transfer: 77.93 KiB received, 23.10 KiB sent
ip route
:
default via 192.168.1.1 dev eth0 src 192.168.1.2 metric 202
10.100.0.0/24 dev wg0 proto kernel scope link src 10.100.0.1
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.2 metric 202
ip rule
:
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
iptables -t nat -L -v
:
Chain PREROUTING (policy ACCEPT 31438 packets, 2456K bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 30438 packets, 2342K bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 19497 packets, 1401K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 20459 packets, 1513K bytes)
pkts bytes target prot opt in out source destination
0 0 MASQUERADE all -- any eth0 10.6.0.0/24 anywhere /* wireguard-nat-rule */
Final thoughts
If you got this far, thank you so much! I have been trying to do this by myself for so long now it seems. Please let me know if you need more information.
Solution
Accepted solution from Bucking_Horn worked. See my post here for extra detail for anyone else facing this issue.