This seems a rather frequent problem in ubuntu 16.04 on which Loki is based (askubuntu question: 16.04 LTS wifi connection issues) and it happened very often on my system.
You can try other answers under that askubuntu question, but for me it got less frequent (I guess) after following this answer .
What it says is:
- Get details of your PCI wireless card by running
sudo lshw -class network
- Get your card model info according to the product line. For instance, as you can see in the question description it says
RTL8723BE PCIe Wireless Network Adapter so the model of my card is
- Open or create
/etc/pm/config.d/config and add
SUSPEND_MODULES="rtl8723be"(replace rtl8723be with your own model
number) Then run
echo "options rtl8723be fwlps=N" | sudo tee
/etc/modprobe.d/rtl8723be.conf and reboot.
It rarely happens now and when it does I use the command
service network-manager restart.
That can be associated with a shortcut key. I prefer a desktop launcher to run from Slingshot:
Exec=bash -c 'service network-manager restart'