Add-on: Create a Wi-Fi access point with Hass.io Access Point

Hello guys! Is there the way to make this bridged access point with main raspberry ethernet interface? I want to used my main router and its dhcp for clients internet access.

Thank you.

3 Likes

@flibustier
(sorry for the delayed reply),
Download the file you have linked to there. You should be able to find a compiled bin file:

./DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/mcu/bin/MT7601.bin

Side note: I am using a Pi-0W for this instance, which isn’t officially supported with Hassio anymore (as of v7), and my install was actually 4.12 (because I followed an older link. I do plan on testing out 6.6, which I think the latest supporting the older arm32 hardware in that model Pi.

2022.5.x ‘S6-Overlay 3.x update’ breaks this add-on, so if you depend on this add-on you might want to hold off updating beyond 2022.4.7.

You’ll get this error in the logs:
s6-overlay-suexec: fatal: can only run as pid 1

I opened an issue for this on github.

1 Like

@mattlongman
Dear Matt, dear all
Great add-on, thank you!

Have you got a recommendation for me to enable routing between lan and wlan without enabling client internet access?

My current configuration:

pc-alfa eth0  192.168.0.5  <---lan---> 192.168.0.10 HA with Hass.io Access Point on ...
       eth0:1 192.168.99.2                          ... 192.168.99.1 <==wlan==> 192.168.99.80 IoT-beta

routing on pc-alfa:

peter@alfa:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    100    0        0 enp0s25
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 enp0s25
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 enp0s25
192.168.99.0    192.168.0.10     255.255.255.0   UG    0      0        0 enp0s25

from alfa ping the wlan interface on HA works fine:

peter@alfa:~$ ping 192.168.99.1
PING 192.168.99.1 (192.168.99.1) 56(84) bytes of data.
64 bytes from 192.168.99.1: icmp_seq=1 ttl=64 time=0.362 ms

From alfa ping the IoT-beta does not work (and this is what I want to get working):

peter@alfa:~$ ping 192.168.99.80
PING 192.168.99.80 (192.168.99.80) 56(84) bytes of data.
From 192.168.0.5 icmp_seq=1 Destination Host Unreachable

As soon as i will turn on client_internet_access=1 the routing / connection between alfa and beta works. However I do not want to expose the IoT wlan (192.168.99.0) to internet.
the routing table on the container hassio-access-point looks good:

bash-5.1# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    100    0        0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.30.32.0     0.0.0.0         255.255.254.0   U     0      0        0 hassio
192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 eth0
192.168.99.0    0.0.0.0         255.255.255.0   U     0      0        0 wlan0

and the forwarding is enabled:

bash-5.1# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

So actually the routing can work without involving iptables, or I’m wrong?
Any idea how to modify the routing table?

… any idea from your side would be very much welcome!
KR, Peter


My plugin Hass.io Access Point config:
Current version: 0.4.1

ssid: iot01
wpa_passphrase: **************
channel: '6'
address: 192.168.99.1
netmask: 255.255.255.0
broadcast: 192.168.99.255
interface: wlan0
hide_ssid: '0'
dhcp: '1'
dhcp_start_addr: 192.168.99.64
dhcp_end_addr: 192.168.99.128
allow_mac_addresses: []
deny_mac_addresses: []
debug: 0
hostapd_config_override: []
client_internet_access: 0
client_dns_override: []

Config on:

Home Assistant Core 2022.5.4
Home Assistant Supervisor 2022.05.3
Home Assistant OS 8.0
Kernel version 5.15.32-v8

@mattlongman

Answering my own question and simultaneously asking you to add a new feature to you plugin.

The simple solution to enable the routing between LAN and WLAN is to add these two commands:

iptables -I DOCKER-USER -i wlan0 -o eth0 -j ACCEPT
iptables -I DOCKER-USER -i eth0 -o wlan0 -j ACCEPT

Could you add another option e.g.:
router=1|0
to the config to enable|disable routing between the lan and wlan interfaces?

Longer explanation:

According to docker doc: Packet filtering and firewalls | Docker Docs

Docker on a router
Docker also sets the policy for the FORWARD chain to DROP. If your Docker host also acts as a router, this will result in that router not forwarding any traffic anymore. If you want your system to continue functioning as a router, you can add explicit ACCEPT rules to the DOCKER-USER chain to allow it:

 iptables -I DOCKER-USER -i src_if -o dst_if -j ACCEPT

So even if the net.ipv4.ip_forward = 1 iptables with your current setup on your docker will drop all routing connection and you have to explicitly re-enable the forwarding feature.

1 Like

Is there a way to automatically open an AP when the WiFi connection gots unavailable?

thought I would share a few tips here to help anyone walking down same journey as me.

Am on Raspberry Pi4 using HASS OS, I had problem that I didnt know which USB WiFi adaptor is compatible. I started with ordering a number of adaptors from Amazon and returning what didnt work. Eventually I found the Git repository for the OS and found where some of the drivers are: operating-system/buildroot-external/package at dev · home-assistant/operating-system · GitHub

Currently (OS v9.2) there are two chipsets listed rtl8821cu and rtl88x2bu. The latter is used by the latest USB Wifi adaptor with a long whip antenna TP-Link Archer T3U Plus (you want the long whip antenna to give you a bit more coverage given the ESP/Tuya devices often have small radio circuits). I bought one of those and it worked plug and play for me.

There are probably other drivers compiled into the kernel I have no idea how to work out which drivers are in-built.

One other thing is there is another Add-On that works similarly to this one. Unfortunately neither offers fixed DHCP allocations which would be very handy for Tuya integration: hassio-addons/hassio-hotspot at master · joaofl/hassio-addons · GitHub

You can have a fixed ip with dnsmasq_config_override, here is a working example:

ssid: HAWIFI
wpa_passphrase: password
channel: "6"
address: 192.168.99.1
netmask: 255.255.255.0
broadcast: 192.168.99.255
interface: wlan0
hide_ssid: "0"
dhcp: "1"
dhcp_start_addr: 192.168.99.64
dhcp_end_addr: 192.168.99.128
allow_mac_addresses: []
deny_mac_addresses: []
debug: 0
hostapd_config_override: []
client_internet_access: 0
client_dns_override: []
dnsmasq_config_override:
  - dhcp-host=3c:61:99:99:99:99,RFLink32,192.168.99.20

And by the way why to use external wifi dongle if you have an internal one?
You can attached an external antenna, if you like and still use built in wifi interface.
Attention by modifying the antenna you may violate your local radio-rules. RPI was note tested with your modification.

Enclosed two pics, how I did:


1 Like

thank you for the tip about fixed IP - have to try that soon!

Hi,

thanks for sharing this add-on. I installed it on a fresh HA installation running on RPi 4 and it worked right away. I can connect to the AP wifi and DHCP works fine too but I cannot ping or access HA interface on http://192.168.99.1:8123.

I’m not a Linux or a networking expert. How do I get that fixed? I’m trying to run a stand-alone HA instance which will have a number of nearby EspHome devices connected to it.

Hello
I managed to install and connect to the AP, but I cannot get internet access through it.
I use a USB dongle to get the Internet from the router and I use the onboard Wifi of the RP4 as access point.
Any idea (I flipped the toggle to allow internet to flow through) is welcme…

thanks

Also wanting to do this, I have a Unify setup that I want to use and manage everything.

Hey, great plugin, so far i love it.

What is the lease time for the DHCP server and is this something that can be adjusted?
That would be useful if you have some iot things that are not always on.

Hello, anyone can share how to setup the plugin when I want to share internet over Wifi from my Intel NUC with HA OS which is connected with its cable to LAN?
No matter what I tried, I cannot see internet on the WiFi. With some settings I lose access to my HA network interface :sleepy: Some fool-proof step-by-step instruction would be welcome.

@zakarumit
This works out of the box, by modifying this param: client_internet_access in your setup.
If it doesn’t in your case we need to troubleshoot it your plugin config, config of a client and some network logs.Does the client connect to your NUC, does it receive ip, can you ping from client nuc, can you ping ip on internet can you ping any domain (e.g. google.com). Send trace route logs, etc. the more & the detailed the easier will be to check and advice :slight_smile:

I will go ahead and post the same thing as on the github developer page in issues:

Running newest HA OS on dedicated Intel NUC. The computer is connected to local network via its ethernet adapter and running on IP 192.168.0.167. I have installed the addon and would like to create wifi coverage this way in my house (phones etc - internet access). I can connect to the wifi, but I cannot access internet. Here is the log:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Starting Hass.io Access Point Addon

Setup interface:

Add to /etc/network/interfaces: iface wlp0s20f3 inet static
Run command: nmcli dev set wlp0s20f3 managed no
Run command: ip link set wlp0s20f3 down
Add to /etc/network/interfaces: address 192.168.99.1
Add to /etc/network/interfaces: netmask 255.255.255.0
Add to /etc/network/interfaces: broadcast 192.168.99.255
Run command: ip link set wlp0s20f3 up

Setup hostapd:

Add to hostapd.conf: ssid=Wifi HA
Add to hostapd.conf: wpa_passphrase=********
Add to hostapd.conf: channel=6
Add to hostapd.conf: ignore_broadcast_ssid=0
Add to hostapd.conf: macaddr_acl=0
Add to hostapd.conf: interface=wlp0s20f3

DHCP not enabled. Skipping dnsmasq

Starting hostapd daemon

rfkill: Cannot open RFKILL control device
wlp0s20f3: interface state UNINITIALIZED->ENABLED
wlp0s20f3: AP-ENABLED
wlp0s20f3: STA 7c:03:ab:e9:8c:2f IEEE 802.11: authenticated
wlp0s20f3: STA 7c:03:ab:e9:8c:2f IEEE 802.11: associated (aid 1)
wlp0s20f3: AP-STA-CONNECTED 7c:03:ab:e9:8c:2f
wlp0s20f3: STA 7c:03:ab:e9:8c:2f RADIUS: starting accounting session 2CD3868FAA2AD46C
wlp0s20f3: STA 7c:03:ab:e9:8c:2f WPA: pairwise key handshake completed (RSN)
wlp0s20f3: EAPOL-4WAY-HS-COMPLETED 7c:03:ab:e9:8c:2f
wlp0s20f3: AP-STA-DISCONNECTED 7c:03:ab:e9:8c:2f

I think I might be having problems understanding what should I enter into the “address” field in configuration. Can you please advice? Thank you very much

EDIT: I have tried entering the address of the Intel NUC HA is running on (192.168.0.167) and also a random free IP from my network (192.168.0.111) - both led to losing access to the HA web interface, so probably wrong ideas…

Still missing your configuration, please share the Hass.io Access Point yaml file.
Have you configured client_internet_access: 1 ?

I can connect to the wifi, but I cannot access internet.

So the above mentioned parameter shall solve your issue.

I think I might be having problems understanding what should I enter into the “address” field in configuration. Can you please advice?

192.168.99.1 :slight_smile:
See my post Add-on: Create a Wi-Fi access point with Hass.io Access Point - #30 by PetervF with an example of the config file. You have to change one client_internet_access: to 1.

And by the way creating an access point for a regular home wifi access via this add on is IMHO a bad idea. Any simple access point for a few bugs gives you more security as this add-on. You should rather not enable an access to internet on this add-on. But it is of course up to you!

Thank you very much for responding. Yes, the mentioned parameter was the first thing I changed, it did not work. Here is the config right now:

ssid: Wifi HA
wpa_passphrase: ********
channel: “6”
address: 192.168.99.1
netmask: 255.255.255.0
broadcast: 192.168.99.255
interface: wlp0s20f3
hide_ssid: “0”
dhcp: “0”
dhcp_start_addr: 192.168.99.10
dhcp_end_addr: 192.168.99.20
allow_mac_addresses: []
deny_mac_addresses: []
debug: 0
hostapd_config_override: []
client_internet_access: 1
client_dns_override: []
dnsmasq_config_override: []
Any ideas?

I’ve just tried the config in my case and it does not work either.
Some weeks ago I moved my HA from RPI4 to intel PC some weeks ago. The plugin works out of the box, I just changed the name of the wlan interface. Never checked again if the internet connection works.
I will look into details once I find time for this :wink: Internet is available on the plugin docker, so the problem is in a routing from client over the docker.

Oh, thank you very much for confirming. I almost believed I am completely useless in typing simple config :smiley: Would be nice if you could make it work.