Amazon Linux - Configure Network Settings
When running Amazon Linux on AWS, you can find the networking configuration file at:
If you edit it, you will likely find content similar to the following:
DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes TYPE=Ethernet USERCTL=yes PEERDNS=yes IPV6INIT=no PERSISTENT_DHCLIENT=yes RES_OPTIONS="timeout:2 attempts:5" DHCP_ARP_CHECK=no MTU="9001"
Set Google DNS
One can manually set the DNS provider, by adding the following lines:
In this example, we have set the DNS to Google's DNS servers, but you can set any IP addresses you like, such as OpenDNS.
Run the following command for the changes to take immediate effect.
sudo ifdown eth0 && sudo ifup eth0
- AWS Docs - My private Amazon EC2 instance is running Amazon Linux, Ubuntu, or RHEL. How do I assign a static DNS server to the EC2 instance that persists during reboot?
First published: 8th January 2023