nmcli command part-2 Network Manager Linux

nmcli Network Manager Linux using command Line, to manage Linux machine interfaces and there configurations such as connecting, disconnecting, assigning IP address, configuring routing, creating network profiles and managing them. There are are N number of options to do using nmcli command.

nmcli Network Manager Linux

[root@TechTutorials ~]# nmcli -f profile con s "My wired connection"

shows static configuration details of the connection profile with “My wired connection” name.

[root@TechTutorials ~]# nmcli -p con up "My wired connection" ifname eth0

activates the connection profile with name “My wired connection” on interface eth0. The -p option makes

[root@TechTutorials ~]# nmcli show

Progress of the activation.

[root@TechTutorials ~]# nmcli con up 6b028a27-6dc9-4411-9886-e9ad1dd43761 ap 00:3B:98:7D:42:D3

Connects the Wi‐Fi connection with UUID 6b028a27-6dc9-4411-9886-e9ad1dd43761 to the AP with BSSID 00:3B:98:7D:42:D3.

[root@TechTutorials ~]# nmcli device status

shows the status for all devices.

[root@TechTutorials ~]# nmcli dev disconnect ens667

Disconnects a connection on interface ens667 and marks the device as unavailable for auto‐connecting. As a result, no connection will automatically be activated on the device until the device’s ‘autoconnect’ is set to TRUE or the user should manually activate a connection.

[root@TechTutorials ~]# nmcli -f GENERAL,WIFI-PROPERTIES dev show wlan0

Shows details for wlan0 interface; only GENERAL and WIFI-PROPERTIES sections will be shown.

[root@TechTutorials ~]# nmcli dev wifi list

Lists available Wi‐Fi access points known to NetworkManager.

[root@TechTutorials ~]# nmcli dev wifi con "Cafe1" password caffeine name "My cafe"

creates a new connection named “My cafe” and then connects it to “Cafe1” SSID using password “caffeine”. This is mainly useful when connecting to “Cafe1” for the first time. Next time, it is better to use ‘nmcli con up id “My cafe”‘ so that the existing connection profile can be used and no additional is created.

[root@TechTutorials ~]# nmcli connection add type ethernet autoconnect no ifname eth0

non-interactively adds an Ethernet connection tied to eth0 interface with automatic IP configuration (DHCP), and disables the connection’s “autoconnect” flag.

[root@Techtutorials ~]# nmcli c a ifname india type vlan dev ens33 id 25

non-interactively adds a VLAN connection with ID 25. The connection will use ens33 and the VLAN interface will be named india.

[root@TechTutorials ~]# nmcli connection edit ethernet-em1-2

Edits existing “ethernet‐em1‐2” connection in the interactive editor

[root@TechTutorials ~]# nmcli connection edit type ethernet con-name "yet another Ethernet connection"

Adds a new Ethernet connection in the interactive editor

[root@TechTutorials ~]# nmcli con mod ethernet-2 connection.autoconnect no

Modifies ‘autoconnect’ property in the ‘connection’ setting of ‘ethernet‐2’ connection.

[root@TechTutorials ~]# nmcli con mod "WIFI" wifi.mtu 1350

Modifies ‘mtu’ property in the ‘wifi’ setting of ‘Home Wi‐Fi’ connection.

[root@TechTutorials ~]# nmcli con mod em1-1 ipv4.method manual ipv4.addr "192.168.1.23/24 192.168.1.1, 10.10.1.5/8, 10.0.0.11"

Sets manual addressing and the addresses in em1-1 profile.

[root@TechTutorials ~]# nmcli con modify eth0 +ipv4.dns 8.8.8.8

Appends a Google public DNS server to DNS servers in eth0 profile.

[root@TechTutorials ~]# nmcli con modify eth0 -ipv4.addresses "192.168.100.25/24 192.168.1.1"

Removes the specified IP address from (static) profile eth0.

Thanks for the read, Please share and help us. Your feedback is more important to us.

Related Articles

Part -1

rsync command Linux Practical examples

How to Add printer in Linux

What is LVM..? How to Create LVM in Linux

RHCSA Certification Video tutorial

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

Leave a Reply

Your email address will not be published. Required fields are marked *