New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

[Fixed] Permanently change DNS

Got problems with your B2 or B3? Share and get helped!
Post Reply
christian.einarsson
Posts: 12
Joined: 03 Aug 2009, 13:26

[Fixed] Permanently change DNS

Post 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?
Last edited by christian.einarsson on 21 Dec 2009, 04:44, edited 1 time in total.
tor
Posts: 703
Joined: 06 Dec 2006, 12:24
Contact:

Re: Permanently change DNS

Post 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
Co-founder OpenProducts and Ex Excito Developer
christian.einarsson
Posts: 12
Joined: 03 Aug 2009, 13:26

Re: Permanently change DNS

Post by christian.einarsson »

Thank you, I will try this when I am back at home next week.
christian.einarsson
Posts: 12
Joined: 03 Aug 2009, 13:26

Re: Permanently change DNS

Post 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

Code: Select all

sudo /sbin/dhclient eth0
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";
christian.einarsson
Posts: 12
Joined: 03 Aug 2009, 13:26

Re: Permanently change DNS

Post by christian.einarsson »

Well it seams that there are more than one way of updating /etc/resolv.conf. When I manually run

Code: Select all

sudo /sbin/dhclient eth0
/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?
effevee
Posts: 9
Joined: 26 Jun 2009, 14:14
Location: Ingelmunster, Belgium

Re: Permanently change DNS

Post 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
christian.einarsson
Posts: 12
Joined: 03 Aug 2009, 13:26

Re: Permanently change DNS

Post 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.
christian.einarsson
Posts: 12
Joined: 03 Aug 2009, 13:26

Re: [Fixed] Permanently change DNS

Post by christian.einarsson »

It's been working flawlessly for a couple of months now.
nerke
Posts: 23
Joined: 29 Jul 2010, 14:33

Re: [Fixed] Permanently change DNS

Post 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

Code: Select all

ls /etc/dhcp3/
as root but didn't find a dhcpclient.conf.

Is it safe to make one?
RandomUsername
Posts: 904
Joined: 09 Oct 2009, 18:49

Re: [Fixed] Permanently change DNS

Post by RandomUsername »

The files in question have changed it would seem. You need to edit /etc/dhcp/dhclient.conf.
nerke
Posts: 23
Joined: 29 Jul 2010, 14:33

Re: [Fixed] Permanently change DNS

Post 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...
Gordon
Posts: 1461
Joined: 10 Aug 2011, 03:18

Re: [Fixed] Permanently change DNS

Post 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.
Post Reply