0

I'm using Xubuntu 18.04. AFAIK, DNS could be changed with sudo systemd-resolve -i wlp3s0 --set-dns="xxx-yyy-aaa-bbb".
Now, how can I revert it back to the default state? Before setting it, my DNS was set to 192.168.1.1 (or router).

I want to make a script out of these commands so preferably no GUI. Also I'm looking for the most generic and "standardized" way so no CLI front-ends for GUI apps (like nmcli) or the like.
Also it seems, disconnecting from router and reconnecting, sets it to the default state...but I think there should be a better way....

Thanks

1

Have you thought about making a default-resolve.conf file and setting the script to write that default-resolve.conf to resolve.conf whenever you want to reset it.

You could then create a script 'resetdns' which only runs: cp etc/default-resolve.conf etc/resolve.conf

It would probably need to be run with sudo, but that should resolve your problem.

Also, the systemd-resolve main page (https://wiki.archlinux.org/index.php/Systemd-resolved) offers some interesting information, you could add resolvectl status to the end of your 'resetdns' script to have it verify that it's been reset.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.