CentOS 7 VirtualBox no internet access

As Gasim said:

Add the following to /etc/sysconfig/network-scripts/ifcfg-enp0s3

DNS1=8.8.8.8
DNS2=8.8.4.4
# Note this was set to no
ONBOOT=yes  

Chances are that in /etc/resolv.conf you don't have any nameservers set, in which case you want to do:

vim /etc/resolv.conf

and add:

nameserver 8.8.8.8
nameserver 8.8.4.4

save it, and once back at the shell

do:

sudo reboot now to reboot and you should have internet access


Network connection is not active by default. You can check this by running the command:

nmcli d

To edit the connection run the following command:

nmtui
  1. Edit a connection
  2. Choose your Ethernet connection
  3. Check the option "Automatically connect" as shown in the pic below:

    nmtui GUI

  4. systemctl restart network

  5. sudo shutdown -r now