Why can't the guest of VirtualBox connect to network?

0

I have installed CentOS 7 on virtualbox, and network setting is NAT. The guest can't connect to network:
enter image description here

systemctl -l status network output likes this:
enter image description here

ip addr output likes this:
enter image description here Could anyone give some comments on this issue?

Nan Xiao

Posted 2015-05-26T10:00:41.970

Reputation: 3 535

I recently ran into a similar problem. I had to change the VirtualBox network type to anything else, then back to NAT and it worked. This happens to every new instance I start and I have no idea why, but it works after doing this. – Nathan – 2015-05-26T16:07:53.570

Answers

0

After investigating, the root cause is since my corporation use proxy to access network, so the CentOS in VirtualBox also need adding proxy in configuration files:

(1) Adding the following lines in /etc/environment, and restart machine:

http_proxy="http://proxysrv:8080/"  
https_proxy="https://proxysrv:8080/"

Or add them in bash configuration file.

(2) Also need to add into /etc/yum.conf:

proxy="http://proxysrv:8080/"

Please refer this post.

Nan Xiao

Posted 2015-05-26T10:00:41.970

Reputation: 3 535

0

Using NAT in virtualbox is adding a firewall in it too, to shield the internal network from the external network, allowing you to specifically pass traffic based on ports and rules.

Either use the VirtualBox NAT settings to open the ports you need, or change it from NAT to a different kind of network.

LPChip

Posted 2015-05-26T10:00:41.970

Reputation: 42 190

0

From my personal experience with VirtualBox, and loading many different Linux ISOs, I am pretty sure that the NAT connection type should allow everything outbound unless you have specified otherwise in the "Advanced" > "Port forwarding" section.

You might also want to check that enp0s3 is configured properly as well.

If all else fails, a re-install might be in order.

captam3rica

Posted 2015-05-26T10:00:41.970

Reputation: 11