LinuxCommandLibrary

nmcli-connection

TLDR

List all NetworkManager connections

$ nmcli connection
copy
Activate a connection
$ nmcli connection up uuid
copy
Deactivate a connection
$ nmcli connection down uuid
copy
Create an auto-configured connection
$ nmcli connection add ifname eth0 type ethernet ipv4.method auto ipv6.method auto
copy
Create a static IPv4 connection
$ nmcli connection add ifname eth0 type ethernet ip4 10.0.0.7/8 gw4 10.0.0.1 ipv4.dns 10.0.0.1
copy
Create a static IPv6 connection
$ nmcli connection add ifname eth0 type ethernet ip6 2001:db8::2/64 gw6 2001:db8::1
copy
Import a VPN connection from file
$ nmcli connection import type openvpn file vpn_config.ovpn
copy

SYNOPSIS

nmcli connection {show|up|down|add|modify|delete|reload|load|import|export} [ARGUMENTS]

DESCRIPTION

nmcli connection manages NetworkManager connection profiles. It can list, activate, deactivate, create, modify, and delete network connection configurations including Ethernet, Wi-Fi, VPN, and other connection types.

COMMANDS

show [id]

List connections or show details of a specific connection
up id|uuid
Activate a connection
down id|uuid
Deactivate a connection
add
Create a new connection profile
modify id|uuid
Change connection properties
delete id|uuid
Remove a connection profile
reload
Reload all connection files from disk
load filename
Load a connection file
import type TYPE file FILE
Import an external connection (e.g., VPN)
export id
Export a connection profile

COMMON ADD OPTIONS

ifname: Interface name to bind the connection
type: Connection type (ethernet, wifi, vpn, bridge, etc.)
con-name: Custom connection name
ip4: IPv4 address with prefix
gw4: IPv4 gateway address
ip6: IPv6 address with prefix
gw6: IPv6 gateway address
ipv4.method: auto, manual, or disabled
ipv6.method: auto, manual, or ignore
ipv4.dns: DNS server addresses

CAVEATS

Connection names with spaces require quoting. Use UUIDs when multiple connections share the same name. Changes made with modify take effect on the next activation unless --temporary is used.

HISTORY

Part of the nmcli command-line interface for NetworkManager. Provides scriptable network configuration management.

SEE ALSO

nmcli(1), nmcli(1), nmtui(1)

Copied to clipboard