To define your nameservers in CentOS you need to edit the resolv.conf file with your favorite text editor:
# vi /etc/resolv.conf
Add your nameservers as follows and save, for example Google's name servers are:
# vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
Note: Max. three nameservers can be used/defined at a time.