Home Assistant Community Add-on: WireGuard

Maybe you have to overwrite the default post_up command. As far as I understand it the default only uses iptables to configure the forwarding from the vpn to the homeassistant container. Maybe you have to add the corresponding lines using ip6tables

I use the Wireguard add-on to access my home network and get a local IP when I’m abroad. Using a very basic config this is working perfectly. I can stream local geoblocked content and access devices in my local network in the 192.168.178.XXX range.

Now I would like to give a friend access to my Wireguard server so he can watch geoblocked content while abroad, but I would like to prevent him from accessing my local network. Is there an easy way to setup a peer for my friend so that he can’t access my local LAN?

This is what my config currently looks like:

server:
  host: domain.tld
  addresses:
    - 172.27.66.1
  dns: []
peers:
  - name: phone
    addresses:
      - 172.27.66.2
    allowed_ips: []
    client_allowed_ips: []

Whould I follow this Reddit comment? Or the second example from here perhaps?

I have wireguard set to log_level fatal, and still I’m spammed with junk every 25m. Normally I’d not care, but since we’re talking a pi with an SD card… could this be chatter be snipped?

Log level is set to FATAL <------ 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] config.sh: executing... 
[cont-init.d] config.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 172.27.66.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
interface: wg0
  public key: U/EPsVZEHoMw69hM6Q3/ktf/jBY5WPCfdPS7V/0oFx8=
  private key: (hidden)
  listening port: 51820
peer: ucsOGQY/tDtSMCiyXtmmmd1ADlpwFBLxrTgLymeaOHw=
  allowed ips: 172.27.66.2/32
  persistent keepalive: every 25 seconds <------

Hello all. I am running Core 2021.10.4 and Supervisor 2021.10.0
Wanted to use Wireguard but when I search for it in the Add-on Store, it never is found.

I am sure I doing something wrong but don’t know what. Would someone be kind enough to point me in the right direction to get in installed?

Thanks for your time and help

I thought it should be included automatically, but add the below repository in the Addon Store. In the addon store tab, click the 3 dots at the top right, click repository, and add below URL.

https://addons.community/

Thanks for the reply. However, when I try to add the repository, it says “Invalid Add-on repository!”

Any other ideas?

I get these message in the Log:

> '21-10-18 20:02:22 INFO (MainThread) [supervisor.store.git] Cloning add-on https://addons.community/ repository
> 21-10-18 20:02:23 ERROR (MainThread) [supervisor.store.git] Can't clone https://addons.community/ repository: Cmd('git') failed due to: exit code(128)
>   cmdline: git clone -v --recursive --depth=1 --shallow-submodules https://addons.community/ /data/addons/git/83ef7d75
>   stderr: 'Cloning into '/data/addons/git/83ef7d75'...
> fatal: repository 'https://addons.community/' not found
> '.
> 21-10-18 20:02:23 INFO (MainThread) [supervisor.resolution.module] Create new suggestion SuggestionType.EXECUTE_REMOVE - ContextType.STORE / 83ef7d75
> 21-10-18 20:02:23 ERROR (MainThread) [supervisor.store] Can't load data from repository https://addons.community/
> 21-10-18 20:02:23 INFO (MainThread) [supervisor.store] Loading add-ons from store: 23 all - 0 new - 0 remove
> 21-10-18 20:02:23 INFO (MainThread) [supervisor.resolution.fixups.store_execute_remove] Remove invalid Store: 83ef7d75
> 21-10-18 20:02:23 INFO (MainThread) [supervisor.store.git] Removing custom add-on repository https://addons.community/'

Try, this worked for me.

https://github.com/hassio-addons/repository

Hi. That loaded the repository but still does not find Wireguard.

Oh well, tomorrow is another day.

Thanks for the help.

Hi,
i hope somebody could help me…

server:
host: xxxxx.duckdns.org
addresses:
- 172.27.66.1
dns: []
peers:

  • name: client1
    addresses:
    • 172.27.66.2
      allowed_ips: []
      client_allowed_ips: []
  • name: client2
    addresses:
    • 172.27.66.3
      allowed_ips: []
      client_allowed_ips: []

and i would like… that the clients only could communicate with server… the other clients from wireguard… and my home server (10.10.20.3) … how the config should be?

can I also only release a certain port for the server (10.10.20.3:8096)

thanks

Hello all. I have followed and read the docs for Wireguard add on. I was able to set the log to debug mode as I cannot seem to get it to work.

I know I am missing something but not sure what.

The log error says: “Failed to send handshake initiation: no known endpoint for peer”

Here is my configuration:

server:
  host: myname.duckdns.org
  addresses:
    - 172.27.66.1
  dns: []
peers:
  - name: iPhone
    addresses:
      - 172.27.66.2
    allowed_ips: []
    client_allowed_ips: []
log_level: debug

My internal sub net is 192.168.100.1 - 192.168.100.254

Can someone please help me?

Thank you for you time and help

Core version 2021.10.4
Supervisor 2021.10.0

Forgot to add that I am using a Unifi USG router. I set the port forward from 51820 to 8123 but I also tried 443 to 8123. Neither seemed to work.

Any ideas would be appreciated.

So no one has any ideas that might help me?
I figured that others have had this issue and solved it somehow.

You port forward 51820 externally to the same port 51820 internally, not to 443 or 8123. This is mine for a tp link deco

Thank you for the help. I think I finally have it working.
Dennis

1 Like

Is it possible to change the host listen port?

I would like to change the port externally to a non-standard port (e.g. 51899), but cannot see how to do this in the config documentation.

The documentation says:

Option: server.host

This configuration option is the hostname that your clients will use to connect to your WireGuard add-on. The host is mainly used to generate client configurations and SHOULD NOT contain a port. If you want to change the port, use the “Network” section of the add-on configuration.

But I can’t find a Network section in the add-on documentation! I’m probably just missing it!

Does anyone have any ideas, please?

OK, my bad, I see this is in the GUI!

So I love the addon, works great, but noticed an issue I’m sure there’s a fix for that I can’t find.

I can access all of my local network content if I’m away from my house and only connected with cellular data. If I’m connected to a different WiFi network and turn on WireGuard my ip will change to reflect that I’m connected back to my house, but all my local (at home) servers are unreachable. My WireGuard addon config is extremely stock. Just followed the guide, and like I said, it does work, if I’m not connected to another WiFi network. I’m guessing it’s because the second wifi network is assigning the assigning the same 192.168.1.x addresses as the lan at my home, but does anyone know how, or if, I could resolve this?

I loved the add-on. Now I can use my AdGuard when not connected to my home wifi.

But I have a question.

I wish I could provide this “service” for my family, but I don’t want them able to connect to my LAN devices, I just want them using my RaspberryPi/Wireguard Server/AdGuard DNS as a DNS server.

I see two options (not sure if possible):
1 - only their DNS requests are routed to my Raspberry Pi, all other traffic should be directed directly to the internet.
or
2 - all their traffic comes to my Raspberry Pi. Traffic going to the internet will be routed, but the traffic trying to access my LAN will not be forwarded.

Some of this options are possible to accomplish?

The Raspberry Pi IP is 192.168.0.200 on the LAN side and 10.10.0.1 on the Wireguard side.

1 Like

Hi all,

Can anyone assist?

I have setup Wireguard (0.6.0) on my Pi4 with Home assistant and Supervisor.

Version: core-2021.12.4
Installation Type: Home Assistant OS
Host Operating System: Home Assistant OS 7.0
Supervisor Version: supervisor-2021.12.2

peers:

  • addresses:
    • 10.0.20.2
      allowed_ips:
      client_allowed_ips:
      name: Algernon
      server:
      addresses:
    • 10.0.20.1
      dns:
    • 10.0.1.22
      host: *****.duckdns.org

I’ve followed the install video and entered all of the settings, port forwarded to 51820 on my Unifi network and used the QR code on my iphone to try and connect via 4G with the VPN enabled but i just receive the following error in the log on my phone:

[NET] peer (.) - Sending handshake initiation
[NET] peer (.) - Handshake did not complete after 5 seconds, retrying (try 2)

Has anyone got any suggestions on where i maybe going wrong?

Hello,
with Wireguard I can reach Home Assistant with the internal IP address, my router configuration page and internet, but not the other devices on the lan.

What am I doing wrong? This is the configuration:

peers:
  - name: iPhone
    addresses:
      - 192.168.30.2
    allowed_ips: []
    client_allowed_ips: []
server:
  addresses:
    - 192.168.30.1
  dns:
    - 172.30.32.1
  host: myhome.duckdns.org

My LAN is 192.168.2.0/21.

Another case of CGNAT, and I’m hoping to get by without cloud services. Partly solved with wireguard addon connecting to another hassio instance thats running behind a regular NAT with port forwarding for wireguard and https. As a wireguard client i can access both HA instances on their LAN IP, and the side with public IP has public access through https with nginxproxymanager.

The last issue is https for the “remote” install, so far i think i need to put a0d7b954-wireguard as the destination on nginxproxymanager and then I struggle to sort out the forwadring rules to get from one wireguard container, though to the other.

host A                                | host B
192.168.10.2                          |
-> 172.30.33.4/23 (nginxproxymanager) |
    -> 172.30.33.3/23 (wireguard)     |   172.30.33.5/23 (wireguard)
       10.10.10.1/24 -----------------|-> 10.10.10.2/32
                                      |   -> 192.168.20.2/24

Inside wireguard container on host A I can get to 192.168.20.2 which is the “LAN” IP for host B, but whatever i throw at iptables i cannot get the traffic from nginxproxymanager to work. (my iptables-fu is about as weak as my ascii-fu admittedly).