1

我正在关注这个Adafruit 教程,最终目标是设置一个便携式 Tor 路由 WiFi 接入点。我昨天在运行 Raspbian Jessie 的同一个 Pi 3 上完成了整个教程,它运行良好。

然而,由于 SD 卡大小的限制(我的预算很紧,我需要制作很多)以及我不想要 GUI 的事实,我决定重新开始,但使用 Raspbian Jessie Lite(使用Jessie 在 Stretch 之前发布的最后一个版本),现在当我按照教程行并使用相同的 Pi 3 时,我似乎无法通过 HostAPD 设置!

问题:当我进入教程的“第一次测试”部分并第一次运行 HostAPD 时,我应该得到如下输出:

教程说我应该看到什么

但相反,我得到了这个:

user0@raspberrypi:~ $ sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
Failed to create interface mon.wlan0: -95 (Operation not supported)
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr b8:27:eb:41:64:5e and ssid "Extrea-Special-Wifi"
wlan0: interface state COUNTRY_UPDATE->ENABLED
wlan0: AP-ENABLED

该教程(和多个其他来源)说,如果我使用内置的 Wi-Fi 模块,我不需要为它指定驱动程序(它昨天也没有指定驱动程序)但是有些东西不起作用这一次,我唯一改变的是从 Jessie 到 Jessie Lite 的操作系统。

我的笔记本电脑和其他设备可以看到并连接到网络,但没有互联网。当然,我可以 ping 网关 IP,但不能 ping DNS 8.8.8.8。

我的 HostAPD 配置文件与教程的相同,如下所示:

interface=wlan0
#driver=rtl871xdrv
ssid=Extrea-Special-Wifi
country_code=GB
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=Password123
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_group_rekey=86400
ieee80211n=1
wme_enabled=1

注意:Password123 不是我使用的密码,它会被更改!

我的 /etc/network/interface 文件与教程不太一样,但昨天像这样工作:

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet static
  address 192.168.42.1
  netmask 255.255.255.0

我意识到这个文件说:

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

但它在 Jessie 的完整版本(最新版本)上运行良好,如果这是问题的原因,我真的不确定如何使本教程与 /etc/dhcpd.conf 文件一起使用。

我的 /etc/sysctl.conf 设置如下:

#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#

#kernel.domainname = example.com

# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3

##############################################################3
# Functions previously found in netbase
#

# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1

# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1

# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
#  Enabling this option disables Stateless Address Autoconfiguration
#  based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1


###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#
net.ipv4.ip_forward=1

该文件的底部似乎缺少教程截图中可见的 2 行,但是我昨天没有添加它们,因为教程甚至没有提到它们(正如我所说,昨天我设法让 Pi 工作完美地作为 Tor Routed 接入点,使用完全相同的步骤)。

教程截图:

教程截图

4

0 回答 0