How To Fix CentOS Network Is Unreachable & Could Not Retrieve MirrorList Could Not Resolve Host Unknown Error

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 unknown error.

When I run the command ping, it shows the network is unreachable error. When I run the below command to see the 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.

  1. The reason for this error is because I do not turn on the ethernet network card when installing CentOS, so I should reinstall CentOS and turn on the ethernet network card follow the below steps.
  2. When installing CentOS, in the Name and operation system window, you should select Red Hat ( 64-bit ) in the Version drop-down list.
  3. 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.
  4. When you click above NETWORK & HOST NAME item, it will display the NETWORK & HOST NAME detail configuration window, select the Ethernet(enp0s3) in the left list, turn on the toggle button behind the Ethernet ( enp0s3 ) on the right side, then you can see the Ethernet status is Connected, and you can see related IP address, DNS server IP address below it.
  5. You can also click the Configure… button in the above window bottom right corner to customize the network settings, when you click the Configure… button, it will popup the Editing enp0s3 window.
  6. In the Editing enp0s3 window, click the General tab, then check the checkbox Automatically connect to this network when it is available.
  7. Click the IPv4 Settings tab, you can input your own DNS server IP in the Additional DNS servers input text box.
  8. Save the above settings, and begin installing the CentOS until success, after that you can find the network is available. You can run the command $ ip address to get the current os IP address.

2. Select Bridged Adapter In Virtual Machine Network Settings.

  1. Right-click the CentOS virtual machine, click Settings… menu item in the popup menu list.
  2. Click the Network tab in the top area, check Enable Network Adapter checkbox, then select Bridged Adapter in the Attached to drop-down list.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.