{"id":310101,"date":"2021-07-28T14:00:45","date_gmt":"2021-07-28T11:00:45","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it\/"},"modified":"2021-07-28T14:00:45","modified_gmt":"2021-07-28T11:00:45","slug":"how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it\/","title":{"rendered":"#How to Manage Linux Network Connections from the Command Line \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_88 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6acf0861c1c65\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6acf0861c1c65\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it\/#First_Steps_with_nmcli\" >First Steps with nmcli<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it\/#Understanding_the_Plumbing\" >Understanding the Plumbing<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it\/#Adding_Network_Connections\" >Adding Network Connections<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it\/#Adjusting_Connections\" >Adjusting Connections<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it\/#Device_Management\" >Device Management<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it\/#Showing_Device_Details\" >Showing Device Details<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it\/#The_nmcli_Interactive_Editor\" >The nmcli Interactive Editor<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-manage-linux-network-connections-from-the-command-line-cloudsavvy-it\/#Theres_Much_More_in_man\" >There\u2019s Much More in man<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#How to Manage Linux Network Connections from the Command Line \u2013 CloudSavvy IT&#8221;<\/strong><br \/>\nThe <code>nmcli<\/code> command lets you tap into the power of the Linux NetworkManager straight from the command line, making it perfect for servers with no desktop environment and remote SSH shell administration.<\/p>\n<p>The <code>nmcli<\/code> command isn\u2019t new, it was released in 2010. Together with the ip command, it replaces the venerable\u2014but deprecated\u2014 <code>ifconfig<\/code>. Old habits die hard, and many sysadmins still use <code>ifconfig<\/code>. They already know how to use it, there\u2019s no learning curve, and they just need to get the job done. So why learn yet another tool?<\/p>\n<p>Well, eventually, <code>ifconfig<\/code> will be dropped by the distributions so it\u2019s a change that is coming, like it or not. But <code>nmcli<\/code> has some neat tricks all of its own that make it worthwhile finding out what it can offer.<\/p>\n<p>Like all CLI commands, <code>nmcli<\/code> accepts command line parameters. The parameters are grouped into three categories.<\/p>\n<div id=\"\">But note that you don\u2019t always need all three sets of parameters for every command. The <code>nmcli <\/code> sections are:<\/p>\n<ul>\n<li><strong>Help<\/strong>: Provides short help texts on the <code>ncmcli<\/code> commands<\/li>\n<li><strong><a href=\"https:\/\/buradabiliyorum.com\/en\/category\/general\/\" data-internallinksmanager029f6b8e52c=\"3\" title=\"General\" target=\"_blank\" rel=\"noopener\">General<\/a><\/strong>: Retrieves the status and configuration of NetworkManager<\/li>\n<li><strong>Networking<\/strong>: Queries, enables, or disables network connections<\/li>\n<li><strong>Radio<\/strong>: Queries, enables, or disables Wi-Fi network connections<\/li>\n<li><strong>Monitor<\/strong>: Monitors NetworkManager and status changes of network connections<\/li>\n<li><strong>Connection<\/strong>: Directly manipulates network interfaces, including enabling and disabling them, adding new connections, and removing existing connections<\/li>\n<li><strong>Device<\/strong>: Modifies network device parameters and connects or disconnects a device from an existing connection<\/li>\n<li><strong>Secret<\/strong>: Registers <code>nmcli<\/code> as a\u00a0<a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/developer.gnome.org\/NetworkManager\/stable\/gdbus-org.freedesktop.NetworkManager.AgentManager.html\">NetworkManager secret agent<\/a>. Because <code>nmcli<\/code> does this automatically, this is very rarely used.<\/li>\n<\/ul>\n<h2 id=\"first-steps-with-nmcli\"><span class=\"ez-toc-section\" id=\"First_Steps_with_nmcli\"><\/span>First Steps with nmcli<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Let\u2019s make sure NetworkManager is installed, running, and we can connect to it with <code>nmcli<\/code>. We\u2019ll use the <code>status<\/code> action from the <code>general<\/code> section.<\/p>\n<pre>nmcli general status<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12993\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/4a47a0db-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"110\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Actually, status is the default action for general, so we could have left that word off the command. But we\u2019ve verified that <code>nmcli<\/code> \u2014and therefore NetworkManager\u2014is installed and operational. Let\u2019s find out a bit more about this computer.<\/p>\n<p>We can list all of the in-memory and on-disk network connection profiles using the show action from the connection section:<\/p>\n<pre>nmcli connection show<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12994\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/fb5c81ed-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"150\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>The output is wider than the terminal window. Our results were:<\/p>\n<pre>NAME               UUID                                 TYPE     DEVICE &#13;\nWired connection 1 d2864443-9cee-31ec-ab2e-55e9ebddd53e ethernet enp0s3 &#13;\nethernet-enp0s8    9aad8efa-3427-4a5c-bef5-270340cd33d0 ethernet enp0s8 &#13;\nethernet-enp0s9    5bc49cef-bc3d-4832-9073-460b408932b6 ethernet enp0s9<\/pre>\n<p>The test machine used for this article is running a pre-launch version of Ubuntu 21.10. It has three network adaptors installed in it, named <code>enp0s3<\/code>, <code>enp0s8<\/code>, and <code>enp0s9<\/code>.<\/p>\n<h2 id=\"understanding-the-plumbing\"><span class=\"ez-toc-section\" id=\"Understanding_the_Plumbing\"><\/span>Understanding the Plumbing<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A network connection allows your computer to communicate over a network to another device. Internally, <code>nmcli<\/code> holds all the information regarding a network connection in a data object it calls a connection.<\/p>\n<p>An <code>nmcli<\/code> connection encapsulates all of the information related to that connection, including\u00a0<a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Data_link_layer\">data link layer<\/a>\u00a0and\u00a0<a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/IP_address\">IP addressing information<\/a>\u00a0information. You can think of <code>nmcli<\/code>\u2018s connections as the configuration details for real-world network connections.<\/p>\n<p>To reach the outside world a connection must use a networking interface device, such as a network card. A connection is bound to a device. When a device is active and able to receive or transmit data, the connection is said to be <code>active<\/code>\u00a0or <code>up<\/code>. The corresponding inactive state is called, unsurprisingly, <code>inactive<\/code>\u00a0or <code>down<\/code>.<\/p>\n<h3 id=\"adding-network-connections\"><span class=\"ez-toc-section\" id=\"Adding_Network_Connections\"><\/span>Adding Network Connections<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>With <code>nmcli<\/code> you can create a network connection and set some of its configuration options with a single command. On this test computer, there is no connection on\u00a0<code>enp0s8<\/code> , the name for our wired connection (ethernet) number 2. We\u2019ll add a connection to <code>enp0s8<\/code>. Because we\u2019re making system changes, you\u2019ll need to use <code>sudo<\/code>:<\/p>\n<pre>sudo nmcli connection add type ethernet ifname enp0s8<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12997\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/10fb15c7-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"645\" height=\"130\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>This command uses the <code>add<\/code> action from the <code>connection<\/code> section. We used the <code>type<\/code> option to request an ethernet connection, and the <code>ifname<\/code> (interface name) option to specify the network interface device we want this connection to use.<\/p>\n<p>Let\u2019s check what\u2019s h<a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>ened:<\/p>\n<pre>nmcli connection show<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-12998\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/09dd8c26-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"170\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<pre>NAME               UUID                                 TYPE     DEVICE &#13;\nWired connection 1 d2864443-9cee-31ec-ab2e-55e9ebddd53e ethernet enp0s3 &#13;\nethernet-enp0s8    9aad8efa-3427-4a5c-bef5-270340cd33d0 ethernet enp0s8 &#13;\nethernet-enp0s9    5bc49cef-bc3d-4832-9073-460b408932b6 ethernet enp0s9 &#13;\nethernet-enp0s8-1  b874aa09-3a25-4f52-b20b-1b95d9741be9 ethernet --<\/pre>\n<p>Our new connection, <code>ethernet-enp0s8-1<\/code> , has been created. Its universally unique identifier (UUID) has been assigned, and the connection type is ethernet. We can now make it active with the <code>up<\/code> command. The <code>up<\/code> command must be followed by the connection name or its UUID:<\/p>\n<pre>nmcli connection up ethernet-enp0s8-1<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13000\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/8266e4bf-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"110\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Let\u2019s check our active connections once more:<\/p>\n<pre>nmcli connection show --active<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13001\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/f19c9085-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"150\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<pre>NAME               UUID                                 TYPE     DEVICE &#13;\nWired connection 1 d2864443-9cee-31ec-ab2e-55e9ebddd53e ethernet enp0s3 &#13;\nethernet-enp0s8-1  b874aa09-3a25-4f52-b20b-1b95d9741be9 ethernet enp0s8 &#13;\nethernet-enp0s9    5bc49cef-bc3d-4832-9073-460b408932b6 ethernet enp0s9<\/pre>\n<p>Our new connection, <code>ethernet-enp0s8-1<\/code>, is now active and bound to the <code>enp0s8<\/code> network interface device.<\/p>\n<h3 id=\"adjusting-connections\"><span class=\"ez-toc-section\" id=\"Adjusting_Connections\"><\/span>Adjusting Connections<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Of course, <code>ncmli<\/code> lets you change the parameters of existing connections too. Suppose we want to switch a network interface from Dynamic Host Configuration Protocol (DHCP) to using a static IP address. To match our network, we need a fixed IP address of 192.168.1.40 for our new connection.<\/p>\n<p>To achieve that, you need to issue two commands. One to set the IP address, and one to set the connection\u2019s method of obtaining an IP address to manual:<\/p>\n<pre>nmcli connection modify ethernet-enp0s8-1 ipv4.address 192.168.1.40\/24<\/pre>\n<pre>nmcli connection modify ethernet-enp0s8-1 ipv4.method manual<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13003\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/9eb9cd58-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"130\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>The \u201c\/24\u201d we\u2019re providing with the IP address is the subnet mask in\u00a0<a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/en.wikipedia.org\/wiki\/Classless_Inter-Domain_Routing\">Classless Inter-Domain Routing<\/a>\u00a0(CIDR). In this context \u201c\/24\u201d means \u201c255.255.255.0.\u201d<\/p>\n<p>The changes won\u2019t take effect until the connection is \u201cbounced.\u201d That is, disabled and brought back online. The first command takes the connection down and the second brings it back up.<\/p>\n<pre>nmcli connection down ethernet-enp0s8-1<\/pre>\n<pre>nmcli connection up ethernet-enp0s8-1<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13004\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/602e8f04-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"170\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>If you want to reverse the change and move from a static IP address to a DHCP IP Address, use the <code>auto<\/code> option instead of <code>manual<\/code>.<\/p>\n<pre>nmcli connection modify ethernet-enp0s8-1 ipv4.method auto<\/pre>\n<h2 id=\"device-management\"><span class=\"ez-toc-section\" id=\"Device_Management\"><\/span>Device Management<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <code>nmcli<\/code> <code>device<\/code> section contains actions (commands) that let you manage the network interfaces installed on your computer. To see the status of all the network interfaces on your computer use:<\/p>\n<pre>nmcli device status<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13006\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/7afbb160-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"170\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<h3 id=\"showing-device-details\"><span class=\"ez-toc-section\" id=\"Showing_Device_Details\"><\/span>Showing Device Details<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To examine the details of a network interface, we use the <code>show<\/code> action from the <code>device<\/code> section. If you do not provide a device name, the details of all devices are retrieved and displayed. You can scroll and page up and down to review them.<\/p>\n<p>Let\u2019s take a look at <code>enp0s8<\/code>, the device our new connection is using. We can verify that the IP address in use is the address that we previously requested.<\/p>\n<pre>nmcli device show enp0s8<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13007\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/586e508f-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"335\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<pre>GENERAL.DEVICE:           enp0s8&#13;\nGENERAL.TYPE:             ethernet&#13;\nGENERAL.HWADDR:           08:00:27:79:A7:68&#13;\nGENERAL.MTU:              1500&#13;\nGENERAL.STATE:            100 (connected)&#13;\nGENERAL.CONNECTION:       ethernet-enp0s8-1&#13;\nGENERAL.CON-PATH:         \/org\/freedesktop\/NetworkManager\/ActiveConnection\/8&#13;\nWIRED-PROPERTIES.CARRIER: on&#13;\nIP4.ADDRESS[1]:           192.168.1.40\/24&#13;\nIP4.GATEWAY:              --&#13;\nIP4.ROUTE[1]:             dst = 192.168.1.0\/24, nh = 0.0.0.0, mt = 102&#13;\nIP6.ADDRESS[1]:           fe80::3241:457d:cd1c:2436\/64&#13;\nIP6.GATEWAY:              --&#13;\nIP6.ROUTE[1]:             dst = fe80::\/64, nh = ::, mt = 102<\/pre>\n<p>A screenful of information is returned by <code>nmcli<\/code> . Some of the commonly useful items are:<\/p>\n<ul>\n<li><strong>DEVICE<\/strong>: The name of the device we\u2019re examining.<\/li>\n<li><strong>TYPE<\/strong>: The type of connection using this device.<\/li>\n<li><strong>HWADDR<\/strong>: The MAC address of the interface card.<\/li>\n<li><strong>STATE<\/strong>: Whether this device has a live connection on it.<\/li>\n<li><strong>IP4.ADDRESS[1]<\/strong>: The IP address and subnet mask for this device.<\/li>\n<li><strong>CONNECTION<\/strong>: The name of the connection using this device.<\/li>\n<\/ul>\n<h3 id=\"the-nmcli-interactive-editor\"><span class=\"ez-toc-section\" id=\"The_nmcli_Interactive_Editor\"><\/span>The nmcli Interactive Editor<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Although <code>nmcli<\/code> is a command-line tool it does have an elementary interactive editor. The edit action in the connection section opens the interactive editor on the connection you pass on the command line:<\/p>\n<pre>nmcli connection edit ethernet-enp0s8-1<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13009\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/59b2900a-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"645\" height=\"295\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Some help text is printed to the screen, and you\u2019re presented with the \u201cnmcli&gt;\u201d command prompt.<\/p>\n<p>if you type <code>print<\/code> and hit \u201cEnter\u201d, <code>nmcli<\/code>\u00a0lists all the properties associated with the connection. There are lots of them. You can scroll through them to review them.<\/p>\n<pre>print<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13010\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/9eb60bc8-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"383\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Let\u2019s change our connection back to using DHCP. We\u2019ll use the \u201cipv4\u201d settings. To do that, we need to \u201cgo\u201d to the IPv4 settings.<\/p>\n<pre>goto ipv4<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13011\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/c00b5755.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"383\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>The property we want to change is <code>method<\/code>. We want to set it to automatic.<\/p>\n<pre>set method auto<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13012\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/7b6fbd4c-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"383\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You\u2019ll see the following prompt:<\/p>\n<pre>Do you also want to clear 'ipv4.addresses'? [yes]:<\/pre>\n<p>If you don\u2019t clear the IP address, the next time you set this connection to use a static IP address it\u2019ll use the one that was previously set. If you do clear it, you\u2019ll need to set a new IP address if you ever change this connection back to using a static IP address. Type \u201cyes\u201d or just hit \u201cEnter\u201d to clear it. Type \u201cno\u201d and hit \u201cEnter\u201d to keep it.<\/p>\n<p>We need to save our changes:<\/p>\n<pre>save<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-13013\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/d642f8c3-1.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"644\" height=\"383\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Type \u201cquit\u201d to exit the interactive editor. If you don\u2019t want to quit, type \u201cback\u201d to go back to the main level, and carry on using the editor.<\/p>\n<h2 id=\"theres-a-much-more-to-nmcli\"><span class=\"ez-toc-section\" id=\"Theres_Much_More_in_man\"><\/span>There\u2019s Much More in man<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <code>nmcli<\/code> command can do much more. It has a great many command-line parameters and options. So many in fact, that its\u00a0<a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/developer.gnome.org\/NetworkManager\/stable\/nmcli.html\">man page<\/a>\u00a0runs to over 1200 lines. Review them to see what else <code>nmcli<\/code> can do for you.<\/p>\n<p>And of course, if you\u2019re remotely administering network connections, don\u2019t disable the connection you\u2019ve connected in on. That\u2019s never fun.\n<\/p><\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong>\n<\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/12989\/how-to-manage-linux-network-connections-from-the-command-line\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Manage Linux Network Connections from the Command Line \u2013 CloudSavvy IT&#8221; The nmcli command lets you tap into the power of the Linux NetworkManager straight from the command line, making it perfect for servers with no desktop environment and remote SSH shell administration. The nmcli command isn\u2019t new, it was released in 2010&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":310102,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/07\/1c250177.jpg","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-310101","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/310101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=310101"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/310101\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/310102"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=310101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=310101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=310101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}