{"id":2450,"date":"2017-08-07T15:43:43","date_gmt":"2017-08-07T14:43:43","guid":{"rendered":"http:\/\/www.xenonique.co.uk\/blog\/?p=2450"},"modified":"2017-08-07T15:43:43","modified_gmt":"2017-08-07T14:43:43","slug":"virtualbox-centos-second-network-dynamic-host","status":"publish","type":"post","link":"https:\/\/www.xenonique.co.uk\/blog\/2017\/08\/07\/virtualbox-centos-second-network-dynamic-host\/","title":{"rendered":"VirtualBox CentOS Second Network Dynamic Host"},"content":{"rendered":"<p>I had recently trouble connecting to the Internet with Centos running inside the Oracle VM VirtualBox. Even though I had configure the second adapter Network Internet Connection to be <code>Host-only Adapter<\/code> with the name <code>VirtualBox Host-Only Ethernet Adapter<\/code>. I still had problems pulling any Docker images from scratch. It turned out the network was busted.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ nslookup bbc.co.uk\r\nNot found\r\n$ ping 8.8.8.8\r\nNetwork Unreachable\r\n<\/pre>\n<p>For the following section, it helps to become the &#8220;root&#8221; superuser on your Centos VM.<br \/>\nIn order to track down the issue, check the current network status.<\/p>\n<p>Outside of Docker container, inside the Centos VM, issue the following command.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ ifconfig\r\n<\/pre>\n<p>You should see &#8220;enp0s3&#8221; and &#8220;enp0s8&#8221;, these are the Ethernet connections. &#8220;enp0s3&#8221; is the first NIC and the second is &#8220;enp0s8&#8221;, if you don&#8217;t see this, then it is down. Actually, you should also see &#8220;inet 192.168.56.107&#8221; address that means it is connected to your local LAN. <\/p>\n<p>You need to configure the setup for Centos, so that when your VM starts, if starts this Ethernet connection. <\/p>\n<p>Edit the following file \/etc\/sysconfig\/network<br \/>\nMake sure you add the following<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nNETWORKING=yes\r\n<\/pre>\n<p>Ensure that you have valid DNS name server look up in your <code>\/etc\/resolv.conf<\/code>. Here, I used Google&#8217;s services and you could substitute your own ISPs:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nnameserver 8.8.8.8\r\nnameserver 8.8.4.4\r\n<\/pre>\n<p>Finally, edit the file <code>\/etc\/sysconfig\/network-scripts\/ifcfg-enp0s3<\/code> and ensure the connection is up and running.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nTYPE=&quot;Ethernet&quot;\r\nBOOTPROTO=dhcp\r\nNAME=&quot;enp0s3&quot;\r\n...\r\nUUID=&quot;17eeb7fe-f11c-4b8b-83be-a9dd2281dda2&quot;\r\nDEVICE=&quot;enp0s3&quot;\r\nONBOOT=&quot;yes&quot;\r\n<\/pre>\n<p>Make sure the <code>ONBOOT=yes<\/code> is defined. While you are at this point, check on script <code>ifcfg-enp0s8<\/code> too.<\/p>\n<p>Restart the system services:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ service networking restart\r\n<\/pre>\n<p>Afterwards, see if the nslookup and ping previous now work for you.<\/p>\n<p>Finally, issue a reboot on VM and try again<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ shutdown -r now\r\n<\/pre>\n<p>+PP+<br \/>\nJune 2017<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had recently trouble connecting to the Internet with Centos running inside the Oracle VM VirtualBox. Even though I had configure the second adapter Network Internet Connection to be Host-only Adapter with the name VirtualBox Host-Only Ethernet Adapter. I still had problems pulling any Docker images from scratch. It turned out the network was busted. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[80,194,193,81],"tags":[],"_links":{"self":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2450"}],"collection":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=2450"}],"version-history":[{"count":2,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2450\/revisions"}],"predecessor-version":[{"id":2452,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2450\/revisions\/2452"}],"wp:attachment":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=2450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=2450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=2450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}