{"id":368,"date":"2014-05-23T19:28:10","date_gmt":"2014-05-23T19:28:10","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=368"},"modified":"2019-09-20T15:00:51","modified_gmt":"2019-09-20T15:00:51","slug":"how-to-set-a-static-ip-address-on-centos-fedora-or-red-hat-linux","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/how-to-set-a-static-ip-address-on-centos-fedora-or-red-hat-linux\/","title":{"rendered":"How to set a static ip address on CentOS, Fedora, or Red Hat Linux"},"content":{"rendered":"<p>Open up the following file with your favorite text editor. Change eth0 to the interface you need, like &#8220;wlan0&#8221; or &#8220;eth1&#8221;.<\/p>\n<pre> vi \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<\/pre>\n<p>The file should look something like the following.<\/p>\n<pre>DEVICE=eth0\nHWADDR=0A:2G:F3:56:66:4B\nTYPE=Ethernet\nUUID=aeh9421c-6a62-712c-886d-347813g8d1dh\nONBOOT=no\nNM_CONTROLLED=yes\nBOOTPROTO=dhcp\n<\/pre>\n<p>To set the static IP address change &#8220;BOOTPROTO=dhcp&#8221; to &#8220;BOOTPROTO=static&#8221; and add the following to the end of the file. If you want\/need the interface to come up when the computer boots up then be sure to change &#8220;ONBOOT=no&#8221; to &#8220;ONBOOT=yes&#8221;.<\/p>\n<pre>BROADCAST=192.168.1.255\nDNS1=8.8.8.8\nGATEWAY=192.168.1.1\nIPADDR=192.168.1.110\nNETMASK=255.255.255.0\n<\/pre>\n<p>Also, on some newer versions of CentOS you may need to add NM_DISABLED=no<\/p>\n<p>So your file should now look like this.<\/p>\n<pre>DEVICE=eth0\nHWADDR=0A:2G:F3:56:66:4B\nTYPE=Ethernet\nUUID=aeh9421c-6a62-712c-886d-347813g8d1dh\nONBOOT=yes\nNM_CONTROLLED=no\nBOOTPROTO=static\nBROADCAST=192.168.1.255\nDNS1=8.8.8.8\nGATEWAY=192.168.1.1\nIPADDR=192.168.1.110\nNETMASK=255.255.255.0\n<\/pre>\n<p>Save the file and restart networking.<\/p>\n<pre>service network restart<\/pre>\n<p>Finally, check you IP address with ifconfig.<\/p>\n<pre>root@localhost ~]# ifconfig eth0\neth0      Link encap:Ethernet  HWaddr 0A:2G:F3:56:66:4B  \n          inet addr:192.168.1.110  Bcast:192.168.1.255  Mask:255.255.255.0\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Open up the following file with your favorite text editor. Change eth0 to the interface you need, like &#8220;wlan0&#8221; or &#8220;eth1&#8221;. vi \/etc\/sysconfig\/network-scripts\/ifcfg-eth0 The file should look something like the following. DEVICE=eth0 HWADDR=0A:2G:F3:56:66:4B TYPE=Ethernet UUID=aeh9421c-6a62-712c-886d-347813g8d1dh ONBOOT=no NM_CONTROLLED=yes BOOTPROTO=dhcp To set &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/how-to-set-a-static-ip-address-on-centos-fedora-or-red-hat-linux\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,4,24,3,21,22],"tags":[17,19,126,128,127,50],"class_list":["post-368","post","type-post","status-publish","format-standard","hentry","category-centos-linux","category-command-line","category-fedora-2","category-linux","category-networking","category-redhat-linux","tag-centos","tag-fedora","tag-ip-address","tag-networking-2","tag-red-hat","tag-static-ip"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=368"}],"version-history":[{"count":9,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/368\/revisions"}],"predecessor-version":[{"id":2632,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/368\/revisions\/2632"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}