Ubuntu 服务器启动/重启时 WiFi 无法可靠连接

Ubuntu 服务器启动/重启时 WiFi 无法可靠连接

我正在使用 Ubuntu Server14.04.2 LTS和微型无线适配器TP-LINK TL-WN725N

我在启动时自动连接时遇到了问题。如果我重新启动 10 次,它可能只会连接 4-6 次。当它失败时,我总是可以通过以下方式连接:

sudo ifdown wlan0
sudo ifup wlan0

lsusb输出:

user@ubuntu:~$ lsusb
Bus 001 Device 004: ID 058f:6377 Alcor Micro Corp. Multimedia Card Reader
Bus 001 Device 003: ID 0bda:8179 Realtek Semiconductor Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 046d:c534 Logitech, Inc.
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

dmesg重新启动网络之前:

user@ubuntu:~$ dmesg
[   16.105721] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[   16.801211] R8188EU: INFO indicate disassoc
[   17.145207] init: failsafe main process (651) killed by TERM signal
[   17.524498] init: network-manager main process (767) terminated with status 127
[   17.524520] init: network-manager main process ended, respawning
[   19.066032] init: plymouth-upstart-bridge main process ended, respawning

interfaces文件:

user@ubuntu:~$ sudo vim /etc/network/interfaces
auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
wpa-ssid the-ssid
wpa-psk the-pw
dns-nameservers 8.8.8.8 192.168.1.1

ifup连接成功的输出:

user@ubuntu:~$ sudo ifup wlan0
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument

更新:其他希望有用的信息:

我跑了wpa_cli -i wlan0 status,它又回来了Failed to connect to non-global ctrl_ifname wlan0 error: Permission denied

我看了一下/var/log/upstart/network-interface-wlan0.log,它显示了Failed to connect to non-global ctrl_ifname: wlan0 error: Read-only file system

dmesgsudo apt-get purge network-manager

[   14.539832] R8188EU: Firmware Version 11, SubVersion 1, Signature 0x88e1
[   14.660066] floppy0: no floppy controllers found
[   14.660083] work still pending
[   14.916594] MAC Address = e8:de:27:a3:e7:f6
[   14.921775] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   14.921802] cfg80211: World regulatory domain updated:
[   14.921806] cfg80211:  DFS Master region: unset
[   14.921809] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   14.921814] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   14.921817] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   14.921821] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm), (N/A)
[   14.921824] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   14.921828] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm), (N/A)
[   16.233140] R8188EU: INFO indicate disassoc

更新 2:结果sudo ifdown wlan0 && sudo ifup -v wlan0

Configuring interface wlan0=wlan0 (inet)
run-parts --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/ethtool
run-parts: executing /etc/network/if-pre-up.d/wireless-tools
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
wpa_supplicant: wpa-driver nl80211,wext (default)
wpa_supplicant: /sbin/wpa_supplicant -s -B -P /var/run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -C /var/run/wpa_supplicant
Starting /sbin/wpa_supplicant...
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
wpa_supplicant: creating sendsigs omission pidfile: /run/sendsigs.omit.d/wpasupplicant.wpa_supplicant.wlan0.pid
wpa_supplicant: ctrl_interface socket located at /var/run/wpa_supplicant/wlan0
wpa_supplicant: configuring network block -- 0
wpa_supplicant: wpa-ssid "the-ssid" -- OK
wpa_supplicant: wpa-psk ***** -- OK
wpa_supplicant: enabling network block 0 -- OK
ip addr add 192.168.1.150/255.255.255.0 broadcast 192.168.1.255           dev wlan0 label wlan0
ip link set dev wlan0   up
 ip route add default via 192.168.1.1  dev wlan0
run-parts --verbose /etc/network/if-up.d
run-parts: executing /etc/network/if-up.d/000resolvconf
run-parts: executing /etc/network/if-up.d/ethtool
run-parts: executing /etc/network/if-up.d/ntpdate
run-parts: executing /etc/network/if-up.d/openssh-server
run-parts: executing /etc/network/if-up.d/upstart
run-parts: executing /etc/network/if-up.d/wpasupplicant

答案1

这是相同的 Realtek 驱动程序问题。您可以安装一个修复了问题的良好驱动程序。运行

sudo apt-get install git
git clone https://github.com/lwfinger/rtlwifi_new.git
cd rtlwifi_new
make
sudo make install

然后重新启动。

答案2

使用以下命令:

sudo gedit /var/lib/NetworkManager/NetworkManager.state

确保这些属性相同:

[main]
NetworkingEnabled=true
WirelessEnabled=true
WWANEnabled=true

保存文件并重新启动网络管理器,如下所示:

sudo service networkmanager restart
sudo service network restart

如果您希望使用特定适配器而不是启动整个网络管理器,请使用以下命令

sudo ifconfig

对于无线连接使用

sudo iwconfig

获取计算机上所有适配器的列表及其名称

sudo ifconfig wlan0 up

wlan0如果您有无线连接,您可以将其替换为您机器上的适配器名称。

sudo ifconfig eth0 up

eth0如果您有有线连接,您可以将其替换为您机器上的适配器名称。

相关内容