{"id":342,"date":"2020-05-20T12:26:47","date_gmt":"2020-05-20T12:26:47","guid":{"rendered":"http:\/\/mastercom.es\/?p=342"},"modified":"2020-05-20T12:27:23","modified_gmt":"2020-05-20T12:27:23","slug":"como-configurar-direccion-ip-estatica-en-centos-8","status":"publish","type":"post","link":"https:\/\/mastercom.es\/en\/como-configurar-direccion-ip-estatica-en-centos-8\/","title":{"rendered":"How to configure static IP address in CentOS 8"},"content":{"rendered":"<p>There are two quick ways to configure an IP address on the network interface of CentOS 8 operating system. The one is using the command&nbsp;<strong>nmtui<\/strong>&nbsp;and another is by direct editing of network files.<\/p>\n\n\n\n<p>If you are not comfortable editing configuration files, choose option 1 to configure networks interactively.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method 1 \u2013 Using nmtui tool<\/h2>\n\n\n\n<p>Run the following command to access an interactive form of network interface configuration.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nmtui\n<\/pre>\n\n\n\n<p>Now, edit the default existing connection. In case there is no connection available, use Activate a connection.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/tecadmin.net\/wp-content\/uploads\/2019\/10\/centos8-nmtui-1.png\"><img decoding=\"async\" src=\"https:\/\/tecadmin.net\/wp-content\/uploads\/2019\/10\/centos8-nmtui-1.png\" alt=\"Setup networking centos 8\" class=\"wp-image-19445\"\/><\/a><\/figure><\/div>\n\n\n\n<p>You will see the list of Ethernet interfaces, select the interface you want to configure, then select Edit option on the right side of the interface.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/tecadmin.net\/wp-content\/uploads\/2019\/10\/centos8-nmtui-2.png\"><img decoding=\"async\" src=\"https:\/\/tecadmin.net\/wp-content\/uploads\/2019\/10\/centos8-nmtui-2.png\" alt=\"Configure static IP centOS 8\" class=\"wp-image-19446\"\/><\/a><\/figure><\/div>\n\n\n\n<p>Keep the profile name and device name unchanged. Set the IP address, gateway and DNS servers to the IPv4 configuration option. You can add multiple addresses using the selection option just below the IP address box.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/tecadmin.net\/wp-content\/uploads\/2019\/10\/centos8-nmtui-3.png\"><img decoding=\"async\" src=\"https:\/\/tecadmin.net\/wp-content\/uploads\/2019\/10\/centos8-nmtui-3.png\" alt=\"Use nmtui network configuration on centos 8\" class=\"wp-image-19447\"\/><\/a><\/figure><\/div>\n\n\n\n<p>Save the configuration and restart the NetworkManager service using the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart NetworkManager.service\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Method 2 \u2013 Using configuration files<\/h2>\n\n\n\n<p>The default network interfaces configuration file exists in the directory&nbsp;<strong>\/etc\/sysconfig\/network-scripts\/.<\/strong>&nbsp;The file name may vary depending on the type of installation, such as Physical Machine or Virtual Machine. The configuration file shoul be like ifcfg-XXXX (for example: ifcfg-eth0, ifcfg-eth1, ifcfg-enp0s3 etc.)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo vim \/etc\/sysconfig\/network-scripts\/ifcfg-enp0s3\n<\/pre>\n\n\n\n<p>Use the following configuration to configure a static IP address for the CentOS 8 network interface.<\/p>\n\n\n\n<p><strong>Static IP configuration:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">TYPE=Ethernet BOOTPROTO=static NAME=enp0s3 DEVICE=enp0s3 ONBOOT=yes IPADDR=192.168.1.237 PREFIX=24 GATEWAY=192.168.1.2 DNS1=8.8.8.8 DNS2=192.168.1.2 USRCTL=no\n<\/pre>\n\n\n\n<p>Alternatively, if you want to assign the IP address through the DHCP server, use the following settings.<\/p>\n\n\n\n<p><strong>DHCP Configuration<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">TYPE = Ethernet DEVICE = enp0s3 BOOTPROTO = dhcp ONBOOT = yes\n<\/pre>\n\n\n\n<p>Configuration parameter details:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>DEVICE:<\/strong>&nbsp;Ethernet device name<\/li><li><strong>BOOTPROTO:<\/strong>&nbsp;dhcp or static<\/li><li><strong>ONBOOT:<\/strong>&nbsp;yes\/no, indicates whether the interface will be turned on automatically or not at boot.<\/li><li><strong>Guy:<\/strong>&nbsp;Interface type.<\/li><li><strong>USRCTL:<\/strong>&nbsp;Yes\/no, indicates that a non-root user can upload or download this device.<\/li><\/ul>\n\n\n\n<p>Save the configuration and restart the NetworkManager service using the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart NetworkManager.service\n<\/pre>\n\n\n\n<p>That&#039;s it.<\/p>","protected":false},"excerpt":{"rendered":"<p>Hay dos formas r\u00e1pidas de configurar una direcci\u00f3n IP en la interfaz de red del sistema operativo CentOS 8. El uno est\u00e1 utilizando el comando&nbsp;nmtui&nbsp;y otro es por edici\u00f3n directa de archivos de red. Si no se siente c\u00f3modo para editar archivos de configuraci\u00f3n, elija la opci\u00f3n 1 para configurar las redes de forma interactiva. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-342","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/mastercom.es\/en\/wp-json\/wp\/v2\/posts\/342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mastercom.es\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mastercom.es\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mastercom.es\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mastercom.es\/en\/wp-json\/wp\/v2\/comments?post=342"}],"version-history":[{"count":0,"href":"https:\/\/mastercom.es\/en\/wp-json\/wp\/v2\/posts\/342\/revisions"}],"wp:attachment":[{"href":"https:\/\/mastercom.es\/en\/wp-json\/wp\/v2\/media?parent=342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mastercom.es\/en\/wp-json\/wp\/v2\/categories?post=342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mastercom.es\/en\/wp-json\/wp\/v2\/tags?post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}