[Solved]How to change DNS settings permanently?

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
russellz
Level 3
Level 3
Posts: 174
Joined: Sat Nov 24, 2012 7:02 am
Location: Millas, France

[Solved]How to change DNS settings permanently?

Post by russellz »

Hi,
I have been struggling for some time withy my DNS settings to use a SmartDNS service to access TV when travelling abroad.

If I change them in Control Centre > Network > DNS tab > DNS Servers by deleting the preset settings and adding new severs addresses they revert to the default settings on reboot.

I have edited /etc/resolvconf/resolv.conf.d/tail to remove the reference to 208.67.222.222 and 208.67.220.220 and replaced them with my prefered DNS addresses. However, at each reboot 127.0.1.1 gets added to the top of the list shown in Control Centre and messes things up.

Any ideas how I can stop this happening?

Thanks in advance

Russell.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Laptop: HP17bs086nf, Intel Core i5-7200U, Intel HD Graphics 620 . Mint Cinnamon 21.1
Desktop: ASUS Prime B760-plus D4 motherboard, AMD Radeon RX6500XT, Intel 12th gen i7 12 core 3500MHz, 8GB ram, 500GB Samsung SSD, Mint Cinnamon 21.1
warprunner

Re: How to change DNS settings permanently?

Post by warprunner »

I am not a huge expert, but it sounds like DHCP is changing your DNS servers. Can you make the DHCP give the DNS servers you are wishing?
User avatar
russellz
Level 3
Level 3
Posts: 174
Joined: Sat Nov 24, 2012 7:02 am
Location: Millas, France

Re: How to change DNS settings permanently?

Post by russellz »

Thanks Warprunner,
I presume from your suggestion that DHCP runs on the machine as well as on the router. Any advice on how to control it?
DHCP runs on my router but only allows adresses in the range 192.168.1.20 to 192.168.1.100 so that can't be a problem.

I have just tried commenting out the line 127.0.1.1 <computer name> from the hosts file but 127.0.1.1 still gets added to the top of DNS list in Control Centre after a suspend. Any ideas where it can be finding this?

Russell.
Laptop: HP17bs086nf, Intel Core i5-7200U, Intel HD Graphics 620 . Mint Cinnamon 21.1
Desktop: ASUS Prime B760-plus D4 motherboard, AMD Radeon RX6500XT, Intel 12th gen i7 12 core 3500MHz, 8GB ram, 500GB Samsung SSD, Mint Cinnamon 21.1
warprunner

Re: How to change DNS settings permanently?

Post by warprunner »

russellz wrote:Thanks Warprunner,
I presume from your suggestion that DHCP runs on the machine as well as on the router. Any advice on how to control it?
DHCP runs on my router but only allows adresses in the range 192.168.1.20 to 192.168.1.100 so that can't be a problem.

I have just tried commenting out the line 127.0.1.1 <computer name> from the hosts file but 127.0.1.1 still gets added to the top of DNS list in Control Centre after a suspend. Any ideas where it can be finding this?

Russell.
So, you could try to disable DHCP from the machine in question.
Go into the Network settings
Go to the Options (I am currently in Mint but I believe it's the same)
Go to IPV4 Settings tab
Change Method to Manual
Add your address like 192.168.1.50
add DNS 8.8.8.8
Go to Close
Reboot

See if that works?
User avatar
russellz
Level 3
Level 3
Posts: 174
Joined: Sat Nov 24, 2012 7:02 am
Location: Millas, France

Re: How to change DNS settings permanently?

Post by russellz »

Sorry, should have said which version I'm running. It's Linux Mint Mate.

Control Centre > Network Settings gives me four tabs: Connections, General, DNS, and Hosts. No options tab. I can't find anywhere to disable DHCP or change IPV4 settings.

Sorry if I've missed something obvious!

Russell.
Laptop: HP17bs086nf, Intel Core i5-7200U, Intel HD Graphics 620 . Mint Cinnamon 21.1
Desktop: ASUS Prime B760-plus D4 motherboard, AMD Radeon RX6500XT, Intel 12th gen i7 12 core 3500MHz, 8GB ram, 500GB Samsung SSD, Mint Cinnamon 21.1
altair4
Level 20
Level 20
Posts: 11427
Joined: Tue Feb 03, 2009 10:27 am

Re: How to change DNS settings permanently?

Post by altair4 »

To get to where warprunner wants you to go in MATE it's not Control Centre > Network Settings.

It's Control Centre > Network Connections > Wired ( Or Wireless ) > Edit > IPV4 Tab
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
warprunner

Re: How to change DNS settings permanently?

Post by warprunner »

russellz wrote:Sorry, should have said which version I'm running. It's Linux Mint Mate.

Control Centre > Network Settings gives me four tabs: Connections, General, DNS, and Hosts. No options tab. I can't find anywhere to disable DHCP or change IPV4 settings.

Sorry if I've missed something obvious!

Russell.
1st...many thanks Altair4.

Ok now if where Altaid explained, and you still have an issue, my last thought is to change it in the router that is giving the DHCP addressing. However, I am thinking the IPV4 set to manual and changing the DNS servers there is the solution.

Also, no problem about your explanations. I envy that you can speak at least two languages.
User avatar
russellz
Level 3
Level 3
Posts: 174
Joined: Sat Nov 24, 2012 7:02 am
Location: Millas, France

Re: How to change DNS settings permanently?

Post by russellz »

O.K. I've now set IPV4 to manual and it still adds 127.0.1.1 to the DNS list in Network Settings on reboot or suspend. Going back to the Network Connections settings I see it has reverted to Automatic and now won't let me save a change to Manual!

Tried disabling DHCP on the router, got the message "Warning ! By Disabling the DHCP server of the neufbox, the STB may not work properly any more" but continued. Lost my usual WIFI connection but the DNS list was still changed on suspend. Tried turning off the router and found the settings remained on suspend/reboot. So there is some interaction going on between the router and the computer even when it can't establish a connection.

As an experiment I tried another distro (PCLinuxOS) running in Virtualbox and when I unchecked "Get DNS servers from DHCP" everything worked as expected so I need to find an equivalent setting for Mint.

Russell.

P.S. Tried deleting domain-name-servers and dhcp6.name-servers from the request statement in /etc/dhcp/dhclient.conf but no apparent effect. Unfortunately I don't really know what I'm doing :(
Laptop: HP17bs086nf, Intel Core i5-7200U, Intel HD Graphics 620 . Mint Cinnamon 21.1
Desktop: ASUS Prime B760-plus D4 motherboard, AMD Radeon RX6500XT, Intel 12th gen i7 12 core 3500MHz, 8GB ram, 500GB Samsung SSD, Mint Cinnamon 21.1
warprunner

Re: How to change DNS settings permanently?

Post by warprunner »

russellz wrote:O.K. I've now set IPV4 to manual and it still adds 127.0.1.1 to the DNS list in Network Settings on reboot or suspend. Going back to the Network Connections settings I see it has reverted to Automatic and now won't let me save a change to Manual!

Tried disabling DHCP on the router, got the message "Warning ! By Disabling the DHCP server of the neufbox, the STB may not work properly any more" but continued. Lost my usual WIFI connection but the DNS list was still changed on suspend. Tried turning off the router and found the settings remained on suspend/reboot. So there is some interaction going on between the router and the computer even when it can't establish a connection.

As an experiment I tried another distro (PCLinuxOS) running in Virtualbox and when I unchecked "Get DNS servers from DHCP" everything worked as expected so I need to find an equivalent setting for Mint.

Russell.

P.S. Tried deleting domain-name-servers and dhcp6.name-servers from the request statement in /etc/dhcp/dhclient.conf but no apparent effect. Unfortunately I don't really know what I'm doing :(
Ok, I think you disabled the DHCP from the Nuefbox to the provider we wanted the Neufbox to the machine side.
In an case, put it back the way it was. I read a little on a little on the Neubox and have no experience in it. However it seems like a great piece of hardware.
http://www.broadbandtvnews.com/2010/11/ ... e-gateway/

Set your machine back to automatic. Then call the help desk at the manufacturer of Neufbox and tell them what you want to do. They can walk you through everything.
I'm sorry but I don't know that hardware.

Can anyone else give input on this?
User avatar
russellz
Level 3
Level 3
Posts: 174
Joined: Sat Nov 24, 2012 7:02 am
Location: Millas, France

Re: How to change DNS settings permanently?

Post by russellz »

I don't think the problem lies with the Neufbox as it works in PCLinux. What I think need to do is to stop Mint getting its DNS settings from DHCP. There must be a setting in a configuration file somewhere to disable this if only I could find it.

Russell.
Languages; English, French, Algol, Fortran, Pascal - showing my age now!
Laptop: HP17bs086nf, Intel Core i5-7200U, Intel HD Graphics 620 . Mint Cinnamon 21.1
Desktop: ASUS Prime B760-plus D4 motherboard, AMD Radeon RX6500XT, Intel 12th gen i7 12 core 3500MHz, 8GB ram, 500GB Samsung SSD, Mint Cinnamon 21.1
User avatar
winemaker9
Level 1
Level 1
Posts: 39
Joined: Mon Oct 26, 2009 11:18 am

Re: How to change DNS settings permanently?

Post by winemaker9 »

FYI, the original DNS settings ( 208.67.222.222 and 208.67.220.220) were for OpenDNS which should be good for most anything. That said, the other suggestion of 8.8.8.8 are for Google I believe (and their secondary is 4.4.4.4).

If nothing is set on the linux box, it'll default to whatever the Router has set for it's DNS. There must always be a DNS setting, so why not just stick with OpenDNS as that is among the safest going.

That said, to create a permanent DNS,
open Network Connections
choose wired or the wireless ssid you wish to modify
Click on Edit
IPv4 tab
Click on the dropdown 'Method' and change from "Automatic DHCP' to "Automatic (DHCP) addresses only"
and then in the line that says DNS servers, put in the primary and secondary addresses ( 208.67.222.222, 208.67.220.220 )

As far as I know, you must do this for every SSID, therefore leaving it on Automatic and changing it in the router is much easier.

As far as the "127.0.1.1", that represents localhost

Hope that helps...
Steve
User avatar
russellz
Level 3
Level 3
Posts: 174
Joined: Sat Nov 24, 2012 7:02 am
Location: Millas, France

Re: How to change DNS settings permanently?

Post by russellz »

winemaker9 wrote:FYI, the original DNS settings ( 208.67.222.222 and 208.67.220.220) were for OpenDNS which should be good for most anything. That said, the other suggestion of 8.8.8.8 are for Google I believe (and their secondary is 4.4.4.4).

If nothing is set on the linux box, it'll default to whatever the Router has set for it's DNS. There must always be a DNS setting, so why not just stick with OpenDNS as that is among the safest going.

I am using a smartDNS service to allow me to access TV channels from outside the intended area so have to use specific DNS servers.
That said, to create a permanent DNS,
open Network Connections
choose wired or the wireless ssid you wish to modify
Click on Edit
IPv4 tab
Click on the dropdown 'Method' and change from "Automatic DHCP' to "Automatic (DHCP) addresses only"
and then in the line that says DNS servers, put in the primary and secondary addresses ( 208.67.222.222, 208.67.220.220 )

As far as I know, you must do this for every SSID, therefore leaving it on Automatic and changing it in the router is much easier.

As far as the "127.0.1.1", that represents localhost

Hope that helps...
Thanks for that - that works!

Russell.
Laptop: HP17bs086nf, Intel Core i5-7200U, Intel HD Graphics 620 . Mint Cinnamon 21.1
Desktop: ASUS Prime B760-plus D4 motherboard, AMD Radeon RX6500XT, Intel 12th gen i7 12 core 3500MHz, 8GB ram, 500GB Samsung SSD, Mint Cinnamon 21.1
Roger Beaumont

Re: How to change DNS settings permanently?

Post by Roger Beaumont »

I've just installed Maya MATE on a new-to-me, Thinkpad T400 - I've got the LAN working, taking IP addresses from /etc/hosts, or explicitly, so I can ping successfully via cable or wireless, but not the Internet. The errors I'm getting suggest it's a DNS issue...

The LAN is built around an 8-port switch & a WAP, connecting to the Internet through an old PC running LEAF firewall software.

I go to Control Centre > Network to open a window entitled "Network Settings"

1 What is the "Location" about? I've left it at "default"

2 There are 3 "Connections" shown for wlan0, eth0 & ppp0. Only the first 2 are of interest. Unless I tick "Enable roaming mode" (which destroys my configuration settings), they show as "Point-to-point connection This network interface is not configured" Taking eth0 for simplicity, I have Configuration = "Static IP address"; IP address=192.168.1.4 (4th m/c on the LAN, with only 5 I don't want DHCP, but do want to know all 5 IPs, so I can ping them to check which are on); Subnet mask = 266.255.255.0; Gateway address = 192.168.1.254 (the firewall LAN NIC) Why is this "not configured"?

3 There are 4 tabs "Connections" (see above); General (naming this host as Lenny2); DNS & Hosts. The errors I'm getting suggest it's a DNS issue, so I click "Add" for DNS Servers, it shows "type address" so I do, then, no matter what I've tried to do next, the address just vanishes! How can I get something to stick?

Thanks,

Roger
User avatar
russellz
Level 3
Level 3
Posts: 174
Joined: Sat Nov 24, 2012 7:02 am
Location: Millas, France

Re: [Solved]How to change DNS settings permanently?

Post by russellz »

Hi Roger,
1 I leave this blank as well. Not sure but I think it's just the location that is reported to a query.
2 Sorry, don't know
3 This window only allows two DNS addresses in addition to 127.0.1.1. In any case what you type in here is only used until reboot so it is a pretty useless setting. See above.

This thread is marked as solved so most people will ignore it. You might get a better response if you post your problem as a new thread.

Russell.
Laptop: HP17bs086nf, Intel Core i5-7200U, Intel HD Graphics 620 . Mint Cinnamon 21.1
Desktop: ASUS Prime B760-plus D4 motherboard, AMD Radeon RX6500XT, Intel 12th gen i7 12 core 3500MHz, 8GB ram, 500GB Samsung SSD, Mint Cinnamon 21.1
DDR-4
Level 2
Level 2
Posts: 97
Joined: Mon Apr 17, 2017 11:25 am

Re: [Solved]How to change DNS settings permanently?

Post by DDR-4 »

Hi all,

Just adding my two cents here.

I have Linux Mint 18 running on an Acer Aspire laptop and I use 3 mobile broadband.

I was having terrible slow connection with using 3's DNS so to fix it I did this:
Click on Edit
IPv4 tab
Click on the dropdown 'Method' and change from "Automatic DHCP' to "Automatic (DHCP) addresses only"
and then in the line that says DNS servers, put in the primary and secondary addresses ( 208.67.222.222, 208.67.220.220 )
and then open a terminal and sudo su to root user.

Went to /etc/ and saw there is a symlink called /etc/@resolv.conf that points to:

/run/resolvconf/resolv.conf

the contents of that file are:

Code: Select all

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
So what I did as root was delete the symlink under /etc/@resolv.conf and then copied the above /run/resolvconf/resolv.conf to /etc/resolv.conf

This means that any changes made by NetworkManager would not now affect my custom /etc/resolv.conf file as it's now a seperate entity.

In my custom /etc/resolv.conf I edited to look like:

Code: Select all

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# nameserver 127.0.1.1

# Open DNS
nameserver 208.67.220.220
nameserver 208.67.222.222

# Google Public DNS
nameserver 8.8.4.4
nameserver 8.8.8.8
Then I disconnected the 3 mobile WiFi and reconnected it again.

That seems to have fixed the issue with very slow DNS queries and my pages now load a lot faster.

HTH

DDR-4
Locked

Return to “Networking”