Skip to main content
Share Your Experience: Take the 2024 Developer Survey
37 votes
Accepted

Assigning static IP address using nmcli

Try: # nmcli con add con-name "static-ens32" ifname ens32 type ethernet ip4 xxx.xxx.120.44/24 gw4 xxx.xxx.120.1 # nmcli con mod "static-ens32" ipv4.dns "xxx.xxx.120.1,8.8.8.8" # nmcli con up "static-...
garethTheRed's user avatar
  • 34.1k
22 votes

How to connect to an 802.1x wireless network via nmcli

You can create a WPA2 Enterprise connection using an nmcli command line like (substitute your own wifi device name for wlp3s0, and so forth): nmcli connection add \ type wifi con-name "MySSID" ...
Brandon Rhodes's user avatar
21 votes

Import VPN config files to NetworkManager from command line

I'm using nmcli version 1.2.6 and I can use it to import openvpn configs. nmcli connection import type openvpn file ~/myconfig.ovpn From now on even in NetworkManager UI my vpn is visible. To ...
bastian's user avatar
  • 323
17 votes

Use nmcli to display the status of a connection

As user B Layer suggested in their comment, you can specify a field name with nmcli. I think the most relevant field in your case is GENERAL.STATE: nmcli -f GENERAL.STATE con show {connection_name} ...
Matthias Braun's user avatar
14 votes
Accepted

Remove secondary IP with NetworkManager / nmcli

in »Red Hat« the syntax would be like this: nmcli con mod "Wired connection 1" -ipv4.addresses "10.163.148.194" You just add a Minus before your Property It might work like this in Ubuntu as well…?
Matthäsius's user avatar
14 votes
Accepted

NetworkManager: Set current connection of device as metered

I really hope that this isn't the best answer: it seems convoluted in the simple case, and even more so if allowing for a binary SSID. Anyways, here goes: Get device's current connection nmcli -t -f ...
Tom Hale's user avatar
  • 30.8k
13 votes

How do I use NMCLI to create a Wifi connection & connect to SSID over WPA?

nmcli device wifi con "ssid" password "p455w04d"
mrosiak's user avatar
  • 231
13 votes
Accepted

Use nmcli to modify VPN password?

Yes, you can modify the value of any property with nmcli. In this case, you would use: nmcli con modify "myvpn" vpn.secrets "password=myverysecretpassword"
gmarmstrong's user avatar
  • 1,233
12 votes
Accepted

How to use nmcli to always connect to vpn when using certain wifi?

Here's a detailed explanation from my initial comment. The goal is to learn what is the equivalent using the CLI tool nmcli without having to browse through all the documentation to pinpoint a setting ...
A.B's user avatar
  • 37k
11 votes
Accepted

How can I find out what plugin is missing in nmcli?

You are probably missing the NetworkManager-wifi package. # dnf install NetworkManager-wifi To apply changes, restart NetworkManager.service: # systemctl restart NetworkManager
fpmurphy's user avatar
  • 4,656
11 votes

nmcli: Select BSSID when two access points have the same SSID

It seems there are two issues. The bssid parameter of nmcli does not actually do what I expect. It's only used to select the SSID, and isn't passed to wpa_supplicant. See issue #465 NetworkManager ...
David Purton's user avatar
9 votes

network manager not listing wifi

I finally found the problem, wpa_supplicant was not running. Try this: sudo systemctl start wpa_supplicant.service Now check the wifi list again: nmcli dev wifi list Connect to the network like ...
Thiago Silvino's user avatar
9 votes

Remove secondary IP with NetworkManager / nmcli

I have had the same situation and I haven't found any other solution except removing the old ip using 'ip addr del' command, e.g.: ip addr del 10.163.148.36/24 dev ens160
Vladyslav Shapoval's user avatar
8 votes

How to update the gateway with nmcli

For older implementations (such as CentOS 7) you can use: nmcli con modify <name> ipv4.addresses "<ip addr and mask> <gateway>" to add a gateway to the connection. For example: # ...
garethTheRed's user avatar
  • 34.1k
8 votes
Accepted

Parse colon-separated value pairs (nmcli output) and convert to JSON fromat

The script that you linked to is extremely inefficient - you're doing a lot of useless pre-processing... Use nmcli in --terse mode since, per the manual, "this mode is designed and suitable for ...
don_crissti's user avatar
  • 83.2k
7 votes

What are the most reliable wifi commandline tools? iw vs wpa_cli vs nmcli

IW The command iw is generally used to configure the wifi devices , it can be used to connect to an open wifi network or to an access point protected by a WEP key. The limitation : It is not ...
GAD3R's user avatar
  • 67.1k
7 votes
Accepted

How to generate a hotspot that does not requires password?

It is not possible to create an open hotspot through wifi hotspot command , because nmcli will generate a password for you (WPA or wep) , the --show-secrets option will be used to print the password. ...
GAD3R's user avatar
  • 67.1k
7 votes
Accepted

nmcli command takes only first string of ssid?

If there are spaces in the command line, you should use quotes: nmcli device wifi connect "my homewifi" password mypass This will let the shell and nmcli know that this is to be considered as one ...
Stephen Rauch's user avatar
7 votes
Accepted

Get connected Wi-Fi network signal strength with nmcli

nmcli --version nmcli tool, version 1.6.2 To get the SIGNAL of the AP on which you are connected, use: nmcli dev wifi list | awk '/\*/{if (NR!=1) {print $7}}' The second * mark in nmcli dev wifi ...
GAD3R's user avatar
  • 67.1k
7 votes
Accepted

How to set connection to down by default with nmcli

You will need to set the connection's autoconnect property to no: nmcli connection modify <connection> connection.autoconnect no
Snake's user avatar
  • 1,660
6 votes

How to connect to an 802.1x wireless network via nmcli

NetworkManager can generate WPA2 Enterprise profiles with graphical front ends. nmcli and nmtui do not support this, but may use existing profiles. More about connection to WPA2_Enterprise networks
hrust's user avatar
  • 161
6 votes

How to create wireless bridge connection with nmcli

It is possible. If your goal is to create a WiFi Hotspot/Access Point and bridge it to your ethernet connection, you can do that using nmcli. If your computer is connected to a router via an ethernet ...
Eduardo de Souza Cruz's user avatar
6 votes

Connect to hidden wireless network on nmtui

I used the following workaround: Add your hidden wifi via nmtui ('Edit connections') and activate it by nmcli con up HIDDEN_WIFI_PROFILE_NAME. After this, it should be in the wifi list of nmtui.
codecivil's user avatar
6 votes

Get connected Wi-Fi network signal strength with nmcli

The trick here is to use the -f parameter of nmcli to specify what fields you want in your script. If you care about the SSID, use the SSID field; if you care about which one you're connected to, use ...
apnorton's user avatar
  • 161
6 votes
Accepted

Differance between ip4 and ipv4 addresses, nmcli?

From nmcli manual: Table 25. IPv4 options ┌──────┬────────────────┬────────────────────────┐ │Alias │ Property │ Note │ ├──────┼────────────────┼────────────────────────┤ │ip4 ...
alsjflalasjf.dev's user avatar
6 votes
Accepted

How to change network interface name

In NetworkManager terminology, a device is the NIC (or a virtual abstraction of one), and a connection is a set of network configuration parameters that can apply to any suitable device, unless ...
telcoM's user avatar
  • 98.1k
5 votes

how do I use nmcli to add an IP-address to an interface?

Your conn modify looks mostly right, but need to put a netmask on the address otherwise it'll get the default (probably /8, which may or may not be what you want). For instance, if you needed a class-...
MattPie's user avatar
  • 51
5 votes

How to disconnect from network via wpa_cli?

Just do wpa_cli disconnect to disconnect, and wpa_cli reconnect to connect again. Alternatively, you can also ifdown/ifup your wlan interface. BTW, the man page of wpa_cli for some reason only lists ...
dirkt's user avatar
  • 32.5k

Only top scored, non community-wiki answers of a minimum length are eligible