我正在遵循本指南:将 Raspberry Pi 设置为独立网络 (NAT)中的接入点以创建接入点。唯一的区别是我正在使用以太网连接所在的另一个 wifi 连接,所以我只是在整个教程中进行了更改,因为eth0
我的 USB 加密狗连接到我的路由器。wlan1
wlan1
但是,没有关于该/etc/network/interfaces
文件的任何内容。这是我的:
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
auto wlan1
allow-hotplug wlan1
iface wlan1 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
我可以看到 SSID 并连接到它,但它会一直获取 IP 地址。我认为这与/etc/network/interfaces
. 看看我的ifconfig
:
pi@raspberrypi:~ $ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 4 bytes 156 (156.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 156 (156.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.25.6 netmask 255.255.255.0 broadcast 192.168.25.255
inet6 fe80::ba27:ebff:feaa:1f8 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:aa:01:f8 txqueuelen 1000 (Ethernet)
RX packets 42 bytes 5757 (5.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 37 bytes 5838 (5.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.25.6 netmask 255.255.255.0 broadcast 192.168.25.255
inet6 2804:7f0:e181:b678:2e0:4dff:fe06:4f8 prefixlen 64 scopeid 0x0<global>
inet6 fe80::2e0:4dff:fe06:4f8 prefixlen 64 scopeid 0x20<link>
ether 00:e0:4d:06:04:f8 txqueuelen 1000 (Ethernet)
RX packets 86 bytes 11978 (11.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 86 bytes 15855 (15.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
怎么wlan0
会有IP 192.168.25.6
?这是wlan1
连接的路由器提供的 IP。
我应该如何编辑wlan0
配置?我一直在尝试很多静态配置,但是当我做任何不同于屏幕上的操作时,板载 wifi 接口消失,然后 USB 加密狗取代了wlan0
.
另外,有没有办法保证usb dongle总是能得到wlan1
和板载wifi wlan0
?似乎随意。
更新
● dhcpcd.service - dhcpcd on all interfaces
Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/dhcpcd.service.d
└─wait.conf
Active: failed (Result: exit-code) since Sun 2018-08-05 04:54:32 UTC; 7s ago
Process: 853 ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -w (code=exited, status=6)
Aug 05 04:54:32 raspberrypi systemd[1]: Starting dhcpcd on all interfaces...
Aug 05 04:54:32 raspberrypi dhcpcd[853]: Not running dhcpcd because /etc/network/interfaces
Aug 05 04:54:32 raspberrypi dhcpcd[853]: defines some interfaces that will use a
Aug 05 04:54:32 raspberrypi dhcpcd[853]: DHCP client or static address
Aug 05 04:54:32 raspberrypi systemd[1]: dhcpcd.service: Control process exited, code=exited status=6
Aug 05 04:54:32 raspberrypi systemd[1]: Failed to start dhcpcd on all interfaces.
Aug 05 04:54:32 raspberrypi systemd[1]: dhcpcd.service: Unit entered failed state.
Aug 05 04:54:32 raspberrypi systemd[1]: dhcpcd.service: Failed with result 'exit-code'.
如果
wlan0
要成为接入点 (AP),则不应尝试将其用作客户端(站、STA)。但这就是说:“请
wlan0
在客户端模式下使用,并使用 DHCP 为其获取 IP 地址”。相反,你想要类似的东西10.0.0.*
用您希望为 AP 设置的 IP 范围替换和网络掩码。