CentOS: Fixing PYCURL ERROR 6 – “Couldn’t resolve host ‘mirrorlist.centos.org'” on yum update

Operating System, Technology

Problem:

Found this problem on Centos 6.4 x86_64 :
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'" Error: Cannot find a valid baseurl for repo: base

Solution:

And I tried to fix it by these steps:
1. edit network interface. For my case, I used eth0 in CentOS 6.X:
vim /etc/sysconfig/network-scripts/ifcfg-eth0
In CentOS 7.X you can use the ensxxx interface.

2. update NM_CONTROLLED to no