My wireless internet is very unreliable, so I usually have to connect to the internet using a cable, but this is very inconvenient.
I tried doing the solution for what seems like a similar problem here, but it still does not fix the issue:
16.04 LTS wifi connection issues with Realtek RTL8723BE adapter ... That is, I created
/etc/pm/config.d/config and added
$ lspci -knn | grep Net -A2 03:00.0 Network controller : Realtek Semiconductor Co., Ltd. RTL8821AE 802.11ac PCIe Wireless Network Adapter [10ec:8821] Subsystem: XAVi Technologies Corp. RTL8821AE 802.11ac PCIe Wireless Network Adapter [1b9a:2482] Kernel driver in use: rtl8821ae Kernel modules: rtl8821ae