Thursday, December 29, 2011

NetworkManager CLI

In the past few years, there's been a proliferation of wireless access points, and the NetworkManager applet does not deal with this well.  I have seen cases where there are so many access points found during a scan that the one I want doesn't make the list.  I suppose it's understandable if it's one I've never connected to, and if the signal isn't one of the strongest available.  If I've made clear that it's one of my preferred connections, though, it should always be found.  Rather than stew over this brokenness, I was determined to find a way around it.  NetworkManager CLI to the rescue!

I'm not deeply familiar with the NetworkManager CLI, but only a couple of commands are needed.
"nmcli con" shows a list of connections with names and UUIDs.  Sample output:

NAME                      UUID                                   TYPE              TIMESTAMP-REAL                    
Auto GloblaSuiteWireless  1aa7870c-0408-4c14-a42a-2e706cabed84   802-11-wireless   Tue 28 Jun 2011 12:43:20 PM EDT    
Auto FLYSBA               37308cf9-b520-4754-b382-8aec39fea79e   802-11-wireless   Fri 27 May 2011 11:19:16 PM EDT
euca                      42696e07-1b3a-49c8-9fd3-4483d9211285   vpn               Thu 29 Dec 2011 11:34:19 AM EST   

If you travel much, you probably have a huge list of these, so grep is your friend. Once you've found the connection you wish to activate, run this with the appropriate uuid string:

sudo nmcli con up uuid 37308cf9-b520-4754-b382-8aec39fea79e

I've set up script aliases for my favorite connections, so I don't have to search through the list each time. Note that VPN connections can be activated in this way as well.

As always, I hope this little nugget of information saves someone a bit of time someday.  It's certainly made my life easier.

1 comment:

  1. You are no less than a vigilante for me. It is people like you online who help make other people's lives easier and simpler. Thank you for doing what you do. Keep itup.

    ReplyDelete