5

I just installed Centos 7 on a VM I'm running from VirtualBox on a windows machine.

I installed the latest minimal release. I then went about setting up a static IP. When I try to access the machine I cannot, I cannot ping out from the machine either.

I'm not sure if it is a CentOS problem or a VirtualBox problem.

Here is the output of ip addr:

ip addr

Here is the output of nmcli d:

nmcli d

I should also mention that really I have no idea what I am doing.

2

2 Answers 2

4

You have likely not configured your network in Virtualbox correctly.

Please refer to section 6.2: https://www.virtualbox.org/manual/ch06.html

By default, Virtualbox puts adapters in NAT mode. This works for connecting the virtual machine to the internet, but not much else. This is because Virtualbox creates an additional NAT on your machine, and puts the VMs behind it.

In my view, the desirable mode is "Bridged Networking", where the VM acts like a separate device on your network, bridging directly to your network adapter. Then it will be on the same subnet as any other machine on your network.

There are other use cases for the other networking modes, but I find that 99% of the time, bridged mode is what I want for the VM.

3
  • Well... that was fairly painless... I can now ping my other machines and ssh into it from the network, superb. Thanks.
    – Neilos
    Apr 14, 2015 at 23:39
  • @Neilos My pleasure. When I first ran into that problem...ohhhh...four or so years ago, it took me months of tearing my hair out before I finally figured it out. I'm happy to pass on the knowledge to others :)
    – Nick2253
    Apr 14, 2015 at 23:40
  • At work we use VSphere and it is all managed for us, this is the first time I've set it up myself! You've saved my hair tonight, I hope yours grew back! ;)
    – Neilos
    Apr 14, 2015 at 23:44
2

To get Centos to run on Virtual Box, in /etc/sysconfig/network-scripts/ifcfg-eth0:

DEVICE=eth0  
BOOTPROTO=dhcp  
ONBOOT=yes

You might need to reboot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .