Wireless disconnect issues Ubuntu 16.04 with RTL8821ae

** UPDATE 12/03/2016: I still have not solved this issue. Is anyone able to help? ***

I've been having trouble with my Wifi ever since I installed Ubuntu 16.04 two months ago. There are several posts similar to this one on the forums, however I've not found any that work for me. Here are some similar questions which did not help me:

How do I get a Realtek RTL8723BE wireless card to work?
wifi connection keeps dropping in Ubuntu 15.10 - RTL8821AE
http://ubuntuforums.org/showthread.php?t=2245164&page=2
http://ubuntuforums.org/showthread.php?t=2245164

Let's get into it.

The problem:

I can load about 1-2 webpages before my wifi disconnects. When my wireless disconnects, the Network Manager icon does not change its appearance, i.e. showing that I'm still connected. It will not reconnect on its own. I then remove/reinsert my driver using:

sudo modprobe rtl8821ae -r
sudo modprobe rtl8821ae

I never have internet that lasts long enough to load an entire YouTube video or upload a 3.5 MB file to Dropbox. Yikes.

Details:

sudo lshw -C network

*-network               
   description: Wireless interface
   product: RTL8821AE 802.11ac PCIe Wireless Network Adapter
   vendor: Realtek Semiconductor Co., Ltd.
   physical id: 0
   bus info: pci@0000:01:00.0
   logical name: wlp1s0
   version: 00
   serial: b0:c0:90:1b:b8:bd
   width: 64 bits
   clock: 33MHz
   capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
   configuration: broadcast=yes driver=rtl8821ae driverversion=4.4.0-28-generic firmware=N/A ip=192.168.0.7 latency=0 link=yes multicast=yes wireless=IEEE 802.11abgn
   resources: irq:233 ioport:e000(size=256) memory:ff600000-ff603fff

 *-network
   description: Ethernet interface
   product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
   vendor: Realtek Semiconductor Co., Ltd.
   physical id: 0
   bus info: pci@0000:02:00.0
   logical name: enp2s0
   version: 10
   serial: 2c:56:dc:9d:2c:64
   size: 10Mbit/s
   capacity: 1Gbit/s
   width: 64 bits
   clock: 33MHz
   capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
   configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half firmware=rtl8168g-3_0.0.1 04/23/13 latency=0 link=no multicast=yes port=MII speed=10Mbit/s
   resources: irq:225 ioport:d000(size=256) memory:ff504000-ff504fff memory:ff500000-ff503fff


lsmod | grep rtl

rtl8821ae             225280  0
btcoexist              53248  1 rtl8821ae
rtl_pci                28672  1 rtl8821ae
rtlwifi                77824  2 rtl_pci,rtl8821ae
mac80211              737280  3 rtl_pci,rtlwifi,rtl8821ae
cfg80211              565248  2 mac80211,rtlwifi
btrtl                  16384  1 btusb
bluetooth             520192  9 bnep,btbcm,btrtl,btusb,btintel

I am happy to provide anything that is useful for diagnosing my problem. Thanks guys!


Solution 1:

Well I recommend to upgrade your kernal version to Kernal 4.6.4 and then download the latest wifi driver from git rtlwifi_new. Now go inside the downloaded directory and compile as follows.

sudo make

sudo make install

sudo reboot

Now try loading the driver modules

sudo modprobe -r rtl8821ae
sudo modprobe rtl8821ae

Scan the wifi and check the quality level using the following command.

iwlist scan | egrep -i 'ssid|level'

If still your problem persist then need to check how many antennas your laptop have and try changing antenna (ant_sel)and check the quality level of the signal.

sudo modprobe -r rtl8821ae
sudo modprobe rtl8821ae ant_sel=1
iwlist scan | egrep -i 'ssid|level'

if not try second antenna as follows.

sudo modprobe -r rtl8821ae
sudo modprobe rtl8821ae ant_sel=2
iwlist scan | egrep -i 'ssid|level'

if any of the above antenna switching works, then make it permanent by adding options correct ant_sel= to a conf file by creating it as follows.

vim /etc/modprobe.d/rtl8821ae.conf
options rtl8821ae ant_sel=1

If everything goes fine, then reboot and enjoy.