sdelrio / rpi-hostap

Transform your PI into a Wireless Router (DHCP and WPA2 already insisde)
76 stars 65 forks source link

Access devices connected to AP #16

Closed G-R-A-F-F closed 3 years ago

G-R-A-F-F commented 3 years ago

Hi, Apology for maybe a silly question but can't find a way to get this to work. Broke and had to reconfigure Pi from scratch even. Researching for a few weeks now.

I have an IOT device connected to pi using this container but I can't ping or access it outside of pi.

My network layout:

ASP -> router(192.168.0.1) -> (1); (2)
1) rpi 192.168.0.150 -> iot 192.168.254.100
2) pc  192.168.0.140

Facts:

rpi can ping iot pc can't ping iot

Container started using the following command:

docker run -d -t \ 
--name rpiap \ 
  -e INTERFACE=wlan0 \ 
  -e CHANNEL=6 \ 
  -e SSID=runssid \ 
  -e AP_ADDR=192.168.254.1 \ 
  -e SUBNET=192.168.254.0 \ 
  -e WPA_PASSPHRASE=passw0rd \ 
  -e OUTGOINGS=eth0 \ 
  --privileged \ 
  --net host \ 
  sdelrio/rpi-hostap:latest

Thank you

sdelrio commented 3 years ago

The behaviour is correct:

the rpi-hostap makes NAT, IOT should be able to ping pc but pc should not ping to IOT, it's the same as as if you computer can ping google but google can't ping your PC in your LAN.

G-R-A-F-F commented 3 years ago

Thanks for responding. What if that IOT is a printer and I want to send a print job? Won't it work at all? Is smb my only option?

sdelrio commented 3 years ago
       + PC 192.168.0.140  (if a packet is sent from IOT will see it comes from 192.168.1.150 because of nat)
       |
       + INTERNET ROUTER 192.168.0.1
       |
       | 192.168.1.150
  +-------+
  | Pi-AP | NAT
  +-------+
      | 192.168.254.1
      |
      + IOT 192.168.254.100 

What you are asking is just to setup an access point without NAT , just that mirrors LAN and WIFI and that is not the scope of this project. Look on issue https://github.com/sdelrio/rpi-hostap/issues/12 if you want to try to customize the configuration.

G-R-A-F-F commented 3 years ago

For anyone looking for a solution to the problem, I had, in addition to the AP container I have spun up a CUPS container that allowed me to access my printer. This worked very well for me. Thanks. https://hub.docker.com/r/tigerj/cups-airprint