There may be scenarios, when you need to use a custom DNS server for your Instances. So if you are deploying your application on an CentOS 7 on AWS, lets see how can set a custom DNS server such as 8.8.8.8 and 8.8.4.4
- Edit the following file,
vim /etc/sysconfig/network-scripts/ifcfg-eth0
- change the line
PEERDNS="yes"
toPEERDNS="no"
- Now, Edit the file
/etc/sysconfig/network
and add the DNS entries after the existing contents.
NETWORKING=yes NOZEROCONF=yes DNS1=8.8.8.8 DNS2=8.8.4.4
- Then, restart your network service
/etc/init.d/network restart
- Now check and verify the DNS servers in
/etc/resolv.conf