Networking
創建一個接入點以在兩個無線連接之間“橋接”。/etc/network/interfaces 應該怎麼看?
我正在遵循本指南:將 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
會有IP192.168.25.6
?這是wlan1
連接的路由器提供的 IP。我應該如何編輯
wlan0
配置?我一直在嘗試很多靜態配置,但是當我做任何不同於螢幕上的操作時,板載 wifi 介面消失,然後 USB 加密狗取代了wlan0
.另外,有沒有辦法保證usb dongle總是能得到
wlan1
和板載wifiwlan0
?似乎隨意。更新
● 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)。但這就是auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp #wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
說:“請
wlan0
在客戶端模式下使用,並使用 DHCP 為其獲取 IP 地址”。相反,你想要類似的東西auto wlan0 iface wlan0 inet static address 10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255
10.0.0.*
用您希望為 AP 設置的 IP 範圍替換和網路遮罩。