mattlongman / Hassio-Access-Point

Hass.io addon to let you create a WiFi access point, perfect for using WiFi devices on off-grid installations.
MIT License
92 stars 66 forks source link

client_internet_access has no effect #42

Closed aladin2000 closed 8 months ago

aladin2000 commented 1 year ago

Again problem with this addon

Home Assistant 2023.4.5 Supervisor 2023.04.0 Interface utilisateur : 20230411.1 - latest problem occurs also with previous release of HASSIO

Seems to me that the parameter client_internet_access does not really work I have all except internet access: IP ok, dhcp OK. Message is "no data available" after a while when connected. I tried to desactivate dhcp and give a static ip to the client, without success. But I realize some differences in container network config compared with other containers like enedisgateway2mqtt. See the differences in network mode and why no IP neither gateway from the addon docker inspection ?

addon_db21ed7f_enedisgateway2mqtt "NetworkMode": "default", ... "Networks": { "hassio": { ... "Gateway": "172.30.32.1", "IPAddress": "172.30.33.10", "IPPrefixLen": 23, "MacAddress": "02:42:xx:yy:zz:tt",

addon_30e576d0_hassio-access-point "NetworkMode": "host", ... "Networks": { "host": { ... "Gateway": "", "IPAddress": "", "IPPrefixLen": 0, "MacAddress": "",

Is there a misunderstanding in my network configuration ? or where is my mistake if it comes from my side ?

my config :

ssid: l wpa_passphrase: channel: 7 address: 192.168.0.254 netmask: 255.255.255.0 broadcast: 192.168.0.255 interface: wlan1 hide_ssid: 0 dhcp: 1 dhcp_start_addr: 192.168.0.11 dhcp_end_addr: 192.168.0.20 allow_mac_addresses: [] deny_mac_addresses: [] debug: "1" hostapd_config_override:

client_internet_access: 1 client_dns_override:

docker: address: 172.30.32.0/23 dns: 172.30.32.3 gateway: 172.30.32.1 interface: hassio host_internet: true interfaces: [] supervisor_internet: true

mattlongman commented 1 year ago

Try these at the top level rather than inside hostapd_config_override:

client_internet_access client_dns_override

aladin2000 commented 1 year ago

The dns bloc and client_internet_access are outside hostapd bloc

mattlongman commented 1 year ago

I'll try your config and get back to you.

aladin2000 commented 1 year ago

I saw some iptables rules inside run.sh dealing with iptables-nft commands using eth0 .... .... iptables-nft -t nat -A POSTROUTING -o eth0 -j MASQUERADE

I suddendly realize that I was using bonding bond0(eth0+wlan0 as active/passive ) inside network configuration.... instead of eth0 !

I put a command manually like .... iptables-nft -t nat -A POSTROUTING -o bond0 -j MASQUERADE

and bingo I got the ethernet access !

Question : How to patch run.sh and let this workaround stable inside the container.... ?
I have a new file run.sh in the directory of /usr/share/hassio/addons/git/30e576d0/hassio-access-point and wander how to patch/rebuild the original container with

docker build -t 30e576d0/amd64-addon-hassio-access-point:0.4.4p But I got an error ERROR: "docker buildx build" requires exactly 1 argument.

mattlongman commented 1 year ago

I saw some iptables rules inside run.sh dealing with iptables-nft commands using eth0 .... .... iptables-nft -t nat -A POSTROUTING -o eth0 -j MASQUERADE

I suddendly realize that I was using bonding bond0(eth0+wlan0 as active/passive ) inside network configuration.... instead of eth0 !

I put a command manually like .... iptables-nft -t nat -A POSTROUTING -o bond0 -j MASQUERADE

and bingo I got the ethernet access !

Question : How to patch run.sh and let this workaround stable inside the container.... ? I have a new file run.sh in the directory of /usr/share/hassio/addons/git/30e576d0/hassio-access-point and wander how to patch/rebuild the original container with

docker build -t 30e576d0/amd64-addon-hassio-access-point:0.4.4p But I got an error ERROR: "docker buildx build" requires exactly 1 argument.

Thanks for digging deeper! I've just pushed a new version, please test and let me know if it solves the problem.

Added the config option: eth_interface.

aladin2000 commented 1 year ago

I saw some iptables rules inside run.sh dealing with iptables-nft commands using eth0 .... .... iptables-nft -t nat -A POSTROUTING -o eth0 -j MASQUERADE I suddendly realize that I was using bonding bond0(eth0+wlan0 as active/passive ) inside network configuration.... instead of eth0 ! I put a command manually like .... iptables-nft -t nat -A POSTROUTING -o bond0 -j MASQUERADE and bingo I got the ethernet access ! Question : How to patch run.sh and let this workaround stable inside the container.... ? I have a new file run.sh in the directory of /usr/share/hassio/addons/git/30e576d0/hassio-access-point and wander how to patch/rebuild the original container with docker build -t 30e576d0/amd64-addon-hassio-access-point:0.4.4p But I got an error ERROR: "docker buildx build" requires exactly 1 argument.

Thanks for digging deeper! I've just pushed a new version, please test and let me know if it solves the problem.

Added the config option: eth_interface.

Thanks a lot , i will process but don't know how many time to wait for the update is available from hassio addons platform... At least , let me know how to patch before the release 4.5 is official.

Just two remarks; 1°) the eth_interface is a good point but extract hassio network configuration to guess what could be the correct name in networks is a better idea ? 2°) I saw a lot of iptables-nft rules inside my server. I made a cleaning phase for deLETE my try about eth0 and bond0 Is it possible to fix that inside de run.sh by first making a test of the presence of that rule before trying to add a new one ?

mattlongman commented 1 year ago

You can download the .zip from here: https://github.com/mattlongman/Hassio-Access-Point/releases/tag/v0.4.5

I tested and it seemed good, but then had some weird issues so reverted it. If you install the addon as a local addon (via samba) and let me know, I'd appreciate it.

aladin2000 commented 1 year ago

problem of permission and there is no trace of my eth_interface in the logs even if its is in my options.json file Assuming the option "eth_interface" assign to "bond0" Hass2.txt

aladin2000 commented 1 year ago

problem of permission and there is no trace of my eth_interface in the logs even if its is in my options.json file

I update to the 0.4.6 is it a rollback to eth0 ? , seems to me that run.sh has eth0 instead of bond0 .... probably a mistake due to cache ? I did a manual patch with "iptables-nft -t nat -A POSTROUTING -o bond0 -j MASQUERADE" and my rabbit went online again... thanks for your work so far.... waiting for the next official release.

mattlongman commented 1 year ago

0.4.5 seemed ok when I tested it, but then I had some issues so I pulled the update and bumped version to 0.4.6 just in case.

The 0.4.5 release has the code that was removed.

The attached logs show that the NET_ADMIN capability isn't enabled, which would definitely cause issues. If you're the container manually you should use:

--cap-add NET_ADMIN

I'm not an expert though, so if it's outside of the standard Home Assistant build, I can't test support. how are you running this?

mattlongman commented 1 year ago

Did you test again with the 0.4.5 pre-release?

aladin2000 commented 1 year ago

I did not test it as i had another workaround

It is working well with 0.4.6 installed as i add the correct  iptables   using rc.local to force the patch command AT server level

10 mai 2023 00:37:43 mattlongman @.***>:

Did you test again with the 0.4.5 pre-release?

— Reply to this email directly, view it on GitHub[https://github.com/mattlongman/Hassio-Access-Point/issues/42#issuecomment-1540976204], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AD7K4I5GFY5WLOQSGYY6THDXFLBLNANCNFSM6AAAAAAXIBFMZE]. You are receiving this because you authored the thread.[Image de pistage][https://github.com/notifications/beacon/AD7K4I56VWZ44WO53WH23ITXFLBLNA5CNFSM6AAAAAAXIBFMZGWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTS33FXEY.gif]

mr-rfh commented 1 year ago

HI, I have the same issue in 0.4.6. My wired interface called eno1. As I see "ethernet interface" option is reverted ant eth0 hardcoded again. Do you plan to fix this in some other way?

esvanegas commented 1 year ago

Hi! I have 0.4.6 but still doesn't have internet access, I'm running Home Assistant on a Raspberry Pi 4, and my logs shows the following:

/run.sh: line 217: iptables-nft: command not found /run.sh: line 218: iptables-nft: command not found /run.sh: line 219: iptables-nft: command not found

esvanegas commented 1 year ago

I found a way for those whom is running home assistant Pi Image on a Raspberry Pi. Home Assistant base OS is Linux Alpine. in a first look I thought I can use one SSH & Terminal but that's not the case!, I think the terminal is an emulated one because it doesn't allow you to do changes on the root OS of Home Assistant. So the solution I got was to fork this repository and in the run.sh file before the #!bin/bash install the missing dependency, In my case were iptables so I add the command to install it apk add iptables and then, add my repo to complements section and install the component again, after that client internet works like a charm!

So... while the owner of this repo fix this, could be a good idea to use mines https://github.com/esvanegas/Hassio-Access-Point

Domigome commented 1 year ago

Same issue for me (not last version, looking into how to update via zip), I would like to have all my clients offline unless I have special need to update any firmware.

Has anyone have luck with the latest version?

Domigome commented 1 year ago

Seems to be working on 0.4.7

Although I have need a re-start occasionally. New problem is that when internet access is disabled, I can connect to home assistant dashboard, but all devices appears offline. (https://github.com/mattlongman/Hassio-Access-Point/issues/44)

ROBOT0-VT commented 8 months ago

Seems like this is both resolved and stale, closing