How to Use Arch Linux Network Manager

How to Use Arch Linux Network Manager
Arch Linux comes with a utility for network management, it’s called NetworkManager. This tool is responsible for providing automatic detection, configuration, and connection to networks. The tool is capable of handling both wireless and wired connections. For wireless networks, the tool is capable of automatically switching to a more reliable connection. The priority of wired connection is obviously higher than wireless ones.

Let’s check out the usage of NetworkManager on Arch Linux.

Installation

NetworkManager is readily available on Arch Linux official repository. All you need is just tell pacman to install it right away.

Update the pacman package database.

sudo pacman -Syu

Now, install NetworkManager.

sudo pacman -S wpa_supplicant wireless_tools networkmanager

For mobile broadband support, don’t forget to install the additional packages.

sudo pacman -S modemmanager mobile-broadband-provider-info usb_modeswitch

If you need PPPoE/DSL support, install the following package.

sudo pacman -S rp-pppoe

In need of a UI? Install the following packages.

sudo pacman -S nm-connection-editor network-manager-applet

Configuring NetworkManager

At first, enable the NetworkManager service so that every time the system boots, it becomes the manager of networks.

sudo systemctl enable NetworkManager.service

In this case, you also have to disable the dhcpcd service. Otherwise, both NetworkManager and dhcpcd will try to configure the network and result in conflict and unstable network.

sudo systemctl disable dhcpcd.service

If you need the support for wireless connections, you also need the wpa_suplicant service enabled as well.

sudo systemctl enable wpa_supplicant.service

Finally, the system is ready to start the NetworkManager service. Start the service.

sudo systemctl start NetworkManager.service

Reboot the system to ensure that all the changes take into effect.

sudo reboot

Using NetworkManager

There are a couple of ways of using NetworkManager. The default method is through command-line using the CLI tool (nmcli). If you want an interactive UI, there are 2 options available – settings from the desktop environment or nmtui.

List nearby wireless networks

Ask nmcli to list all the available nearby wireless networks.

nmcli device wifi list

Connecting to a wireless network

You can directly connect to a wireless network.

nmcli device wifi connect <SSID> password <SSID_password>

If the network is a hidden one, use the following structure.

nmcli device wifi connect <SSID> password <SSID_password> hidden yes

List all the connected networks

Check out what networks your system is connected with. nmcli will report the UUID, type, and interface of the connection.

nmcli connection show

Device status

NetworkManager allows checking the status of all the network devices.

nmcli device

Disconnect a network

At first, determine the interface of the wireless network. Then, tell nmcli to disconnect from it.

nmcli device disconnect <interface>

Re-connect with a network

If there’s an interface that’s marked as disconnected, you don’t have to go through the lengthy process of re-entering the SSID and password. Instead, you can use the UUID to reconnect.

Determine the UUID of the network.

nmcli connection show

Now, use the UUID to reconnect with that network.

nmcli connection up uuid <UUID>

Disable Wi-Fi

NetworkManager can also be used to disable Wi-Fi access.

nmcli radio wifi off

To turn it back, use the following command.

nmcli radio wifi on

Note: This action will automatically attempt to connect your system with the most suitable Wi-Fi network from the list of known networks.

Editing a connection

THe connection options are stored in “/etc/NetworkManager/system-connections” directory in their respective “<connection_ID>.nmconnection” files.

sudo ls /etc/NetworkManager/system-connection

Edit the respective file for changing the settings.

sudo nano /etc/NetworkManager/system-connections/<connection_ID>.nmconnection

After editing, make sure that the new settings take into effect by reloading nmcli.

sudo nmcli connection reload

nmtui

When installing NetworkManager, a simplistic command-line UI is also installed. Using the UI, it’s easier to navigate through your desired actions.

Launch the interactive UI manager of NetworkManager.

nmtui

Editing a connection

From the main section, select “Edit a connection”.

Select which connection you want to edit.

Deleting a connection

Go to “Edit a connection” from nmtui and select “Delete”.

Adding a connection

Go to nmtui >> Edit a connection >> Add.

At first, select the connection type. In my case, I’ll be adding a wireless network.

Enter all the information.

Once you’re done, select “OK”.

There you have it!

Activating/deactivating a connection.

Start nmtui and select “Activate a connection”.

Select which connection you want to activate and choose “Actiavte”.

If you’re selecting an active connection, you’ll see the option to deactivate the connection.

Bonus: Setting hostname

Choose the option “Set system hostname”.

You can set a new hostname or modify the existing one.

For completing the action, you need to enter the “root” password.

Desktop environment

NetworkManager also integrates with the existing desktop environment (if you have one set up). Here, we’ll check out on managing network using GNOME and KDE Plasma.

Note: You still have to install the NetworkManager packages.

GNOME

From the top-right corner, click the network icon.

You can directly manage the available network from there. If you’re in need of more extensive option, go to Settings >> Network (Ethernet connections).

For wireless networks, go to Settings >> Wi-Fi.

KDE Plasma

For KDE Plasma, you have to install the plasma-nm package first. It will be used to integrate NetworkManager with the Plasma desktop.

sudo pacman -S plasma-nm

Using this plugin, you can get the GNOME-like taskbar option for managing your networks. Add the network manager to your taskbar through Panel options >> Add widgets >> Networks.

Search for “network”.

Drag and drop it at the corner of the taskbar.

Voila! Network management is directly available from your taskbar.

Final thoughts

Network management on Arch Linux is pretty interesting. It offers a lot of flexibility and control over the networks. With NetworkManager, you can directly take control of the data flow.

Enjoy!

Related Posts
Leave a Reply

Your email address will not be published.Required fields are marked *