Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] change DNS server

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

[SOLVED] change DNS server

#1 Post by ticojohn »

I am running Buster amd64 with XFCE desktop. I know that I can change the DNS server by editing connections in the network icon. What I am wanting to know is this; can I get the system to use the new DNS server settings without having to reboot the computer? I tried to do it by issuing

Code: Select all

 /etc/init.d/networking restart 
but that didn't seem to apply the new DNS server address.

UPDATE: Well, I did what I maybe should have done in the first place; research. From what I can find, I would need to do

Code: Select all

ifdown eth0
ifup eth0
to get the changes to take effect without rebooting. Of course one needs to use the correct interface for their system. In my case, instead of eth0 I would use enp2s0.

I would welcome comments, especially if my research was flawed. :shock:
Last edited by ticojohn on 2021-04-18 18:35, edited 1 time in total.
I am not irrational, I'm just quantum probabilistic.

reinob
Posts: 1196
Joined: 2014-06-30 11:42
Has thanked: 99 times
Been thanked: 47 times

Re: change DNS server

#2 Post by reinob »

Assuming that your "editing connections in the network icons" ends up modifying /etc/resolv.conf, then the effect should be immediate, so there's no need to disconnect-reconnect, reboot, or anything.

Most programs use the standard glibc resolver, so the effect is immediate. Maybe Chrome, Firefox, etc. might try to be too "smart" and require restarting (the program, not the computer).

User avatar
Bloom
df -h | grep > 90TiB
df -h | grep > 90TiB
Posts: 504
Joined: 2017-11-11 12:23
Been thanked: 26 times

Re: change DNS server

#3 Post by Bloom »

Also keep in mind that if you're using dhcp, the dns information comes with that protocol from the dhcp server (in most cases your router). So editing it won't work, since the dhcp-system will override it. In that case, edit the dns information in your router webconfig.

Also worth noting: if you reside in the VS, the Firefox browser uses an encrypted dns-over-https protocol to anonymize your dns requests for your provider and other peeping toms. So changing your dns wouldn't affect your Firefox browser since it doesn't use your dns. If you don't want that, you would need to change the appropriate settings in Firefox's about-config.

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: change DNS server

#4 Post by ticojohn »

Bloom wrote:Also keep in mind that if you're using dhcp, the dns information comes with that protocol from the dhcp server (in most cases your router). So editing it won't work, since the dhcp-system will override it. In that case, edit the dns information in your router webconfig.
Thanks @Bloom. To get it to work one needs to change the configuration from Automatic(DHCP) to Automatic (DHCP) addresses only.
Also, I found that ifdown eth0 doesn't work for me. Don't know why not. Probably some network config setting. However ifconfig eth0 down does work.
I am not irrational, I'm just quantum probabilistic.

reinob
Posts: 1196
Joined: 2014-06-30 11:42
Has thanked: 99 times
Been thanked: 47 times

Re: change DNS server

#5 Post by reinob »

ticojohn wrote: Also, I found that ifdown eth0 doesn't work for me. Don't know why not. Probably some network config setting. However ifconfig eth0 down does work.
ifup and ifdown are part of the ifupdown package, which you probably don't have/use, as you seem to be using NetworkManager.

ifconfig is part of net-tools, which is commonly installed (but nowadays it's not considered essential anymore).

ip (/usr/sbin/ip) is the modern replacement of ifconfig, and is part of the iproute2 package, which is installed by default, so instead of "ifconfig eth0 down" you'd do "ip link set eth0 down", etc.

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: change DNS server

#6 Post by ticojohn »

reinob wrote:
ifup and ifdown are part of the ifupdown package, which you probably don't have/use, as you seem to be using NetworkManager.

ifconfig is part of net-tools, which is commonly installed (but nowadays it's not considered essential anymore).

ip (/usr/sbin/ip) is the modern replacement of ifconfig, and is part of the iproute2 package, which is installed by default, so instead of "ifconfig eth0 down" you'd do "ip link set eth0 down", etc.
Thanks for that feedback @reinob. Good to know. I'll mark this post as [SOLVED].
I am not irrational, I'm just quantum probabilistic.

arzgi
Posts: 1194
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: [SOLVED] change DNS server

#7 Post by arzgi »

I was also used to ifconfig, usedt this guide to learn ip

https://p5r.uk/blog/2010/ifconfig-ip-comparison.html

Post Reply