Page 1 of 1
[Fixed] Permanently change DNS
Posted: 03 Aug 2009, 13:47
by christian.einarsson
I want to use OpenDNS instead of my ISP's DNS servers.
I'm using my Bubba2 as a router with dynamic IP on WAN and static IP on LAN. I've tried changing the DNS field in the Network -> LAN tab on the admin pages. But suddenly a couple of days ago it changed back to one of my ISP's servers.
How do I make this change permanent?
Re: Permanently change DNS
Posted: 04 Aug 2009, 03:28
by tor
Hi Christian,
The web-ui does not support this atm. It modifies the /etc/resolv.conf file which is most likely overwritten later when you get an dhcp update on you wan interface.
An
untested way to achieve this would be to manually edit the
/etc/dhcp3/dhclient.conf file. Try adding something like a:
Code: Select all
supersede domain-name-servers ip.to.your.dnsprovider;
resulting in the top lines look something like:
Code: Select all
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;
timeout 10;
supersede domain-name-servers ip.to.your.dnsprovider;
.
.
.
optionally remove the domain-name-servers from the options in the request line.
/Tor
Re: Permanently change DNS
Posted: 07 Aug 2009, 00:23
by christian.einarsson
Thank you, I will try this when I am back at home next week.
Re: Permanently change DNS
Posted: 16 Sep 2009, 17:11
by christian.einarsson
Finally did I get got some spare time to try this.
After some tinkering it looks like its working. My problem was that /etc/resolve.conf didn't seam to be updated even though the logs showed that my bubba renewed it's DHCP lease.
The thing I think did the trick was to run
to manually trigger a full DHCP renew.
For future references, my OpenDNS enabled /etc/dhcp3/dhclient.conf looks like this.
Code: Select all
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;
#OpenDNS should be used instead of DNS from ISP
supersede domain-name-servers 208.67.222.222, 208.67.220.220;
timeout 10;
lease {
interface "eth1";
fixed-address 1.2.3.1
option subnet-mask 255.255.255.0;
option broadcast-address 1.2.3.255;
option routers 1.2.3.1;
renew 6 2029/1/10 13:58:18;
rebind 3 2029/7/18 06:11:04;
expire 2 2038/1/19 03:14:07;
}
send host-name "bubba";
Re: Permanently change DNS
Posted: 21 Sep 2009, 02:28
by christian.einarsson
Well it seams that there are more than one way of updating /etc/resolv.conf. When I manually run
/etc/resolv.conf gets updated with the DNS servers I've specified in /etc/dhcp3/dhclient.conf. But after a while they are replaced with the ones recieved from my DHCP, probably when Bubba2 does a automatic DHCP update.
Any ideas how to solve this?
Re: Permanently change DNS
Posted: 21 Sep 2009, 13:12
by effevee
christian.einarsson wrote:Finally did I get got some spare time to try this.
For future references, my OpenDNS enabled /etc/dhcp3/dhclient.conf looks like this.
Code: Select all
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;
#OpenDNS should be used instead of DNS from ISP
supersede domain-name-servers 208.67.222.222, 208.67.220.220;
timeout 10;
lease {
interface "eth1";
fixed-address 1.2.3.1
option subnet-mask 255.255.255.0;
option broadcast-address 1.2.3.255;
option routers 1.2.3.1;
renew 6 2029/1/10 13:58:18;
rebind 3 2029/7/18 06:11:04;
expire 2 2038/1/19 03:14:07;
}
send host-name "bubba";
Christian,
What happens if you leave out the
domain-name-servers from the request line in dhclient.conf
Code: Select all
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, host-name, netbios-name-servers, netbios-scope;
#OpenDNS should be used instead of DNS from ISP
supersede domain-name-servers 208.67.222.222, 208.67.220.220;
Haven't tried it myself though.
effevee
Re: Permanently change DNS
Posted: 23 Sep 2009, 18:09
by christian.einarsson
Must have been very tired not to think of that. Tried it just now, this time with out doing a manual update. After about 10 minutes (probably my ISPs lease time) /etc/resolv.conf contained my desired DNS servers instead of my ISPs.
Changes to /etc/dhcp3/dhclient.conf so far...
Code: Select all
# Removed 'domain-name-servers' to avoid asking DHCP for DNS server
request subnet-mask, broadcast-address, time-offset, routers,
# domain-name, domain-name-servers, host-name,
domain-name, host-name,
netbios-name-servers, netbios-scope;
#Line added to make OpenDNS my permanent DNS
supersede domain-name-servers 208.67.222.222, 208.67.220.220;
I hope this did it, I will report in a few days when I know if the change is permanent.
Re: [Fixed] Permanently change DNS
Posted: 21 Dec 2009, 04:46
by christian.einarsson
It's been working flawlessly for a couple of months now.
Re: [Fixed] Permanently change DNS
Posted: 06 Jan 2013, 13:18
by nerke
Sorry to bump this tread up....
I want to use OpenDns as my dns-server and found this tread.
I ssh:ed over to my B2 and did a
as root but didn't find a
dhcpclient.conf.
Is it safe to make one?
Re: [Fixed] Permanently change DNS
Posted: 06 Jan 2013, 14:17
by RandomUsername
The files in question have changed it would seem. You need to edit /etc/dhcp/dhclient.conf.
Re: [Fixed] Permanently change DNS
Posted: 07 Jan 2013, 16:47
by nerke
hmmm changed my
/etc/dhcp/dhclient.conf to
Code: Select all
request subnet-mask, broadcast-address, time-offset, routers,
# domain-name, domain-name-servers, host-name,
domain-name, host-name,
netbios-name-servers, netbios-scope;
supersede domain-name-servers 208.67.222.222, 208.67.220.220;
timeout 10;
lease {
interface "eth1";
fixed-address 192.168.10.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.10.255;
option routers 192.168.10.1;
renew 6 2029/1/10 13:58:18;
rebind 3 2029/7/18 06:11:04;
expire 2 2038/1/19 03:14:07;
}
send host-name "b2";
and ran
/sbin/dhclient eth0 and waited för a couple of hours but my dns-servers didn't change...
Re: [Fixed] Permanently change DNS
Posted: 07 Jan 2013, 17:56
by Gordon
I don't think the hash tag is valid there. If you want to keep that line, you should move it out of the sequence.
I really can't comment on the "supersede" directive. I changed the request directive in my own dhclient.conf in a similar war, but I also changed my resolv.conf file manually. I really don't see the point of adding instructions for dhclient to maintain static addresses that I've just told not to touch. And in fact it doesn't, which may be why it's failing because if it's not supposed to touch it than there's also nothing to supersede. There can however be a version dependency on this philosophy: previously it used to mean that a specific setting should always be enforced, while nowadays it is custom to only enforce a setting that is already influenced by some other variable.
Stick to basics: if you want to manually maintain DNS lookup configuration (i.e. the contents of /etc/resolv.conf) and some other process keeps changing it, stop the other process from changing it - don't tell that other process to fill it with the information you desire.