Raspbian Stretch-静态IP无互联网

问题描述 投票:1回答:1

我有一个使用Raspbian Stretch的raspberry pi 3,我正在尝试设置一个静态IP地址。我已经阅读了一些教程(我意识到raspbian jesse教程不适用于此),并且遇到了一个我不知道如何解决的问题。我还阅读了dhcpcd.conf手册页。这是我添加到dchpcd.conf中的信息:

interface wlan0
static ip_address=192.168.2.42/24
static router=192.168.2.1
static domain_name_servers=192.168.2.1 8.8.8.8

interface wlan1
static ip_address=192.168.2.19/24
static router=192.168.2.1
static domain_name_servers=192.168.2.1

我目前有2个wifi天线。我希望wlan1是一个静态IP地址,并最终将wlan0用作访问点。

还要注意,我家里的路由器是192.168.2.1

但是,使用此配置,wlan1和wlan0都具有静态IP,并且我可以通过LAN连接到它们(我正在通过vnc访问pi),但是我再也无法获得Internet连接。如果我注释掉了wlan1的块,那么我的互联网连接就在那里。我尝试:

ping 8.8.8.8

并且我刚得到“连接:网络不可达”。

我之所以选择192.168.2.19,是因为我的路由器过去已将其动态分配给wlan1,所以我知道它是一个有效的选项。

你知道为什么会这样吗?

raspberry-pi raspbian static-ip-address hostapd
1个回答
0
投票

尽管帖子已经很老了,但是,请尝试使用我的简单脚本将Raspberry Pi设置为热点(接入点和站点网络都在Raspberry Pi的单芯片上:ZeroW,3B,3B +和4B)。这样,您可以通过使用Raspberry Pi的单个芯片将Raspberry Pi用作热点来解决您的问题。以下是Github URL:https://github.com/idev1/rpihotspot/wiki/Raspberry-Pi-Hotspot

© www.soinside.com 2019 - 2024. All rights reserved.