I have created a new VM in RedHat (CentOS 7) in the Virtual Box on my Mac. But it is not able to connect to the network.

When you try to ping google.com.hk, the unknown host error is returned.

But you can ping 8.8.8.8 successfully.

 

Step 1:

Go to Devices > Network > Network Setting

 

Step 2:

Select “Bridged Adapter” for “Attached to”. Click “OK”

 

Step 3:

Edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 (the file name might be different but in the format of ifcfg-exxxx)

DEVICE=eth0 (no change)
HWADDR=11:22:33:44:55::66 (no change)
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.50
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=192.168.1.1

Save it

 

Step 4:

Run the following command:

# service network restart

 

Additional Note: Someone can run the following command to make it for enabling network connection

dhclient -v eth0