自动重新连接 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:~#

答案1

继续搜索这个词的内容漫游似乎相关。

因此,我按如下方式更改了我的配置,它似乎有效。

这是新的(部分)/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 ainterfaces

相关内容