Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic:  (solved) Change DNS setting  (Read 3099 times)

Offline sunrat

  • User
  • Posts: 406
(solved) Change DNS setting
« on: 2017/08/29, 16:25:12 »
I am trying to set a different DNS server to the default one. I'm connecting via wifi to a modem/router which doesn't allow DNS server setting to be changed. Have tried a few things to no avail:
- nameserver 208.67.222.222 in resolv.conf  This always gets overwritten on restart but I'm not sure by what. resolvconf is not installed
-     nameserver 208.67.222.222 in /etc/network/interfaces.
- prepend domain-name-servers 208.67.222.222 208.67.220.220 in dhclient.conf
- DNS=208.67.222.222 in /etc/systemd/resolved.conf

network-manager is still installed but unused as wifi config is set up in interfaces file. Could this be what is overriding other configs?
« Last Edit: 2017/08/30, 16:31:55 by piper »

Offline pjnsmb

  • User
  • Posts: 88
Re: Change DNS setting
« Reply #1 on: 2017/08/29, 17:03:00 »
have a look at the chattr command



chattr +i /etc/resolv.conf (stop it being overwritten)
chattr -i /etc/resolv.conf   (cancel)


look at man chattr



regards
pjnsmb

Offline sunrat

  • User
  • Posts: 406
Re: Change DNS setting
« Reply #2 on: 2017/08/29, 17:11:20 »
Thanks pjnsmb. I did find that workaround in searching and will try it as a last resort. I'd still like to know what is overwriting interfaces file.

Offline melmarker

  • User
  • Posts: 2.799
    • g-com.eu
Re: Change DNS setting
« Reply #3 on: 2017/08/29, 17:47:02 »
using chattr in that case is the same as killing your wife because she is a bad cook - better would be in case a) if using resolvconf with n-m setting up the networkmanager/resolvconf right - same as without resolvconf. b) help her learn cooking.
Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety. (Benjamin Franklin, November 11, 1755)
Never attribute to malice that which can be adequately explained by stupidity. (Hanlons razor)

Offline piper

  • User
  • Posts: 1.785
  • we are the priests ... of the temples of syrinx
Re: Change DNS setting
« Reply #4 on: 2017/08/29, 18:57:00 »
Not to say to use google dns, but, a good example, guideline

https://developers.google.com/speed/public-dns/docs/using
Free speech isn't just fucking saying what you want to say, it's also hearing what you don't want to fucking hear

I either give too many fucks or no fucks at all, it's like I cannot find a middle ground for a moderate fuck distribution, it's like what the fuck

Offline sunrat

  • User
  • Posts: 406
Re: Change DNS setting
« Reply #5 on: 2017/08/30, 01:50:17 »
Thanks for the replies but I'm not using network-manager or resolvconf. This is a desktop system always using the same wifi and connection is set in /etc/network/interfaces. I'm trying to use OpenDNS and it's not configurable in the router.
Would removing/purging network-manager help or could this have unintended consequences?
I don't have a wife either so can't kill her. :D

Offline melmarker

  • User
  • Posts: 2.799
    • g-com.eu
Re: Change DNS setting
« Reply #6 on: 2017/08/30, 02:05:18 »
Please post the status of network-manager - and yes, one can purge n-m (ceni and ifupdown and wpa-supplicant are sufficient)
Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety. (Benjamin Franklin, November 11, 1755)
Never attribute to malice that which can be adequately explained by stupidity. (Hanlons razor)

Offline sunrat

  • User
  • Posts: 406
Re: Change DNS setting
« Reply #7 on: 2017/08/30, 02:38:48 »
Code: [Select]
roger@siduction-brain:~$ nmcli d
Error: NetworkManager is not running.

Code: [Select]
roger@siduction-brain:~$ systemctl list-units |grep network
networking.service                                                                                         loaded active exited    Raise network interfaces                                                         
vnstat.service                                                                                             loaded active running   vnStat network traffic monitor                                                   
network-online.target                                                                                      loaded active active    Network is Online                                                               
network.target                                                                                    loaded active active    Network
 

Offline piper

  • User
  • Posts: 1.785
  • we are the priests ... of the temples of syrinx
Re: Change DNS setting
« Reply #8 on: 2017/08/30, 03:24:10 »
Does this work for you with the problem of 'overwritten on restart' , I don't use sudo, so ...

Code: [Select]
nano /etc/dhcp/dhclient.conf
Add the following line to the document before the 'require subnet-mask' command

Code: [Select]
supersede domain-name-servers 208.67.222.222,208.67.220.220;
save and exit

Code: [Select]
ifdown eth0 && sudo ifup eth0
You 'might'  be required to change eth0 to your own network device's name if it uses 'Predictable Network Interface Names'.
Free speech isn't just fucking saying what you want to say, it's also hearing what you don't want to fucking hear

I either give too many fucks or no fucks at all, it's like I cannot find a middle ground for a moderate fuck distribution, it's like what the fuck

Offline sunrat

  • User
  • Posts: 406
Re: Change DNS setting
« Reply #9 on: 2017/08/30, 03:31:25 »
I tried "prepend" in that file to no avail. Will try that tonight (in about 8 hours here).

I'm using dig to show the DNS used, hopefully that is correct:
Code: [Select]
$ dig google.com |grep SERVER
;; SERVER: 192.168.0.1#53(192.168.0.1)

Offline sunrat

  • User
  • Posts: 406
Re: Change DNS setting
« Reply #10 on: 2017/08/30, 08:36:34 »
Thanks piper, looks like the "supersede" line worked.  :)

Code: [Select]
dig google.com |grep SERVER
;; SERVER: 208.67.222.222#53(208.67.222.222)

Offline piper

  • User
  • Posts: 1.785
  • we are the priests ... of the temples of syrinx
Re: Change DNS setting
« Reply #11 on: 2017/08/30, 16:32:29 »
Good deal sunrat   :)
Free speech isn't just fucking saying what you want to say, it's also hearing what you don't want to fucking hear

I either give too many fucks or no fucks at all, it's like I cannot find a middle ground for a moderate fuck distribution, it's like what the fuck