Network Manger
Network Manger CLI (nmcli)
The NetworkManger CLI allows you to manage your network interfaces and configuration via a single command line tool. This is the command line interface (CLI) version for the NetworkManager, a widely used Linux network control manager. I’ve included some very helpful commands to allow you to configure less common network features (like AP mode) via the CLI.
Note: You can also install and use the nmtui
tool to do much of this configuration without a GUI, which is the NetworkManger Text User Interface tool.
Edit NetworkManager Conenctions Directly via Configuration Files
- Files found under /etc/NetworkManager/system-connnections
| sudo vim /etc/NetworkManager/system-connections/<your connection file>
|
Create and Enable Linux Hotspot via nmcli Method 1
| nmcli connection add type wifi ifname wlan0 con-name local-ap autoconnect yes ssid test-ap mode ap
nmcli connection modify con-name 802-11-wireless.mode ap 802-11-wireless-security.key-mgmt wpa-psk ipv4.method shared 802-11-wireless-security.psk 'PASSWORD'
nmcli connection up con-name
|
Hotspot Method 2
- Note: tkip could be used instead of ccmp for reduced security.
- Note: WPA3 is also configurable on most modern distributions.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 | nmcli connection add \
con-name local-ap \
ifname wlan0 \
type wifi \
autoconnect yes \
ipv4.method shared \
802-11-wireless-security.proto rsn \
802-11-wireless-security.pairwise ccmp \
802-11-wireless-security.group ccmp \
802-11-wireless.band g \
802-11-wireless.mode ap \
802-11-wireless.ssid "test-ap" \
802-11-wireless-security.key-mgmt wpa-psk \
802-11-wireless-security.psk "PASSWORD" \
802-11-wireless.hidden no
|
Search for Access Points
Show/Share nmcli WiFi via QR Code
| nmcli dev wifi show-password
|
List Active Connections
Show Details of a Connection
Set an IP on an Interface
| nmcli con modify local-ap ipv4.addresses "192.168.21.10/24"
|
Stop and Start a Connection by Name
| nmcli conn down local-ap
nmcli conn up !$
|
Spoof a MAC Address
| sudo nmcli con modify local-ap 802-3-ethernet.cloned-mac-address 00:12:34:56:78:9b
|