60.6 Connecting to a Network


The network-manager and network-manager-gnome packages provide graphical user interfaces for maintaining network connections. The system tray applet will list all available connections (wired and wireless) and attempts to maintain a connection whilst allowing a choice of connections. To have it play this role though, be sure there are no network device entries in the /etc/networks/interfaces file (if it exists), otherwise network-manager will not take over control automatically and may not list any devices as being available.

For a command line experience, first identify the network device interface name:

$ nmcli connection show --active
NAME   UUID                                  TYPE      DEVICE  
josef  6bc3e3c3-256c-1934-9cb7-044166c5ad63  wifi      wlp2s0  

To list the available WiFi hotspots (the WiFiSSID):

$ nmcli device wifi list
*       josef           Infra  1     130 Mbit/s  94     WPA2        
        JANITOR-NET     Infra  4     130 Mbit/s  92     WPA2        
        PipAir-f12f     Infra  4     54 Mbit/s   87     --          
        kturoam         Infra  11    195 Mbit/s  75     WPA2 802.1X 
        KTU-Secure      Infra  11    195 Mbit/s  75     WPA2 802.1X 
        DCS             Infra  11    195 Mbit/s  74     --          
        KTU-Secure      Infra  6     260 Mbit/s  62     WPA2 802.1X 
        DCS             Infra  6     260 Mbit/s  60     --          
        kturoam         Infra  157   540 Mbit/s  59     WPA2 802.1X 
        DCS             Infra  157   540 Mbit/s  59     --          
        KTU-Secure      Infra  52    405 Mbit/s  57     WPA2 802.1X 

To disconnect and then reconnect the WiFi device wlp2s0:

$ nmcli device disconnect wlp2s0
Device 'wlp2s0' successfully disconnected.

$ nmcli device connect wlp2s0
Device 'wlp2s0' successfully activated with '6bc3e3c3-256c-1934-9cb7-044166c5ad63'.

To disconnect from josef and re-connect:

$ nmcli connect down josef
Connection 'josef' successfully deactivated
(D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/268)

$ nmcli connect up josef
Connection successfully activated
(D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/271)

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0