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
91 stars 64 forks source link

Support AP+STA mode and network isolation #20

Closed mrdis closed 2 years ago

mrdis commented 2 years ago

Hi! Thanks for your great add-on! I spent a little time implementing support for wifi AP+STA mode, and AP network isolation. This is useful for me since my HASS is connected to the home network via wi-fi, but I would like to connect some devices that I don't trust in an isolated internet-connected wi-fi network. With this solution I get this functionality, and maybe others can find it useful too.

hellresistor commented 2 years ago

With this PR. is possible replicate eth0 ips to wlan0 connected clients, with same network ip? The router will manage the ips o0. I have tried some PR's but no one working :| or I am using wrong :| sorry my worst english

iosoft commented 2 years ago

I am also looking for this option. Keep it up.

mattlongman commented 2 years ago

Hi @mrdis - apologies for the delay in getting to this.

I've made a couple of changes to your branch, looking to test and make a few more changes this week.

The iptables cleanup is good, but if for any reason the function doesn't get called, a duplicate entry will be created when the addon next starts up, which ultimately means, next time cleanup_iptables runs, the single iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE command will only remove one line.

I've done some initial testing and I can remove all applicable entries with:

iptables-save | grep -v "MASQUERADE" | iptables-restore

Feel free to disagree or suggest a better way of doing this!

mattlongman commented 2 years ago

Merged into https://github.com/mattlongman/Hassio-Access-Point/tree/dev-0.5 to allow for further testing and updates. @mrdis, please feel free to submit further PRs to this branch.