September 27, 2020

How to manage network in Linux with nmcli command

1 min read

nmcli – command-line tool for controlling NetworkManager.

nmcli is a command-line tool for controlling NetworkManager and reporting network status. It can be utilized as a replacement for nm-applet or other graphical clients. nmcli is used to create, display, edit, delete, activate, and deactivate network connections, as well as control and display network device status.

Typical uses include:

· Scripts: Utilize NetworkManager via nmcli instead of managing network connections manually. nmcli supports a terse output format which is better suited for script processing. Note that NetworkManager can also execute scripts, called “dispatcher scripts”, in response to network events.

· Servers, headless machines, and terminals: nmcli can be used to control NetworkManager without a GUI, including creating, editing, starting and stopping network connections and viewing network status.

How to manage network in Linux with nmcli command

Use

Example

View network interface status

View specified network interface status information; if no interface is specified, all interface status information is displayed

View all currently available connections

Active the specified interface

Set an IP address

Configure the gateway

Configure DNS