VirtualBox: Ubuntu guest can't connect to Internet

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite
1












I have configured the Ubuntu server (guest) with NAT adapter and configured it in /etc/network/interfaces like below:



auto enp0s3
iface enp0s3 inet dhcp


But doesn't connect to internet:



ping www.google.com
ping: unknown host www.google.com


The host machine is a Windows7 with the firewall disabled.
How can I solve this problem?










share|improve this question























  • version is 16.04
    – albert
    Mar 7 at 17:31










  • Might I ask why you need a static IP in the NAT configuration of VirtualBox to the server? You might need to check this for Net DNS Proxy to work: forums.virtualbox.org/viewtopic.php?f=1&t=49066
    – Terrance
    Mar 7 at 17:44











  • I have changed to dhcp, but I don't know what I'm doing. I'm good at programming not in networks
    – albert
    Mar 7 at 17:53










  • If I do ping -c5 66.102.9.147 (IP from google) it works. I have problems with DNS. Because I can't do an apt-get update. I have been following this askubuntu.com/questions/91543/…
    – albert
    Mar 7 at 17:56











  • Within a VM it is different as it is going through the Network Address Translation (NAT) controller. It generates its own DHCP. Don't put anything in the /etc/resolv.conf file. Remove the lines from /etc/network/interfaces that deals with the enp0s3. Reboot the VM and let it use the DNS from the host OS. Are you looking to access your server from outside the VM / Host computer?
    – Terrance
    Mar 7 at 18:19















up vote
0
down vote

favorite
1












I have configured the Ubuntu server (guest) with NAT adapter and configured it in /etc/network/interfaces like below:



auto enp0s3
iface enp0s3 inet dhcp


But doesn't connect to internet:



ping www.google.com
ping: unknown host www.google.com


The host machine is a Windows7 with the firewall disabled.
How can I solve this problem?










share|improve this question























  • version is 16.04
    – albert
    Mar 7 at 17:31










  • Might I ask why you need a static IP in the NAT configuration of VirtualBox to the server? You might need to check this for Net DNS Proxy to work: forums.virtualbox.org/viewtopic.php?f=1&t=49066
    – Terrance
    Mar 7 at 17:44











  • I have changed to dhcp, but I don't know what I'm doing. I'm good at programming not in networks
    – albert
    Mar 7 at 17:53










  • If I do ping -c5 66.102.9.147 (IP from google) it works. I have problems with DNS. Because I can't do an apt-get update. I have been following this askubuntu.com/questions/91543/…
    – albert
    Mar 7 at 17:56











  • Within a VM it is different as it is going through the Network Address Translation (NAT) controller. It generates its own DHCP. Don't put anything in the /etc/resolv.conf file. Remove the lines from /etc/network/interfaces that deals with the enp0s3. Reboot the VM and let it use the DNS from the host OS. Are you looking to access your server from outside the VM / Host computer?
    – Terrance
    Mar 7 at 18:19













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I have configured the Ubuntu server (guest) with NAT adapter and configured it in /etc/network/interfaces like below:



auto enp0s3
iface enp0s3 inet dhcp


But doesn't connect to internet:



ping www.google.com
ping: unknown host www.google.com


The host machine is a Windows7 with the firewall disabled.
How can I solve this problem?










share|improve this question















I have configured the Ubuntu server (guest) with NAT adapter and configured it in /etc/network/interfaces like below:



auto enp0s3
iface enp0s3 inet dhcp


But doesn't connect to internet:



ping www.google.com
ping: unknown host www.google.com


The host machine is a Windows7 with the firewall disabled.
How can I solve this problem?







16.04 networking server virtualbox






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 17:52

























asked Mar 7 at 17:03









albert

1034




1034











  • version is 16.04
    – albert
    Mar 7 at 17:31










  • Might I ask why you need a static IP in the NAT configuration of VirtualBox to the server? You might need to check this for Net DNS Proxy to work: forums.virtualbox.org/viewtopic.php?f=1&t=49066
    – Terrance
    Mar 7 at 17:44











  • I have changed to dhcp, but I don't know what I'm doing. I'm good at programming not in networks
    – albert
    Mar 7 at 17:53










  • If I do ping -c5 66.102.9.147 (IP from google) it works. I have problems with DNS. Because I can't do an apt-get update. I have been following this askubuntu.com/questions/91543/…
    – albert
    Mar 7 at 17:56











  • Within a VM it is different as it is going through the Network Address Translation (NAT) controller. It generates its own DHCP. Don't put anything in the /etc/resolv.conf file. Remove the lines from /etc/network/interfaces that deals with the enp0s3. Reboot the VM and let it use the DNS from the host OS. Are you looking to access your server from outside the VM / Host computer?
    – Terrance
    Mar 7 at 18:19

















  • version is 16.04
    – albert
    Mar 7 at 17:31










  • Might I ask why you need a static IP in the NAT configuration of VirtualBox to the server? You might need to check this for Net DNS Proxy to work: forums.virtualbox.org/viewtopic.php?f=1&t=49066
    – Terrance
    Mar 7 at 17:44











  • I have changed to dhcp, but I don't know what I'm doing. I'm good at programming not in networks
    – albert
    Mar 7 at 17:53










  • If I do ping -c5 66.102.9.147 (IP from google) it works. I have problems with DNS. Because I can't do an apt-get update. I have been following this askubuntu.com/questions/91543/…
    – albert
    Mar 7 at 17:56











  • Within a VM it is different as it is going through the Network Address Translation (NAT) controller. It generates its own DHCP. Don't put anything in the /etc/resolv.conf file. Remove the lines from /etc/network/interfaces that deals with the enp0s3. Reboot the VM and let it use the DNS from the host OS. Are you looking to access your server from outside the VM / Host computer?
    – Terrance
    Mar 7 at 18:19
















version is 16.04
– albert
Mar 7 at 17:31




version is 16.04
– albert
Mar 7 at 17:31












Might I ask why you need a static IP in the NAT configuration of VirtualBox to the server? You might need to check this for Net DNS Proxy to work: forums.virtualbox.org/viewtopic.php?f=1&t=49066
– Terrance
Mar 7 at 17:44





Might I ask why you need a static IP in the NAT configuration of VirtualBox to the server? You might need to check this for Net DNS Proxy to work: forums.virtualbox.org/viewtopic.php?f=1&t=49066
– Terrance
Mar 7 at 17:44













I have changed to dhcp, but I don't know what I'm doing. I'm good at programming not in networks
– albert
Mar 7 at 17:53




I have changed to dhcp, but I don't know what I'm doing. I'm good at programming not in networks
– albert
Mar 7 at 17:53












If I do ping -c5 66.102.9.147 (IP from google) it works. I have problems with DNS. Because I can't do an apt-get update. I have been following this askubuntu.com/questions/91543/…
– albert
Mar 7 at 17:56





If I do ping -c5 66.102.9.147 (IP from google) it works. I have problems with DNS. Because I can't do an apt-get update. I have been following this askubuntu.com/questions/91543/…
– albert
Mar 7 at 17:56













Within a VM it is different as it is going through the Network Address Translation (NAT) controller. It generates its own DHCP. Don't put anything in the /etc/resolv.conf file. Remove the lines from /etc/network/interfaces that deals with the enp0s3. Reboot the VM and let it use the DNS from the host OS. Are you looking to access your server from outside the VM / Host computer?
– Terrance
Mar 7 at 18:19





Within a VM it is different as it is going through the Network Address Translation (NAT) controller. It generates its own DHCP. Don't put anything in the /etc/resolv.conf file. Remove the lines from /etc/network/interfaces that deals with the enp0s3. Reboot the VM and let it use the DNS from the host OS. Are you looking to access your server from outside the VM / Host computer?
– Terrance
Mar 7 at 18:19











2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










You may need to include your DNS entries, manually. Try adding this line to your configuration. Note that these DNS servers are Google's, and will not be able to provide DNS for your local LAN, but will provide DNS for accessing sites on the Internet..



dns-nameservers 8.8.8.8 8.8.4.4


Reference: https://www.swiftstack.com/docs/install/configure_networking.html






share|improve this answer



























    up vote
    0
    down vote













    I found a solution on internet. The idea is to execute next instruction:



    echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null


    This replaces the nameserver (DNS) used on the machine by the Google Public DNS service.






    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "89"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1012798%2fvirtualbox-ubuntu-guest-cant-connect-to-internet%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote



      accepted










      You may need to include your DNS entries, manually. Try adding this line to your configuration. Note that these DNS servers are Google's, and will not be able to provide DNS for your local LAN, but will provide DNS for accessing sites on the Internet..



      dns-nameservers 8.8.8.8 8.8.4.4


      Reference: https://www.swiftstack.com/docs/install/configure_networking.html






      share|improve this answer
























        up vote
        1
        down vote



        accepted










        You may need to include your DNS entries, manually. Try adding this line to your configuration. Note that these DNS servers are Google's, and will not be able to provide DNS for your local LAN, but will provide DNS for accessing sites on the Internet..



        dns-nameservers 8.8.8.8 8.8.4.4


        Reference: https://www.swiftstack.com/docs/install/configure_networking.html






        share|improve this answer






















          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          You may need to include your DNS entries, manually. Try adding this line to your configuration. Note that these DNS servers are Google's, and will not be able to provide DNS for your local LAN, but will provide DNS for accessing sites on the Internet..



          dns-nameservers 8.8.8.8 8.8.4.4


          Reference: https://www.swiftstack.com/docs/install/configure_networking.html






          share|improve this answer












          You may need to include your DNS entries, manually. Try adding this line to your configuration. Note that these DNS servers are Google's, and will not be able to provide DNS for your local LAN, but will provide DNS for accessing sites on the Internet..



          dns-nameservers 8.8.8.8 8.8.4.4


          Reference: https://www.swiftstack.com/docs/install/configure_networking.html







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 7 at 17:39









          DaneM

          30613




          30613






















              up vote
              0
              down vote













              I found a solution on internet. The idea is to execute next instruction:



              echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null


              This replaces the nameserver (DNS) used on the machine by the Google Public DNS service.






              share|improve this answer
























                up vote
                0
                down vote













                I found a solution on internet. The idea is to execute next instruction:



                echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null


                This replaces the nameserver (DNS) used on the machine by the Google Public DNS service.






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  I found a solution on internet. The idea is to execute next instruction:



                  echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null


                  This replaces the nameserver (DNS) used on the machine by the Google Public DNS service.






                  share|improve this answer












                  I found a solution on internet. The idea is to execute next instruction:



                  echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null


                  This replaces the nameserver (DNS) used on the machine by the Google Public DNS service.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 8 at 9:10









                  albert

                  1034




                  1034



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1012798%2fvirtualbox-ubuntu-guest-cant-connect-to-internet%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      pylint3 and pip3 broken

                      Missing snmpget and snmpwalk

                      How to enroll fingerprints to Ubuntu 17.10 with VFS491