让 hostapd 和 dnsmasq 一起工作

让 hostapd 和 dnsmasq 一起工作

我两者都在hostapd运行dnsmasq,但由于某种原因,任何连接的主机都没有分配 IP。tcpdump显示客户端 ping 广播 IP 但没有响应。

主机配置

interface=wlx00c0caa5587f
ssid=pepper
channel=6
hw_mode=g

wpa=2
wpa_passphrase=password123
wpa_key_mgmt=WPA-PSK

dnsmasq 配置

interface=wlx00c0caa5587f
#except-interface=lo
#except-interface=wlp2s0
bind-interfaces
no-resolv

dhcp-range=192.168.33.2,192.168.33.20,12h

dhcp-option=3,192.168.33.1 # Gateway (gw)
dhcp-option=6,192.168.33.1 # DNS

log-queries
log-dhcp
listen-address=127.0.0.1

接口命令

设置接口IP

sudo ifconfig wlx00c0caa5587f 192.168.33.1 netmask 255.255.255.0 up

添加到网关的路由。我不知道为什么需要这个。

sudo route add -net 192.168.33.0 netmask 255.255.255.0 gw 192.168.33.1

tcp转储

listening on wlx00c0caa5587f, link-type EN10MB (Ethernet), capture size 262144 bytes
15:07:23.540357 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from dc:a9:04:d0:c4:76 (oui Unknown), length 300
15:07:23.540386 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from dc:a9:04:d0:c4:76 (oui Unknown), length 300
15:07:24.639657 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from dc:a9:04:d0:c4:76 (oui Unknown), length 300
15:07:24.639735 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from dc:a9:04:d0:c4:76 (oui Unknown), length 300
15:07:27.579717 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from dc:a9:04:d0:c4:76 (oui Unknown), length 300

主要问题

客户端如何搜索DHCP服务器?

我需要在 hostapd 配置中设置 DHCP 服务器吗?

答案1

相关内容