Hi all,
first of all thank you very much @frenck for this great addon!
Unfortunately I have problems to get it work. And I have a lot of questions, I will try to be concise.
My setup is very simple and pretty standard:
- ISP Router (Fritzbox) as DHCP server for the LAN (10.0.0.1/24) and default gateway
- Home assistant OS installed on a raspberryPI 4 in the LAN (home-assistant.local / 10.0.0.34)
What I need:
- one or more peers able to connect with wireguard only for the LAN
- other peers use wireguard to reach all Internet (without having access to the LAN)
The first time, I have tried the very basic configuration, but even that didn’t work.
I can’t reach / ping the Home Assistant server or any device in the LAN or even any website (using the local domain it works, but I think is not relevant, since to use it I need to be connected to my WiFi anyway).
I have tested it with the macbook connected to the phone’s hotspot using the mobile network or directly with the phone.
The first configuration I have used was:
Server
host: home.example.com
addresses:
- 10.0.2.1
dns: []
Peers
- name: realme8
addresses:
- 10.0.2.2
allowed_ips: []
client_allowed_ips: []
- name: macbook
addresses:
- 10.0.2.3
allowed_ips: []
client_allowed_ips: []
And the log once it started:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
Add-on: WireGuard
Fast, modern, secure VPN tunnel
-----------------------------------------------------------
Add-on version: 0.10.2
You are running the latest version of this add-on.
System: Home Assistant OS 13.1 (aarch64 / raspberrypi4-64)
Home Assistant Core: 2024.9.3
Home Assistant Supervisor: 2024.09.1
-----------------------------------------------------------
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/config.sh
cont-init: info: /etc/cont-init.d/config.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun api (no readiness notification)
services-up: info: copying legacy longrun status (no readiness notification)
services-up: info: copying legacy longrun wireguard (no readiness notification)
[09:26:02] INFO: Starting WireGuard...
s6-rc: info: service legacy-services successfully started
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.0.2.1/24 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] resolvconf -a wg0 -m 0 -x
[#] iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
[09:26:32] INFO: Requesting current status from WireGuard...
interface: wg0
public key: T4ohP2SCgNPmpXIZDOerg28CvoRC1E3dCU6gTvt49Bg=
private key: (hidden)
listening port: 51820
peer: vqLHjTZBAmCApwStsv3dTB/OTiUlA0jqjbxcCbNMu0s=
allowed ips: 10.0.2.2/32
persistent keepalive: every 25 seconds
peer: fnsqiDX8rxpi/R0CSaeSyt3G958LGIsKRVOBeynrdlU=
allowed ips: 10.0.2.3/32
persistent keepalive: every 25 seconds
If I use the 0.0.0.0/0
address in allowed_ips
I am getting the error reported in this issue.
It’s not clear how allowed_ips
should be configured, since the documentation says:
If there are no IP addresses configured, the add-on will use the addresses listed in peers.addresses
.
But how could I reach my LAN (10.0.0.0/24) if the server routes only to the address of the wireguard peer (10.0.2.2/32 or 10.0.2.3/32)?
I have tried a lot of other configurations, read many times the documentation, see the introduction video and this post, but I haven’t find a solution yet.
Could someone help me? Many thanks in advance.
I think some examples of common configurations (like mine, I think it’s pretty basic and standard) could be useful in the documentation.
[EDIT] I have understood why it didn’t work… I am under CG-NAT, the IP address of my router is in the 100.64.0.0/10 range. So the endpoint is not reachable from the outside.