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
Which Linux distro are you using? DNS management can really vary between distributions, so knowing that could help find a better approach for you!
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.
I'm using Arch.