Ensure DNS Nameservers are correct on EC2 startup

vim /etc/sysconfig/network-scripts/ifcfg-eth0

add

PEERDNS=no
sudo vim /etc/resolv.conf

make sure this file is as you want it and then make a copy

sudo cp resolv.conf resolv.conf.bk

sudo vim /etc/rc.local

add these two lines:

rm -f /etc/resolv.conf
cp /etc/resolv.conf.bk /etc/resolv.conf

reboot safe in the knowledge that your network config will be persistent

Leave a Reply

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.