I've installed CentOS, Minimal version, using Oracle VM Virtual Box. I need to install some things, but when I run yum, it reports

Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?
     release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

The URL is valid, and anyway, ping can't find anything.

Network settings show Adapter 1 Attached to: Host-only Adapter, VirtualBox Host-Only Ethernet Adapter; Promiscuous Mode is Deny, and Cable Connected is checked.

This StackExchange answer #1 and only suggests using Bridged instead. I'm trying this, with the default of an Atheros AR956x Wireless Network Adapter, other specs the same (Deny, Cable Connected). Since ping still can't find anything, I think I must be missing something else I have to tell it. What can get this box accessing the network?

closed as too broad by Anthony Geoghegan, Stephen Rauch, user34720, G-Man, countermode Jun 26 '17 at 21:38

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Are you on a home or business network? Does your virtual machine have an IP? If so, what is the IP? Can your host get to the Internet? – John Jun 26 '17 at 19:47
  • I'm on a laptop, currently at home, with Wi-Fi. The laptop can get to the Internet. I don't yet know how to know if the virtual machine has an IP. – Topological Sort Jun 26 '17 at 19:52
  • How does your laptop gets it's IP? Is it static or DHCP? – John Jun 26 '17 at 19:53
  • Static; DHCP is not enabled. – Topological Sort Jun 26 '17 at 19:57
  • I suggest you peruse Section 6.7 of the VirtualBox manual section on Networking (virtualbox.org/manual/ch06.html#network_hostonly). It is quite clear from there that a VM with host-only networking cannot talk to the Internet. ~ Some wireless NICs are known to not cope well with bridging. What is the output of ip addr and ip route when bridging the NIC? Can you ping the VM host or your router? – countermode Jun 26 '17 at 21:38

Host-only Adapter. Ok, this one is very wrong. You will not have connectivity with a host-only adapter:

6.7. Host-only networking

Host-only networking is another networking mode that was added with version 2.2 of VirtualBox. It can be thought of as a hybrid between the bridged and internal networking modes: as with bridged networking, the virtual machines can talk to each other and the host as if they were connected through a physical Ethernet switch. Similarly, as with internal networking however, a physical networking interface need not be present, and the virtual machines cannot talk to the world outside the host since they are not connected to a physical networking interface.

Instead, when host-only networking is used, VirtualBox

It's just a matter of READING THE DOCS.

Bridged mode just works without minor tricks on cabled network. See my comments here: VirtualBox fails to bridge WiFi with guest OS You will have a lot of aspects to deal with it.

tl,dr: Use nat interface.


Given your answers to my clarifying questions, you're not done setting up your guest yet. It will not get an IP address by itself since you do not have any DHCP services, so you will need to give it an IP address.

You will need to use a Bridged or NAT network connection; the IP address you give it will depend in part on what type of network connection you select.

  • That would make sense. Per blogs.oracle.com/scoter/networking-in-virtualbox-v2, it looks like a NAT network would be fine (as I want to use yum, not have people calling into my VM). I set this up to support IPv6 not DHCP, but it's not asking me about my IP address, though it does give network CIDR as . So I'm not seeing where to tell it my IP address. --? Tx. – Topological Sort Jun 26 '17 at 20:25

The host-only network of virtualbox is just that: the guest only has access to the host itself and other VMs sharing the same virtual network.

Quote from https://www.virtualbox.org/manual/ch06.html#networkingmodes

This can be used to create a network containing the host and a set of virtual machines, without the need for the host's physical network interface

To be able to connect to the internet from your guest you either must select one of bridging or NAT modes or you must configure your host to act as a router (which is much more work).

If you are not trying to achieve some special goal I'd recommend using NAT, in this mode Virtualbox provides by default a DHCP server too. So you need not configure the network addresses yourself.

Not the answer you're looking for? Browse other questions tagged or ask your own question.