I am using a TL-WN823N WiFi USB dongle in Ubuntu 16.04. After following this and this answer (should have sticked to just one, I know, but it didn't seem to work) I managed to get it working, but I needed to manually bring the interface up (sudo ifconfig enx98ded01947a7 up
) and restart the network manager (sudo service network-manager restart
).
Now, whenever I restart the machine, I need to manually perform the same steps. If I only bring the interface up, the network manager won't find any WiFi networks until restarted. When it is restarted, it automatically connects to my WiFi network.
I found several questions on this, and I've been looking at my /etc/network/interfaces
file. But after fiddling around with it nothing good has come out of it.
Its original contents were:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
I added the following line, and nothing changed:
allow-hotplug enx98ded01947a7
Now, to the interesting bit. If I add the following line as well:
iface enx98ded01947a7 inet dhcp
the interface is up after a reboot. No WiFi networks are found, though, regardless of how many times I restart the network manager. As soon as I remove this last line and restart the network manager, all works like a charm.
So I need to find a way of having my system automatically connect to my WiFi network when it boots up using an external WiFi USB dongle, without me having to manually bring the interface up and restarting the network manager. I am aware of the possibility of automating this two commands on boot, but that seems hacky and does not address the root of the problem.