I was on the verge of giving up on going back to Linux because of wifi issues.

Things would be working fine, then after a while, I just couldn’t connect to wireless networks anymore. At one point I couldn’t connect to my home wireless but work wifi still worked fine. Then I couldn’t connect to work either.

I was frustrated.

I tried just about everything. I had issues with Arch Linux so I switched back to Ubuntu. Ubuntu was better out of the box with the wireless but eventually the same damned thing started to happen.

This actually ended up being two separate issues for me. Here’s what I did to resolve each scenario.

Unable to connect to dual-band wireless router

At home I have an Asus AC1900 router. It’s pretty amazeballs. Super fast, handles all of our devices with ease and the range is absolutely phenomenal.

But most of the time I couldn’t fucking connect to it… from Linux.

Everything was peachy with OS X so I knew it had to be a Linux problem. I had tried multiple distros with the same results, so I figured it was probably some underlying kernel problem and not necessarily a package problem.

Regardless, everything I tried from the ol’ interwebs fell flat or fixed the issue only temporarily.

Then on a whim, I was poking around the wifi settings on the router trying to find something that would magically fix the glitch. Unfortunately there was no checkbox for “work better with Linux”.

I had noticed that I was running both 2.4GHz and 5GHz bands with the same SSID instead of splitting them out. First time owning one of these routers, but I know at the office we have the bands split. So I gave each band it’s own SSID.

Problem. Fucking. Solved.

Well for the most part….. then I noticed I was…

Unable to connect to wifi after suspend

At this point, I was running Ubuntu 16.04 LTS as it was giving me the least amount of shit on my MacBook Pro. Suspend would work fine, system would resume just fine too. But no wifi afterwards. Couldn’t even bounce wireless from the applet in Gnome.

Did some digging and found that when you run into this problem, you need to completely bounce network-manager. You can do it manually with systemctl restart network-manager.service to test that it resolves the issue but after that, you can set up a systemd service to do it for ya automatically.

First you’ll want to create the file /etc/systemd/system/wifi-resume.service and put the following into it and save it:

[Unit]
Description=Restart networkmanager at resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

[Service]
Type=oneshot
ExecStart=/bin/systemctl restart network-manager.service

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target

Once that’s all set, you can enable it with sudo systemctl enable wifi-resume.service

Not much to it! After that you should be be smooth sailing with Linux and wifi!

Now if only I could figure out why my MBP doesn’t seem to recognize when I unhook an external monitor :-/