{"id":6246,"date":"2021-05-03T20:25:56","date_gmt":"2021-05-03T20:25:56","guid":{"rendered":"https:\/\/linuxways.net\/?p=6246"},"modified":"2021-05-03T20:25:56","modified_gmt":"2021-05-03T20:25:56","slug":"how-to-configure-network-in-linux-using-netplan-and-nmtui","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/how-to-configure-network-in-linux-using-netplan-and-nmtui\/","title":{"rendered":"How to Configure Network in Linux Using Netplan and NMTUI"},"content":{"rendered":"<p>Network settings play the most important and the founding role in any server configuration.\u00a0 In this article we are going to show you the use of two most important and commonly used utilities in Linux systems that is NMTUI and NETPLAN. Using both these utilities you can configure the network settings by assigning the right IP, subnet mask and the Gateway. NMTUI (Network Manager Text User Interface) is an alternative to NMCLI (Network Manager Command Line Interface). Whereas Netplan is a Linux command-line utility that uses YAML descriptive files to configure network interfaces.<\/p>\n<h2>Prerequisites:<\/h2>\n<p>The prerequisites for this article is to have a Linux system running a Debian or RHEL Operating System with sudo rights.<\/p>\n<h2>Step 1: System Login<\/h2>\n<p>Let\u2019s start by login to your system. You want to configure its network interface using NMTUI or Netplan on a Debian system which is Ubuntu in our case.<\/p>\n<p>Open its shell terminal or connect to its console from your host server as shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"641\" class=\"wp-image-6247\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image.png 800w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-300x240.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-768x615.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-150x120.png 150w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<h2>Step 2: Checking Network Interface<\/h2>\n<p>To check the network interface we are going to make use the \u2018ifconfig\u2019 or \u2018ip\u2019 command as below.<\/p>\n<pre># ip a<\/pre>\n<pre># ifconfig<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"803\" height=\"293\" class=\"wp-image-6248\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-1.png 803w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-1-300x109.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-1-768x280.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/p>\n<p>Here you can see the detail of its interface so in the next step we are going to assign an IP to this interface.<\/p>\n<h2>Step 3: Assigning IP Using Netplan<\/h2>\n<p>Netplan utility come by default in Ubuntu 20 LTS, so we just need to configure it using its configuration file.<\/p>\n<p>Open its network interface .yaml configuration file using any of your favorite editor to add its required parameters in YAML Format.<\/p>\n<pre># vim \/etc\/netplan0\/00-installer-config.yaml<\/pre>\n<pre># This is the network config written by 'subiquity'\r\n\r\nnetwork:\r\n\r\nversion: 2\r\n\r\nethernets:\r\n\r\nens160:\r\n\r\naddresses: [xx.xx.xx.xx\/24]\r\n\r\ngateway4: xx.xx.xx.x\r\n\r\nnameservers:\r\n\r\naddresses: [8.8.8.8, 8.8.4.4]<\/pre>\n<p>Save and close the file using \u2018:wq!\u2019 and then run the \u2018netplan apply\u2019 command to make the configuration effective.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"803\" height=\"300\" class=\"wp-image-6249\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-2.png 803w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-2-300x112.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-2-768x287.png 768w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><\/p>\n<p>Here you can see that its network interface is up with our assigned IP address.<\/p>\n<p>To know more about using the netplan you can make use of its help parameters.<\/p>\n<pre># netplan \u2013help<\/pre>\n<p>usage: \/usr\/sbin\/netplan [-h] [&#8211;debug] &#8230;<\/p>\n<p>Network configuration in YAML<\/p>\n<p>optional arguments:<\/p>\n<p>-h, &#8211;help show this help message and exit<\/p>\n<p>&#8211;debug Enable debug messages<\/p>\n<p>Available commands:<\/p>\n<p>help Show this help message<\/p>\n<p>apply Apply current netplan config to running system<\/p>\n<p>generate Generate backend specific configuration files from \/etc\/netplan\/*.yaml<\/p>\n<p>info Show current netplan version and available features<\/p>\n<p>ip Retrieve IP information from the system<\/p>\n<p>try Try to apply a new netplan config to running system, with automatic rollback<\/p>\n<h2>Step 4: Assigning IP using NMTUI<\/h2>\n<p>NMTUI is an alternative tool to configure network interfaces on a Linux systems, it stands for Network Manager Text User Interface. It available on default repository of RHEL\/CentOS 7 and later version but if you are using Ubuntu 20 LTS like in our case then you have to install it first.<\/p>\n<p>To install NMTUI on Ubuntu run the command below on your terminal.<\/p>\n<pre># apt install network-manager<\/pre>\n<p>After installation, run the below command to run this on your system and its interface will pop up.<\/p>\n<pre># nmtui<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"669\" height=\"471\" class=\"wp-image-6250\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-3.png 669w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-3-300x211.png 300w\" sizes=\"auto, (max-width: 669px) 100vw, 669px\" \/><\/p>\n<p>Here as shown, you can edit or activate any other connection interface as well as set the system hostname.<\/p>\n<p>Let go for Edit connection to configure your IPv4 configurations as per your network addresses.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"873\" height=\"633\" class=\"wp-image-6251\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-4.png 873w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-4-300x218.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-4-768x557.png 768w\" sizes=\"auto, (max-width: 873px) 100vw, 873px\" \/><\/p>\n<p>Make sure to check automatically connect option and then select \u2018OK\u2019 to save the changes. To apply the made changes run the command below to restart your network services.<\/p>\n<pre># systemctl restart network<\/pre>\n<p>And that\u2019s it, check your IP status and it should be assigned to your connected interface.<\/p>\n<h1>Conclusion:<\/h1>\n<p>In this article you have learned about setting up your network interface using Netplan and NMTUI. Setting up the network interfaces is one of the most basic step that every system administrator and server engineers have to do to make it accessible over the network. I hope you have found this article much helpful in configuring your system network.<\/p>","protected":false},"excerpt":{"rendered":"<p>Network settings play the most important and the founding role in any server configuration.\u00a0 In this article we are going to show you the use of two most&hellip;<\/p>","protected":false},"author":1,"featured_media":6289,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,165],"tags":[35,311,312],"class_list":["post-6246","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian","category-red-hat","tag-linux","tag-netplan","tag-nmtui"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/6246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=6246"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/6246\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/6289"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=6246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=6246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=6246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}