How to set custom DNS on CentOS7 AWS

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" to PEERDNS="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
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Scroll to Top