{"id":961,"date":"2024-02-04T09:23:34","date_gmt":"2024-02-04T09:23:34","guid":{"rendered":"http:\/\/shijuvarghese.com\/?p=961"},"modified":"2024-02-05T05:07:03","modified_gmt":"2024-02-05T05:07:03","slug":"redhat-configuring-network-interfaces-nmcli","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=961","title":{"rendered":"Redhat &#8211; Configuring network interfaces &#8211; nmcli"},"content":{"rendered":"<p>NetworkManager Command Line Interface &#8211; The <strong>nmcli<\/strong> is a command-line utility which is used for controlling NetworkManager and reporting network status.<\/p>\n<p>View status of physical network device attached to a system<\/p>\n<ul>\n<li><strong>[root@centos9vm ~]#<\/strong> <em>nmcli device status<\/em><\/li>\n<\/ul>\n<p style=\"padding-left: 30px;\">DEVICE TYPE STATE CONNECTION<br \/>\nens160 ethernet connected ens160<br \/>\nlo loopback connected (externally) lo<\/p>\n<p>Verify connection status<\/p>\n<ul>\n<li><strong>[root@centos9vm ~]#<\/strong> <em>nmcli conn show<\/em>\n<ul>\n<li>This will show the existing connection, may be names as <strong>ens160<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>One network interface can be configured with multiple connections, but only one will be active. The active connection can be verified by using the following connection:<\/p>\n<ul>\n<li><strong>[root@centos9vm ~]#<\/strong> <em>nmcli conn show &#8211;active<\/em>\n<ul>\n<li>The\u00a0<strong>ens160<\/strong> connection will be shown as active<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>How to <em>another<\/em> new IP address to an interface<\/p>\n<ul>\n<li><strong>[root@centos9vm ~]#<\/strong> <em>nmcli connection add con-name myconnection type ethernet ifname ens160 ipv4.address 192.168.0.132\/24 ipv4.gateway 192.168.154.1<\/em><\/li>\n<li><strong>[root@centos9vm ~]#<\/strong> <em>nmcli conn show<\/em>\n<ul>\n<li>The active connection <strong>ens160\u00a0<\/strong>will be highlighted<\/li>\n<\/ul>\n<\/li>\n<li><strong>[root@centos9vm ~]#<\/strong> <em>nmcli conn show &#8211;active<\/em>\n<ul>\n<li>Out of the existing connections only one will be displayed,\u00a0<strong>ens160<\/strong><\/li>\n<\/ul>\n<\/li>\n<li><strong>[root@centos9vm ~]#<\/strong> <em>nmcli conn up myconnection<\/em>\n<ul>\n<li>This will\u00a0make\u00a0<em><strong>myconnection<\/strong> as active<\/em><\/li>\n<\/ul>\n<\/li>\n<li><strong>[root@centos9vm ~]#<\/strong>\u00a0<em>nmcli conn show &#8211;active<\/em>\n<ul>\n<li>Out of the existing connections only one will be displayed, <em><strong>myconnection<\/strong><\/em><\/li>\n<\/ul>\n<\/li>\n<li><strong>[root@centos9vm ~]#<\/strong>\u00a0<em>nmcli conn up\u00a0ens160<\/em>\n<ul>\n<li>This will\u00a0make\u00a0<em><strong>ens160\u00a0<\/strong>active<\/em><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Below command modifies an existing\u00a0connection:<\/p>\n<ul>\n<li><strong>[root@centos9vm ~]#<\/strong>\u00a0<em>nmcli conn mod myconnection ipv4.address 192.168.0.210\/24 ipv4.gateway 192.168.0.1<\/em><\/li>\n<li><strong>[root@centos9vm ~]#<\/strong>\u00a0<em>nmcli conn down myconnection<\/em><\/li>\n<li><strong>[root@centos9vm ~]#<\/strong>\u00a0<em>nmcli conn up myconnection<\/em><\/li>\n<\/ul>\n<p>Below command disconnects a\u00a0<strong>device<\/strong> and brings is back<\/p>\n<ul>\n<li><strong>[root@centos9vm ~]#<\/strong>\u00a0<em>nmcli device disconnect ens160<\/em><\/li>\n<li><strong>[root@centos9vm ~]#<\/strong>\u00a0<em>nmcli\u00a0device connect ens160<\/em><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>NetworkManager Command Line Interface &#8211; The nmcli is a command-line utility which is used for controlling NetworkManager and reporting network status. View status of physical <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=961\" title=\"Redhat &#8211; Configuring network interfaces &#8211; nmcli\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":256,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,30],"tags":[],"class_list":["post-961","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-rhel-9"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=961"}],"version-history":[{"count":6,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/961\/revisions"}],"predecessor-version":[{"id":967,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/961\/revisions\/967"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/256"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=961"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}