Wifi
自動重新連接到wifi
沒有 X11 的 Debian 10。
如果我關閉並再次打開我的 AP,那麼它表明 Debian 重新連接,但 Debian 沒有重新獲得網路訪問權限——例如,我無法 ping 任何東西(儘管我可以 ping AP 的 IP)。
為了讓網路重新開始工作,我必須:
# ifdown wlan0 # ifup wlan0
可以在沒有人工干預的情況下恢復嗎?
編輯:
ip a
# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp0s10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000 link/ether d4:9a:20:f3:d8:e4 brd ff:ff:ff:ff:ff:ff 3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 90:84:0d:f3:7a:2f brd ff:ff:ff:ff:ff:ff inet 192.168.43.7/24 brd 192.168.43.255 scope global dynamic wlan0 valid_lft 2606sec preferred_lft 2606sec inet6 fe80::9284:dff:fef3:7a2f/64 scope link valid_lft forever preferred_lft forever 4: wlx00e032800384: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000 link/ether 00:e0:32:80:03:84 brd ff:ff:ff:ff:ff:ff 7: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 00:e0:32:80:03:84 brd ff:ff:ff:ff:ff:ff inet 192.168.1.31/24 brd 192.168.1.255 scope global br0 valid_lft forever preferred_lft forever inet6 fe80::2e0:32ff:fe80:384/64 scope link valid_lft forever preferred_lft forever root@mini31:~#
/etc/network/interfaces
source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback iface enp0s10 inet manual iface wlx00e032800384 inet manual # Local network: ethernet and hostapd on a second wifi adapter. auto br0 iface br0 inet static bridge_ports enp0s10 wlx00e032800384 address 192.168.1.31 netmask 255.255.255.0 # This AP often disappears. # The problem is to get Debian to reconnect to it # and use it as the default route # whenever it reappears. auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid RWB wpa-psk password # Future: 4g to use when wlan0 has disappeared. #auto enp0s4f1u7 #allow-hotplug enp0s4f1u7 #iface enp0s4f1u7 inet dhcp
編輯2:
ip route
root@mini31:~# # connected and working root@mini31:~# ip route default via 192.168.43.61 dev wlan0 192.168.1.0/24 dev br0 proto kernel scope link src 192.168.1.31 192.168.43.0/24 dev wlan0 proto kernel scope link src 192.168.43.7 root@mini31:~# # now turn off the AP to which wlan0 is connected root@mini31:~# ip route default via 192.168.43.61 dev wlan0 linkdown 192.168.1.0/24 dev br0 proto kernel scope link src 192.168.1.31 192.168.43.0/24 dev wlan0 proto kernel scope link src 192.168.43.7 linkdown root@mini31:~# # now turn the AP back on. This computer soon appears in its list of connected devices. root@mini31:~# ip route default via 192.168.43.61 dev wlan0 192.168.1.0/24 dev br0 proto kernel scope link src 192.168.1.31 192.168.43.0/24 dev wlan0 proto kernel scope link src 192.168.43.7 root@mini31:~# ping www.google.com ^C root@mini31:~# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. From 192.168.43.7 icmp_seq=1 Destination Host Unreachable ^C --- 8.8.8.8 ping statistics --- 5 packets transmitted, 0 received, +1 errors, 100% packet loss, time 85ms pipe 4 root@mini31:~# ifdown wlan0 Killed old client process Internet Systems Consortium DHCP Client 4.4.1 Copyright 2004-2018 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/wlan0/90:84:0d:f3:7a:2f Sending on LPF/wlan0/90:84:0d:f3:7a:2f Sending on Socket/fallback DHCPRELEASE of 192.168.43.7 on wlan0 to 192.168.43.87 port 67 root@mini31:~# ifup wlan0 Internet Systems Consortium DHCP Client 4.4.1 Copyright 2004-2018 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/wlan0/90:84:0d:f3:7a:2f Sending on LPF/wlan0/90:84:0d:f3:7a:2f Sending on Socket/fallback DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 21 DHCPOFFER of 192.168.43.7 from 192.168.43.61 DHCPREQUEST for 192.168.43.7 on wlan0 to 255.255.255.255 port 67 DHCPACK of 192.168.43.7 from 192.168.43.61 bound to 192.168.43.7 -- renewal in 1510 seconds. root@mini31:~# ping www.google.com PING www.google.com (216.58.211.164) 56(84) bytes of data. 64 bytes from lhr48s13-in-f4.1e100.net (216.58.211.164): icmp_seq=2 ttl=113 time=43.6 ms ^C --- www.google.com ping statistics --- 3 packets transmitted, 1 received, 66.6667% packet loss, time 37ms rtt min/avg/max/mdev = 43.577/43.577/43.577/0.000 ms root@mini31:~#
在繼續搜尋這方面的東西後,漫遊一詞似乎很相關。
因此,我已按如下方式更改了我的配置,並且它似乎可以正常工作。
這是新的(部分)
/etc/network/interfaces/interfaces
auto wlan0 allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf # wpa-ssid RWB # wpa-psk password allow-hotplug RWB iface RWB inet dhcp
這是
/etc/wpa_supplicant/wpa_supplicant.conf
network={ ssid="RWB" psk="password" priority=1 id_str="RWB" proto=RSN key_mgmt=WPA-PSK pairwise=CCMP TKIP group=CCMP TKIP }
請注意,
id_str="RWB"
對應於新的假裝界面(它沒有出現在 中ip a
)interfaces
。