nmcli-connection
Manage network connections
TLDR
List all NetworkManager connections (shows name, UUID, type and device)
Activate a connection
Deactivate a connection
Create an auto-configured dual stack connection
Create a static IPv6-only connection
Create a static IPv4-only connection
Create a VPN connection using OpenVPN from an OVPN file
SYNOPSIS
nmcli [GLOBAL_OPTIONS] connection {COMMAND | help}
Common COMMANDs include: show, up, down, add, modify, delete, clone.
PARAMETERS
show [NAME | ID | UUID | DEVICE]
Lists all NetworkManager connections or displays detailed information about a specific connection identified by its name, ID, UUID, or the device it's currently active on. Useful for inspecting active and configured profiles.
up ID | UUID | NAME | DEVICE [OPTIONS]
Activates a specified connection. This command brings the network interface associated with the connection online, applying its configured settings like IP address, DNS servers, etc. It can also manage a specific device or bring up the best matching connection for a device.
down ID | UUID | NAME | DEVICE
Deactivates a specified connection, taking the associated network interface offline. This stops network communication through that connection.
add type TYPE con-name NAME [ifname IFNAME] [OPTIONS]
Adds a new connection profile. TYPE specifies the connection type (e.g., ethernet, wifi, vpn, bridge). con-name sets the unique profile name. Further OPTIONS configure specific settings for the chosen connection type (e.g., ip4.addresses, wifi.ssid, vpn.data).
modify ID | UUID | NAME [OPTIONS]
Modifies properties of an existing connection profile. This is a very powerful and versatile command, allowing changes to virtually any connection setting, such as IP addresses, DNS servers, Wi-Fi passwords, auto-connect behavior, security protocols, and more. Use with caution as incorrect settings can disrupt network connectivity.
delete ID | UUID | NAME
Deletes a specified connection profile from NetworkManager's configuration. Once deleted, the profile can no longer be activated unless re-added.
clone ID | UUID | NAME con-name NEW_NAME
Creates a new connection profile by copying an existing one. The new profile is assigned a NEW_NAME and inherits all properties from the original connection, which can then be modified independently.
monitor [ID | UUID | NAME | DEVICE]
Monitors connection activity and state changes in real-time. Can monitor all connections or a specific connection/device.
reload
Reloads all connection profiles from their disk configuration files. This is useful if configuration files were manually edited outside of nmcli or nmtui.
DESCRIPTION
nmcli connection is a powerful subcommand of nmcli (NetworkManager command-line interface) used to manage NetworkManager connections.
It allows users to list, add, modify, delete, activate, and deactivate network connections. These connections define how your system connects to various networks (e.g., Wi-Fi, Ethernet, VPN, mobile broadband).
It provides a comprehensive way to configure network interfaces and their associated settings without needing a graphical user interface (GUI). This command interacts directly with the NetworkManager daemon, ensuring consistent network configuration across reboots and different network states. It's essential for server administration, scripting network setups, and troubleshooting connectivity issues on Linux systems.
CAVEATS
nmcli connection generally requires root privileges (or `sudo`) to manage network connections.
The add and modify commands are highly granular, supporting hundreds of possible properties (e.g., ipv4.method, wifi.ssid, vpn.data). Understanding the specific properties for each connection type often requires consulting the nm-settings(5) man page or using nmcli connection help <TYPE> for detailed syntax.
Changes made via nmcli are typically persistent across reboots, as they modify the saved connection profiles.
CONNECTION TYPES
NetworkManager supports a wide array of connection types, allowing configuration for various networking technologies. Common types include ethernet, wifi, vpn, bridge, bond, team, gsm (mobile broadband), cdma, bluetooth, and vlan. Each connection type has its own set of specific properties that can be configured via nmcli connection add or modify.
PROPERTY NAMING CONVENTION
NetworkManager properties generally follow a `section.property-name` convention (e.g., ipv4.addresses, wifi.ssid, connection.autoconnect). This structured naming helps in organizing and identifying the vast number of configurable options. Sections often correspond to specific aspects like IP configuration, Wi-Fi settings, or general connection behavior.
PROFILE STORAGE
By default, connection profiles created or modified with nmcli connection are saved as configuration files (typically in the 'INI' or 'keyfile' format) in the `/etc/NetworkManager/system-connections/` directory. Each file represents a single connection profile and persists across system reboots, ensuring network configurations remain active.
HISTORY
NetworkManager was developed by Red Hat and initially released in 2004 with the primary goal of simplifying network configuration, especially for desktop users, roaming, and wireless networks. The nmcli command-line utility, including the powerful connection subcommand, was introduced later as a robust scripting and administrative interface. It gained prominence by offering parity with graphical tools and enabling comprehensive network management on headless servers. Its capabilities have steadily evolved to cover almost all NetworkManager features, making it an indispensable tool for Linux network administration.
SEE ALSO
nmcli(1), nmtui(1), ip(8), ss(8), NetworkManager(8), nm-settings(5)