Changing Raspberry DNS

Changing Raspberry DNS


Changing Raspberry DNS

 Hello friends, in this post I will talk about something very simple, I will explain how we can change DNS on our Raspberry device, happy reading.

Note: What I wrote here is valid for the Raspbian operating system and has been tested, but I must say I have not individually tried it on other operating systems developed for Raspberry.

First, we open the command line and run the command below to open the page where we will edit the DNS using the nano editor.

sudo nano /etc/dhcpcd.conf

Then, scroll down and enter the DNS addresses you want to add at the bottom of the section where you see lines like "#static domain_name_servers=" in the following format.

static domain_name_servers=Address1 Address2

Here, as an example for Address1 and Address2, I can show the following.

static domain_name_servers=8.8.4.4 8.8.8.8

After performing these steps, press the "CTRL+X" key and, in the section that appears, continue by pressing "E" if your system is in Turkish or "Y" if it is in English.

As a result of this step, press the "Enter" key and close the nano editor. If you have performed the steps correctly up to here, after resetting the DNS system your new DNS address should work seamlessly.

To reset the DNS system, simply enter the code below into the command screen.

sudo service dhcpcd restart

Yes, if everything up to here has been done without issues, it means the new DNS has been applied to your Raspberry system. Have a good day, and if you get stuck anywhere, feel free to ask as a comment below.