Change DNS Servers Easily

Moderator: Forum moderators

Post Reply
User avatar
wizard
Posts: 1984
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2648 times
Been thanked: 692 times

Change DNS Servers Easily

Post by wizard »

This utility developed from methods described by @ozsouth and @Trapster in this post:
viewtopic.php?t=13082

A DNS server plays a critical role in connecting your computer to websites. It changes a URL name you type or select in your browser, i.e., Amazon.com, into an IP address the internet understands.

For most users the DNS servers are assigned by the local router (automatic DHCP function). However, changing DNS servers may improve connect speed or security. In Puppy there are several ways to change servers including:

-logging into your router's interface and entering there, then all DHCP clients will use the new DNS
-assign the computer a static IP address and specify the DNS servers there (Network Wizard)
-manually create a /etc/resolv.conf.head file and specify the DNS servers there

Dns-changer.sh uses the third method and provides a GUI to make it quicker and easier

dns-changer.jpg
dns-changer.jpg (6.47 KiB) Viewed 423 times

Dns-changer requires YAD which is included in most Pups or can be installed from the repositories on older versions.

Download dns-changer.sh.gz, remove the .gz (rename)
-right click in Rox
-Permissions
-set as: a+x (Make executable/searchable)
-Yes
then click in Rox.

NOTE: After using dns-changer, you can check what server is being used at https://dnsleaktest.com/ , click "Standard test".

wizard

Attachments
dns-changer.sh.gz
Remove fake .gz before use
(828 Bytes) Downloaded 78 times
Last edited by wizard on Wed Nov 20, 2024 3:03 pm, edited 2 times in total.

Big pile of OLD computers

User avatar
Trapster
Posts: 182
Joined: Sat Aug 01, 2020 7:44 pm
Has thanked: 1 time
Been thanked: 53 times

Re: Change DNS Servers Easily

Post by Trapster »

Nice idea.
It might be handy to show the current nameservers when starting the script.

dogcat
Posts: 265
Joined: Fri Feb 18, 2022 11:14 pm
Has thanked: 73 times
Been thanked: 122 times

Re: Change DNS Servers Easily

Post by dogcat »

Thank You @wizard, I like this utility. It works as advertised :thumbup2:

Just an observation after trying this on 3 different linux versions from this forum.

The DNS changes stick after a reboot on FossaPup64 and FatDog64 when using a save file or save folder.

The changes won't stick after a reboot on BookwormPup64 when using a save file or save folder. That is because Connman defaults to the isp DNS settings when connecting to the internet. It has its configuration file at /etc/Connman/main.conf with a symlinked /etc/resolv.conf file. Changing BookwormPup64 to act differently is beyond the scope of your posting but figured I would mention it for those using BookwormPup64.

Μακάριοι οι καθαροί στην καρδιά * επειδή, θα δουν τον Θεό.

User avatar
wizard
Posts: 1984
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2648 times
Been thanked: 692 times

Re: Change DNS Servers Easily

Post by wizard »

@dogcat

The changes won't stick after a reboot on BookwormPup64 when using a save file or save folder. It has its configuration file at /etc/Connman/main.conf with a symlinked /etc/resolv.conf file

Good catch dc, although do not see the symlink you reference.

Here's a quick fix if you're using Conman in BW64.

Download dns-restart.sh.gz, remove the .gz (rename)
-right click in Rox
-Permissions
-set as: a+x (Make executable/searchable)
-Yes
Then copy into directory: /root/startup

Thanks
wizard

Attachments
dns-restart.sh.gz
Remove fake .gz before use
(167 Bytes) Downloaded 13 times
Last edited by wizard on Tue Nov 19, 2024 10:15 pm, edited 2 times in total.

Big pile of OLD computers

williwaw
Posts: 1948
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 172 times
Been thanked: 369 times

Re: Change DNS Servers Easily

Post by williwaw »

-logging into your router's interface and entering there, then all DHCP clients will use the new DNS

Do DNS setting specified with at the router trump settings specified with this app?

-assign the computer a static IP address and specify the DNS servers there (Network Wizard)

Network Wizard available in Puppy? again, which would trump?

should results be immediate when apply is clicked and the yad comfirmation appears?
(testing on easy with network manager)

interesting project...
https://opennic.org/
https://servers.opennic.org/

and for testing
https://dnsleaktest.com/

User avatar
wizard
Posts: 1984
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2648 times
Been thanked: 692 times

Re: Change DNS Servers Easily

Post by wizard »

@williwaw

Do DNS setting specified with at the router trump settings specified with this app?

No, settings made in the computer are used.
241120 CORRECTION to above, test on additional routers show if STATIC DNS settings are made in the router they can override those in the computer.

Network Wizard available in Puppy? again, which would trump?

Yes, and same as above.

should results be immediate when apply is clicked and the yad comfirmation appears?

Yes

Thanks
wizard

Last edited by wizard on Wed Nov 20, 2024 6:18 pm, edited 4 times in total.

Big pile of OLD computers

User avatar
bigpup
Moderator
Posts: 6993
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 911 times
Been thanked: 1528 times

Re: Change DNS Servers Easily

Post by bigpup »

@wizard

For both of your script files to work.

After removing the fake .gz from the name, so it is script file.

They need to be given exec permission, so they will run when clicked on in Rox file manager.

suggest you add this to the info, on after downloading, how to make them work as an executable script file.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
bigpup
Moderator
Posts: 6993
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 911 times
Been thanked: 1528 times

Re: Change DNS Servers Easily

Post by bigpup »

@wizard

A pet package can be attached to a post, as long as it is no bigger than 537KiB size.

Do you want to make the dns-changer into a pet package, that will install and have a menu entry to run it from?

As a pet package, all that is needed is download, install, and it runs. (names are correct and will have exec permissions)

I can do this for you, if you do not already know how to make a pet package of a program.

All that would be needed is figure out where in the file system to put the script file.
Make .desktop file to make a menu entry.
Figure out where in the menu would be good place for it.
Maybe menu ->Network or ->Internet :idea:

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
wizard
Posts: 1984
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2648 times
Been thanked: 692 times

Re: Change DNS Servers Easily

Post by wizard »

@bigpup

suggest you add this to the info

Done

Do you want to make the dns-changer into a pet package

May do after all the votes are in and if there is more interest, right now only 10 downloads.

Thanks
wizard

Big pile of OLD computers

williwaw
Posts: 1948
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 172 times
Been thanked: 369 times

Re: Change DNS Servers Easily

Post by williwaw »

running easyos which uses networkmanager
rebooted after setting router to accept ISP DNS and comfirmed DNS is with ISP

/etc/resolv.conf.head (as expected with new DNS as configured with dns-changer.sh and recieving a confirmation)

Code: Select all

nameserver 81.169.136.222
nameserver 81.169.136.222

/etc/resolv.conf before running dns-restart.sh

Code: Select all

# Generated by NetworkManager
search lan
nameserver 192.168.8.1
nameserver fd23:87ba:7394:10::1

/etc/resolv.conf after running dns-restart.sh

Code: Select all

# Generated by dhcpcd from wlan0.dhcp
nameserver 81.169.136.222
nameserver 81.169.136.222
domain lan
nameserver 192.168.8.1
# /etc/resolv.conf.tail can replace this line

return in terminal when running dns-restart

Code: Select all

0 /mnt/sda2/portable $ ./dns-restart.sh
killall: dhcpcd: no process killed
no such user dhcpcd
dhcpcd-9.4.1 starting
dev: loaded udev
DUID 00:04:8f:fd:4e:81:51:ee:11:cb:90:77:96:35:db:37:c8:54
wlan0: connected to Access Point: cisco
eth0: waiting for carrier
wlan0: IAID a9:64:3e:78
wlan0: soliciting an IPv6 router
wlan0: rebinding lease of 192.168.8.104
wlan0: probing address 192.168.8.104/24
wlan0: leased 192.168.8.104 for 43200 seconds
wlan0: adding route to 192.168.8.0/24
wlan0: adding default route via 192.168.8.1
forked to background, child pid 11018
0 /mnt/sda2/portable $ 

dns server doesnt change as confirmed with https://dnsleaktest.com/

ozsouth
Posts: 1569
Joined: Sun Jul 12, 2020 2:38 am
Location: S.E. Australia
Has thanked: 241 times
Been thanked: 704 times

Re: Change DNS Servers Easily

Post by ozsouth »

@williwaw - I tested this script with ipv4 - is fine. I see you are using ipv6 - I now see there are different google servers for that:

2001:4860:4860::8888
2001:4860:4860::8844

Check with your ISP - the servers you used look like ipv4 ones.

williwaw
Posts: 1948
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 172 times
Been thanked: 369 times

Re: Change DNS Servers Easily

Post by williwaw »

@ozsouth

ok, I plugged your numbers into dns-changer.sh and resolv.conf.head updated
ran dns-restart.sh and resolv.conf updated to

Code: Select all

# Generated by dhcpcd from wlan0.dhcp, wlan0.ra
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
domain lan
nameserver 192.168.8.1
nameserver fd23:87ba:7394:10::1
# /etc/resolv.conf.tail can replace this line

no change when checking with https://dnsleaktest.com/

commented out nameserver fd23:87ba:7394:10::1 from resolv.conf (thats the ipv6 entry?)
no change when checking with https://dnsleaktest.com/

I disconnected networkmanager and reconnected.
resolv.conf was rewritten to

Code: Select all

# Generated by dhcpcd from wlan0.dhcp
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
domain lan
nameserver 192.168.8.1
# /etc/resolv.conf.tail can replace this line

the commented out line was removed
now after a few minutes, aparently networkmanager is periodically updating resolv.conf. it now reads the same and the once commented out line that was removed is back again

Code: Select all

# Generated by dhcpcd from wlan0.dhcp, wlan0.ra
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
domain lan
nameserver 192.168.8.1
nameserver fd23:87ba:7394:10::1
# /etc/resolv.conf.tail can replace this line

if I use networkmanager to bring up connection information by right clicking on the taskbar icon, it reports
fe80::fe80:ee4e:dfef:cf9a/64
as IPv6

ozsouth
Posts: 1569
Joined: Sun Jul 12, 2020 2:38 am
Location: S.E. Australia
Has thanked: 241 times
Been thanked: 704 times

Re: Change DNS Servers Easily

Post by ozsouth »

@williwaw

running easyos which uses networkmanager . . .

. . . now after a few minutes, aparently networkmanager is periodically updating resolv.conf

I use s15pup64, which has the 'old 3' network choices. Sadly, periodic updating of resolv.conf will defeat this code.
I tried making a loop which would revert settings every minute or so, but that caused other issues.

User avatar
wizard
Posts: 1984
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2648 times
Been thanked: 692 times

Re: Change DNS Servers Easily

Post by wizard »

@williwaw

no change when checking with https://dnsleaktest.com/

Don't understand the significance of checking this as related to changing the DNS servers. Seems it would only apply if you were using a VPN or proxy. It just returns the WAN address of your router, that isn't affected by your DNS server choice.

Thanks
wizard

Big pile of OLD computers

williwaw
Posts: 1948
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 172 times
Been thanked: 369 times

Re: Change DNS Servers Easily

Post by williwaw »

wizard wrote: Wed Nov 20, 2024 3:07 am

@williwaw

no change when checking with https://dnsleaktest.com/

Don't understand the significance of checking this as related to changing the DNS servers. Seems it would only apply if you were using a VPN or proxy. It just returns the WAN address of your router, that isn't affected by your DNS server choice.

Thanks
wizard

it returns a DNS owned by the ISP. The router has had the manual DNS config turned off, and I assume DHCP is automatic. the leaktest site does seem to advertise its self to people who may be using VPNs or proxys.

I have found a few dns servers who also filter malware and blacklist ads, less trouble than a custom hosts or browser addons

Looking further into NetworkManager, apparently there are multiple instructions to be found online as to how to get NetworkManager apply static configs. A number of different attempts have not worked thus far. As I recall, there was a reason I resorted to putting the desired DNS into a manual mode on the router a few years back. As far as I can tell, It trumps any configurations supplied with various pups, other linuxes or Easy

User avatar
wizard
Posts: 1984
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2648 times
Been thanked: 692 times

Re: Change DNS Servers Easily

Post by wizard »

@williwaw

I have found a few dns servers who also filter malware and blacklist ad

Yes, some very useful but they don't change your WAN address. If they did they would be acting as a VPN or Proxy, by definition.

I resorted to putting the desired DNS into a manual mode on the router a few years back. As far as I can tell, It trumps any configurations supplied with various pups, other linuxes or Easy

Just the opposite on my three routers where the DNS settings on the Pup computer are always superior. Don't know for Easy or other Linux.
241120 CORRECTION to above, test on additional routers show if STATIC DNS settings are made in the router they can override those in the computer.

My mistake on using https://dnsleaktest.com/. Was only looking at the home page which shows your WAN address. If you click the "Standard test" button you will now see what DNS server is being used.
Here's an example:

DNS servers before using dns-changer (uses DNS settings in router)

dns-before.jpg
dns-before.jpg (17.58 KiB) Viewed 111 times

DNS servers after using dns-changer set to 1.1.1.1 & 8.8.8.8 (now uses DNS settings in computer)

dns-after.jpg
dns-after.jpg (13.18 KiB) Viewed 111 times

Now that's really useful, will add a note to the first post.

Thanks
wizard

Last edited by wizard on Wed Nov 20, 2024 6:18 pm, edited 1 time in total.

Big pile of OLD computers

User avatar
wizard
Posts: 1984
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2648 times
Been thanked: 692 times

Re: Change DNS Servers Easily

Post by wizard »

@williwaw

Did some more testing on some additional routers and showed if STATIC DNS settings are made in the router they can override those in the computer. Not every case on mine, so probably due to my configuration.

I've gone back and made a clarification correction on affected post.

Thanks
wizard

Big pile of OLD computers

darksun
Posts: 123
Joined: Tue Dec 19, 2023 10:12 am
Location: sitting in front of my terminal
Has thanked: 52 times
Been thanked: 37 times

Re: Change DNS Servers Easily

Post by darksun »

Post Reply

Return to “Network/Server”