2

I am installing CentOS 7 on virtualbox. On "Network & Host Name" screen:

enter image description here

When toggle the "OFF" to "ON", I can see the IP, DNS, netmask are all configured:

enter image description here

I am curious about how does virtualbox get all the network configurations. What happen when toggling the "OFF" to "ON"?

3 Answers 3

0

The way VirtualBox configures networking in guests is by not only emulating the networking hardware associated with the VM, but it also creates a layer in between Host and Guest where it emulates a router.

The "Router" that VirtualBox emulates has settings which can be configured using the Virtual Machine Manager and when set to use its own DHCP server, the emulated router pushes settings to the client, as if the client was situated on a physical network using DHCP.

When toggling the Guest On/Off switch, it only applies to the Guest as it would if you were to setup CentOS on a physical machine, enabling and disabling the interface.

11
  • I am using NAT mode. But why the Guest can't connect to internet? Executing curl google.com, and the output is "curl(7): Failed tp connect to ...: Network is unreachable".
    – Nan Xiao
    May 26, 2015 at 8:00
  • I'm guessing that you didn't tell CentOS to autostart networking. in which case, run sudo systemctl status network to check the status of networking, and if the service is in the stopped state, run sudo systemctl start network to start it.
    – td512
    May 26, 2015 at 8:07
  • Doesn't seem this cause. The status is Active: active(exited) since ...... Is this state right?
    – Nan Xiao
    May 26, 2015 at 8:11
  • what's the output of ifconfig?
    – td512
    May 26, 2015 at 8:13
  • Because I can't copy easy from VM, so I catch screen shot for the ip addr. Sorry for the inconveience.
    – Nan Xiao
    May 26, 2015 at 8:19
1

When you are using the NAT mode of Virtualbox, an internal DHCP server is launched for the guests.

According to the doc, (https://www.virtualbox.org/manual/ch06.html#network_nat) the first card receives an IP in the subnet 10.0.2.0, the second in 10.0.3.0 and so on. This network can be modified (https://www.virtualbox.org/manual/ch09.html#changenat), but must be different of the host subnet.

0

When you toggle on/off, you're enabling and disabling an active link for interface of the VM. VirtualBox reports the config for the interface. It doesn't matter whether it be picking up the conifg from DHCP or it has a statically assigned IP.

You must log in to answer this question.

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