{"id":3549,"date":"2012-07-15T13:55:11","date_gmt":"2012-07-15T05:55:11","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=3549"},"modified":"2023-05-10T21:26:51","modified_gmt":"2023-05-10T21:26:51","slug":"how-to-configure-static-ip-address-on-centos-6-3-linux-server","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-configure-static-ip-address-on-centos-6-3-linux-server\/","title":{"rendered":"How to Configure Static IP Address on CentOS 6.3 Linux Server"},"content":{"rendered":"<p>A static IP address is a permanent and fixed IP address assigned to a device that doesn&#8217;t change even after restarting. A static IP address can be configured on a CentOS 6.3 Linux Server by editing the network interface configuration files.<\/p>\n<p>Configuring a static IP address on a CentOS 6.3 Linux Server can provide benefits such as consistency, stability, security, server management, and DNS simplification.<\/p>\n<p>In this tutorial, we will go through the steps required to configure a static IP address on a CentOS 6.3 Linux Server.<\/p>\n<h2>Step 1: Find the Network Interface<\/h2>\n<p>To configure a static IP address on CentOS 6.3, the first step is to find the network interface that we want to assign the static IP address to. To find the network interface, we can use the &#8220;ifconfig&#8221; command. Open the terminal and type the following command:<\/p>\n<pre>\r\nifconfig\r\n<\/pre>\n<p>This command will display a list of network interfaces, their IP addresses, and other information.<\/p>\n<h2>Step 2: Open Network Interface Configuration File<\/h2>\n<p>Once we have found the network interface that we want to assign the static IP address to, we need to open its configuration file. In CentOS 6.3, the network interface configuration files are located in the \/etc\/sysconfig\/network-scripts\/ directory. To open the configuration file, we can use any text editor of our choice. For example, to open the configuration file for the network interface &#8220;eth0&#8221;, we can use the following command:<\/p>\n<pre>\r\nnano \/etc\/sysconfig\/network-scripts\/ifcfg-eth0\r\n<\/pre>\n<h2>Step 3: Configure Static IP Address<\/h2>\n<p>In the configuration file, we need to make the following changes:<\/p>\n<ul>\n<li>Change the value of the &#8220;BOOTPROTO&#8221; parameter from &#8220;dhcp&#8221; to &#8220;static&#8221;.<\/li>\n<li>Add the &#8220;IPADDR&#8221; parameter and set its value to the desired static IP address.<\/li>\n<li>Add the &#8220;NETMASK&#8221; parameter and set its value to the netmask of the network.<\/li>\n<li>Add the &#8220;GATEWAY&#8221; parameter and set its value to the gateway address of the network.<\/li>\n<\/ul>\n<p>For example, the configuration file for the network interface &#8220;eth0&#8221; may look like this:<\/p>\n<pre>\r\n[root@centos63 ~]# nano \/etc\/sysconfig\/network-scripts\/ifcfg-eth0\r\n<\/pre>\n<pre>\r\nDEVICE=\"eth0\"\r\nBOOTPROTO=\"static\"\r\nHWADDR=\"xx:xx:xx:xx:xx:xx\"\r\nNM_CONTROLLED=\"yes\"\r\nONBOOT=\"yes\"\r\nTYPE=\"Ethernet\"\r\nUUID=\"xxxxxxxx-05a0-4adf-84fd-850aca6521c7\"\r\nIPADDR=192.168.1.54\r\nNETMASK=255.255.255.0\r\n<\/pre>\n<p>Configure Default gateway:<\/p>\n<pre>\r\n[root@centos63 ~]# vi \/etc\/sysconfig\/network\r\n<\/pre>\n<pre>\r\nNETWORKING=yes\r\nHOSTNAME=centos63.ehowstuff.local\r\nGATEWAY=192.168.1.1\r\n<\/pre>\n<h2>Step 4: Restart Network Service<\/h2>\n<p>After making the changes to the network interface configuration file, we need to restart the network service for the changes to take effect. To restart the network service, we can use the following command:<\/p>\n<pre>\r\nservice network restart\r\n<\/pre>\n<p>Like this:<\/p>\n<pre>\r\n[root@centos63 ~]# service network restart\r\nShutting down interface eth0:                              [  OK  ]\r\nShutting down loopback interface:                          [  OK  ]\r\nBringing up loopback interface:                            [  OK  ]\r\nBringing up interface eth0:                                [  OK  ]\r\n<\/pre>\n<h2>Step 5: Verify Static IP Address Configuration<\/h2>\n<p>To verify that the static IP address has been successfully configured, we can use the &#8220;ifconfig&#8221; command again. Open the terminal and type the following command:<\/p>\n<pre>\r\nifconfig\r\n<\/pre>\n<p>This command will display the network interfaces and their IP addresses. Look for the network interface that we configured with the static IP address and verify that the IP address, netmask, and gateway are correct.<\/p>\n<h2>Commands Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">ifconfig<\/span> &#8211; displays network interfaces, their IP addresses, and other information.<\/li>\n<li><span class=\"fw-bold\">nano<\/span> &#8211; a text editor that can be used to open the network interface configuration file.<\/li>\n<li><span class=\"fw-bold\">service network restart<\/span> &#8211; restarts the network service to apply the changes made to the network interface configuration file.<\/li>\n<\/ul>\n<h2>Conclusion:<\/h2>\n<p>Great, we have gone through the steps required to configure a static IP address on a CentOS 6.3 Linux Server.<\/p>\n<p>By following the steps outlined in this how-to, we can assign a permanent and fixed IP address to a network interface that doesn&#8217;t change even after restarting the server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A static IP address is a permanent and fixed IP address assigned to a device that doesn&#8217;t change even after restarting. A static IP address can be configured on a&#8230;<\/p>\n","protected":false},"author":6,"featured_media":1554,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055],"tags":[1244,1254,1536,1798],"class_list":["post-3549","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos","tag-centos-6-3","tag-linux","tag-static-ip"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/3549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=3549"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/3549\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/1554"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=3549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=3549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=3549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}