{"id":1631,"date":"2013-05-10T08:28:37","date_gmt":"2013-05-10T08:28:37","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=1631"},"modified":"2013-05-10T08:28:37","modified_gmt":"2013-05-10T08:28:37","slug":"centos-6-no-network-as-default","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=1631","title":{"rendered":"Centos 6 No Network as Default !"},"content":{"rendered":"<p>This is for those of you who are new to CentOS.<\/p>\n<p>By default CentOS 6 will not configure network interfaces on a new installation which means the host will have no network connectivity, we can correct this inconvenience with little effort. Of course this means the user(you) is left with the decision to configure the network interface(s) with either a static or dynamically assigned IP addresses.<\/p>\n<p>First of all we need to see the contents of the\u00a0<strong>ifcfg-eth0<\/strong>\u00a0file.<\/p>\n<pre>cat \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<\/pre>\n<pre>DEVICE=\u201deth0\u201d\r\nHWADDR=\u201dMAC Address\u201d\r\nNM_CONTROLLED=\u201dyes\u201d\r\nONBOOT=\u201dno\u201d<\/pre>\n<p>The output above indicates\u00a0<em>eth0<\/em>\u00a0is disabled, this is when you either opt to set a static IP or dynamically assigned IP.<\/p>\n<p>With the text editor of your choice open the\u00a0<strong>\/etc\/sysconfig\/network-scripts\/ifcfg-eth0<\/strong>\u00a0and edit as indicated below.<\/p>\n<pre>vi \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<\/pre>\n<h3>DHCP Configuration<\/h3>\n<p>&nbsp;<\/p>\n<pre>DEVICE=\"eth0\"\r\nHWADDR=MAC Address*System MAC*\r\nNM_CONTROLLED=\"no\"\r\nONBOOT=\"yes\"\r\nBOOTPROTO=\"dhcp\"<\/pre>\n<ul>\n<li><em>DEVICE=\u201deth0\u2033<\/em>\u00a0\u2013 Name of Network Interface.<\/li>\n<li><strong>HWADDR=MAC Address*System MAC*<\/strong>\u00a0\u2013 MAC address of Network Interface.<\/li>\n<li><em>NM_CONTROLLED=\u201dno\u201d<\/em>\u00a0\u2013 Network Manager should disable since it\u2019s unnecessary in this configuration.<\/li>\n<li><em>ONBOOT=\u201dyes\u201d \u2013\u00a0<\/em>\u2013 Means the NIC will be started during boot.<\/li>\n<li><strong>BOOTPROTO=\u201ddhcp\u201d<\/strong>\u00a0\u2013 Instructions the OS to find a DHCP server from which to obtain an IP address. The DHCP server will assign all necessary network information including IP address, Netmask, Gateway and DNS server.<\/li>\n<\/ul>\n<p>Restart the network service.<\/p>\n<pre>\/etc\/init.d\/network restart<\/pre>\n<p>or<\/p>\n<pre>service network restart<\/pre>\n<p>&nbsp;<\/p>\n<h3>Static Configuration<\/h3>\n<pre>DEVICE=\"eth0\"\r\nHWADDR=MAC Address*System MAC*\r\nNM_CONTROLLED=\"no\"\r\nONBOOT=\"yes\"\r\nBOOTPROTO=\"static\"\r\nIPADDR=192.168.x.x.\r\nNETMASK=255.255.255.0.<\/pre>\n<ul>\n<li><strong>DEVICE=\u201deth0\u2033<\/strong>\u00a0\u2013 Name of Network Interface.<\/li>\n<li><strong>HWADDR=MAC Address*System MAC*<\/strong>\u00a0\u2013 MAC address of Network Interface.<\/li>\n<li><strong>NM_CONTROLLED=\u201dno\u201d<\/strong>\u00a0\u2013 Network Manager shoudl be disable since it\u2019s unnecessary in this configuration.<\/li>\n<li><strong>ONBOOT=\u201dyes\u201d<\/strong>\u00a0\u2013 Means the NIC will be started during boot.<\/li>\n<li><strong>BOOTPROTO=\u201dstatic\u201d<\/strong>\u00a0\u2013 IP configuration will be static.<\/li>\n<li><strong>IPADDR=192.168.x.x<\/strong>\u00a0\u2013 System IP address.<\/li>\n<li><strong>NETMASK=255.255.255.0<\/strong>\u00a0\u2013 Network Mask.<\/li>\n<\/ul>\n<h3>Gateway Configuration<\/h3>\n<p><em>*DHCP Users should ignore this step.<\/em><\/p>\n<p>In order to add a Gateway to our system we need to edit\u00a0<strong>\/etc\/sysconfig\/network<\/strong>.<\/p>\n<p>In order to add the network gateway edit\u00a0<strong>\/etc\/sysconfig\/network<\/strong>\u00a0and add\u00a0<strong>GATEWAY=192.168.x.x<\/strong>.<\/p>\n<pre>NETWORKING=yes\r\nHOSTNAME=localhost.localdomain\r\nGATEWAY=192.168.111.1<\/pre>\n<h3>DNS Configuration<\/h3>\n<p><em>*DHCP Users should ignore this step.<\/em><\/p>\n<p>Now we add the DNS server(s) for our host. Edit\u00a0<strong>\/etc\/resolv.conf<\/strong>\u00a0and add\u00a0<strong>nameserver 192.168.x.x<\/strong>.<\/p>\n<pre>nameserver 192.168.111.1<\/pre>\n<p>Restart the network service. This will make sure the changes take effect.<\/p>\n<pre>\/etc\/init.d\/network restart<\/pre>\n<p>or<\/p>\n<pre>service network restart<\/pre>\n<p>it is a good idea to have console access to the server in case you lock your self out it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is for those of you who are new to CentOS. By default CentOS 6 will not configure network interfaces on a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1631","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1631"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1631\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}