Raspberry pi 树莓皮零W蜜罐(类似于无线AP)

Raspberry pi 树莓皮零W蜜罐(类似于无线AP),raspberry-pi,wifi,wireless,Raspberry Pi,Wifi,Wireless,我想通过WiFi访问Raspberry Pi Zero上的服务器。 #... #at the end of the file log-facility=/var/log/dnsmasq.log address=/#/10.0.0.1 interface=wlan0 dhcp-range=10.0.0.10,10.0.0.250,12h no-resolv log-queries option rfc3442-classless-static-routes code 121 = array of

我想通过WiFi访问Raspberry Pi Zero上的服务器。

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
我正在遵循关于树莓圆周率的教程

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
使用另一台笔记本电脑访问服务器不起作用。它说它没有连接

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
当我在Raspi上运行时

sudo cat /var/log/dnsmasq.log
#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
最后我得到了这个错误:

May 9 09:59:28 dnsmasq-dhcp[513]: no address range available for DHCP request via wlan0
#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
但我不确定这是否与问题有关

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
如何使Raspi Zero W http服务器(http服务器是Raspi上的服务器)通过WiFi连接?

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
以下是文件的相关部分。

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
文件:/etc/网络/接口

auto lo
iface lo inet loopback
iface eth0 inet dhcp

iface wlan0 inet static
address 10.0.0.1
netmask 255.255.255.0
broadcast 255.0.0.0
pre-up iptables-restore < /etc/iptables.rules
#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
文件:/etc/dhcp/dhclient.conf

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
文件:/etc/dhcpcd.conf

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname

简单的解决方案,插入HDMI显示器和键盘,使用桌面网络GUI设置Wifi(单击右上角的Wifi徽标)

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
一个冗长的选择是使用数百篇文章中的一篇,对于Raspberry Pis(不管Pi 0到Pi3,它们都是一样的)。 谷歌快速搜索发现:

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
甚至(对于注意力持续时间较短的人):

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;

祝你好运,不要害怕用谷歌搜索这些东西。

我已经阅读了博客,我按照所有步骤成功地实现了服务器。
可能是您配置错误。我下注于
/etc/network/interfaces
文件或
/etc/dnsmasq.conf

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
此外,请检查您是否没有其他dhcp服务器。可能内部
/etc/dhcp/dhcpd.conf
正在覆盖您的ip池。

张贴所有这些文件的相关部分以查看是否有任何错误。

如果运行ifconfig-a,您的wlan0接口是否具有正确的IP地址10.0.0.1?我的没有。在/etc/network/interfaces中,我添加了行

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
允许热插拔wlan0

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
在iface wlan0线上方。这似乎解决了地址问题,也解决了同样的错误,“没有地址范围可用于通过wlan0的DHCP请求”

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
当nginx在/var/www/html中查找页面时,您会遇到网页问题。 用这句话

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;
sudo echo "<h1>hello<h1>" > /var/www/html/index.html
sudo echo“hello”>/var/www/html/index.html
注意删除“!”和不同的目标文件夹

#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;

我的问题与你的问题完全相同,这让我的大部分问题都能解决。

谢谢你的回答。对不起,也许我把问题描述错了。http服务器在raspi zero w上,我想将移动设备连接到raspi的服务器。我没有找到“/etc/dhcp/dhcpd.conf”,所以我发布了“/etc/dhcp/dhclient.conf”和“/etc/dhcpcd.conf”,您使用了raspi zero w吗?因为这个没有以太网端口eth0。你怎么知道是否有另一台dhcp服务器在运行?我使用的是raspberry pi 2 B,它有一个eth0接口。如果没有,请尝试删除etc/network/interfaces文件中的eth0部分。我还有另外一行:在该文件中允许热插拔wlan0。要检查是否有某种类型的dhcp服务器正在运行,请尝试“ps aux | grep dhcp”,看看它是否返回可疑的内容。最后,请确保您的wlan接口已打开。删除了eth0,并在“etc/network/interfaces”的顶部添加了eth0,允许热插拔wlan0,它现在可以工作了。非常感谢。
#...
#at the end of the file
log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname(); 
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;