What’s the best way to quickly change my DNS settings on Linux?

0
4
Asked By TechWiz123 On

I live in Bangladesh where the internet isn't very reliable. My basic speed is around 2.5 MB/s, but my ISP provides a DNS that lets me access cached servers to significantly speed up certain content. I usually use Cloudflare for its systemwide capabilities, but I want to change my DNS settings quickly without having to manually edit the /etc/resolv.conf file or running into issues with systemd overwriting it. Does this make sense?

2 Answers

Answered By LinuxLover42 On

Which Linux distro are you using? DNS management can really vary between distributions, so knowing that could help find a better approach for you!

TechWiz123 -

I'm using Arch.

Answered By CodeNinja99 On

One somewhat clunky way to do this is to create a simple script, like `~/switchdns.sh`, that toggles your `/etc/resolv.conf` file between two versions. For example, you can use commands like `mv /etc/resolv.conf /etc/resolv.conf.old` to switch it up. It’s a bit of a hacky method, but it could work in a pinch. Just remember to create a backup! There’s probably a more elegant solution out there, though.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.