How to change DNS servers permanently

Asked by metrekare


I'm using Ubuntu 8.10, and an Airties RT-211 wireless modem. (I connect by Ethernet) I want to change my DNS server settings. I used to do it by using the network tray icon on the previous versions of Ubuntu but on 8.10, I cannot find the network properties.

There is one more problem. I use an Airties modem. The DNS settings are locked to the national DNS servers of Turkey, to prevent users from changing the settings, and so saving money and time for their technicians. Now, even if I change the settings on Ubuntu, after some time, Ubuntu switches to the DNS settings of the modem, I think. Because I tried to change the settings from /etc/resolv.conf . But it does not stay that way, like I said.

Is there any way to set the server I want permanently?

Question information

English Edit question
Ubuntu dhcp Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
Bhavani Shankar (bhavi) said :

You can modify the file /etc/dhcp3/dhcpd.conf and add the DNS servers you want to either the supersede or prepend lines for DNS.

Revision history for this message
marcobra (Marco Braida) (marcobra) said :

Please open a Terminal from the menu Applications → Accessories → Terminal and type:

sudo gedit /etc/dhcp3/dhclient.conf

give your user password when requested, you don't see nothing when you type it, then press enter.

Change the prepend line to read:

prepend domain-name-servers,;

save and exit and restart your newortk:

sudo /etc/init.d/networking restart

Hope This Help

Revision history for this message
metrekare (abdunal) said :

Neither of them worked.
@Bhavani Shankar: There is no such file. In /etc/dhcp3/ there is only dhclient.conf (I also tried by command as "sudo gedit /etc/dhcp3/dhcpd.conf" result was an empty file.)

@marcobra: I did what you say, but my computer does not use OpenDNS servers. I reset the computer to be sure, but it is the same. I also checked dhclient.conf. I'm sure I've edited the file. Prepend line is like this:
#prepend domain-name-servers,;

Revision history for this message
marcobra (Marco Braida) (marcobra) said :

Please remove the "#" at beginning of the line and retry...


#prepend domain-name-servers,;


prepend domain-name-servers,;

obviously you can put your desired dns instead of Opendns addresses...

and retry...

Revision history for this message
metrekare (abdunal) said :

Thanks marcobra, the problem is solved.
I did what you say, then after about 10 hours, It edited the file on its own
#supersede domain-name "";
prepend domain-name-servers,;

supersede domain-name "";
#prepend domain-name-servers,;

I don't know what it means and how it happened, but opendns was cancelled at that moment. Now I changed it back, and restarted my computer, and it's still ok.

Revision history for this message
saygin (sayginb) said :

worked for me too :) thank you marcobra! I was searching for this for a long time. thanks a lot!