Recently i installed CentOS 7.7 on oracle VirtualBox. After installation, when i run command yum update, it shows could not retrieve mirrorlist could not resolve host mirrorlist.centos.org unknown error.
When i run command ping www.google.com, it shows network is unreachable error. When i run below command to see network configuration, it all shows incorrect information.
cat /etc/resolv.conf cat /etc/sysconfig/network cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 cat /etc/sysconfig/network-scripts/route-enp0s3
1. Fix CentOS 7 Network Is Unreachable & Could Not Retrieve MirrorList Error Steps.
The reason for this error is because i do not turn on ethernet network card when install CentOS, so i should reinstall CentOS and turn on the ethernet network card follow below steps.
- When install CentOS, in Name and operation system window, you should select Red Hat ( 64-bit ) in Version drop down list.
- In the INSTALLATION SUMMARY window, NETWORK & HOST NAME section, you can see a smaller text Not connected under NETWORK & HOST NAME, click it to edit network settings.
- When you click above NETWORK & HOST NAME item, it will display below window, select the Ethernet(enp0s3) in left list, turn on the toggle button in right side, then you can see the Ethernet status is Connected, and you can see related ip, dns server ip address below it.
- You can also click the Configure… button in above window bottom right corner to customize the network settings, below is the configuration window that will popup when you click the Configure… button.
- In the General tab, i check the Automatically connect to this network when it is available checkbox.
- In the IPv4 Settings tab, you can input your own DNS server ip in Additional DNS servers input text box.
- Save above settings, and begin install the CentOS until success, after that you can find the network is available. You can run command $ ip address to get current os ip address.
2. Select Bridged Adapter In Virtual Machine Network Settings.
- Right click the CentOS virtual machine, click Settings… menu item in the popup menu list.
- Click Network tab in top area, check Enable Network Adapter checkbox, then select Bridged Adapter in the Attached to drop down list.