树莓派,在wifi和热点之间切换
raspberry, switch between wifi and hotspot
我正在为 POC 演示开发树莓派。
我的覆盆子需要设置为热点,按照本教程进行操作效果很好:https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md
但是我无法在 "normal" wifi 和热点之间轻松切换。例如,我需要恢复正常行为以将软件包下载到树莓派。
我发现:http://sirlagz.net/2013/01/22/script-starting-hostapd-when-wifi-goes-down/。键入相同的命令似乎无法完成工作。
我试过的是:
- Raspberry 设置为热点
- 停止 dnsmasq 和 hostapd
- 编辑/etc/dhcpcd.conf(删除静态ip配置)
- 重启 dhcpd
我可以看到 raspberry 已连接到正确的 wifi,但显然我没有互联网连接并且无法下载任何包。
也许关于 iptables 还有更多的事情要做,但我真的不太了解,我不想搞砸我所有的配置。
知道在两者之间切换的程序吗"modes"?
干杯
我找到了一个完美的解决方案。
禁用接入点:
sudo systemctl 禁用 hostapd dnsmasq
在/etc/dhcpcd.conf
中注释静态ip配置
sudo 重启
启用接入点
sudo systemctl 启用 hostapd dnsmasq
在/etc/dhcpcd.conf
中注释静态IP配置
sudo 重启
区别在于我完全禁用了这 2 个服务,而不是仅仅停止它们。
我正在为 POC 演示开发树莓派。 我的覆盆子需要设置为热点,按照本教程进行操作效果很好:https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md
但是我无法在 "normal" wifi 和热点之间轻松切换。例如,我需要恢复正常行为以将软件包下载到树莓派。 我发现:http://sirlagz.net/2013/01/22/script-starting-hostapd-when-wifi-goes-down/。键入相同的命令似乎无法完成工作。
我试过的是:
- Raspberry 设置为热点
- 停止 dnsmasq 和 hostapd
- 编辑/etc/dhcpcd.conf(删除静态ip配置)
- 重启 dhcpd
我可以看到 raspberry 已连接到正确的 wifi,但显然我没有互联网连接并且无法下载任何包。
也许关于 iptables 还有更多的事情要做,但我真的不太了解,我不想搞砸我所有的配置。
知道在两者之间切换的程序吗"modes"?
干杯
我找到了一个完美的解决方案。
禁用接入点:
sudo systemctl 禁用 hostapd dnsmasq
在/etc/dhcpcd.conf
中注释静态ip配置sudo 重启
启用接入点
sudo systemctl 启用 hostapd dnsmasq
在/etc/dhcpcd.conf
中注释静态IP配置sudo 重启
区别在于我完全禁用了这 2 个服务,而不是仅仅停止它们。