How to change DNS servers permanently

Asked by metrekare

Hi.

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

Language:
English Edit question
Status:
Solved
For:
Ubuntu dhcp Edit question
Assignee:
No assignee Edit question
Solved by:
metrekare
Solved:
Last query:
Last reply:
Revision history for this message
Bhavani Shankar (bhavi) said :
#1

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 :
#2

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 208.67.222.222, 208.67.220.220;

save and exit and restart your newortk:

sudo /etc/init.d/networking restart

Hope This Help

Revision history for this message
metrekare (abdunal) said :
#3

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 208.67.222.222, 208.67.220.220;

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

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

Change

#prepend domain-name-servers 208.67.222.222, 208.67.220.220;

to

prepend domain-name-servers 208.67.222.222, 208.67.220.220;

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

and retry...

Revision history for this message
metrekare (abdunal) said :
#5

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

to
supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 208.67.222.222, 208.67.220.220;

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 :
#6

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