Skip to content

Instantly share code, notes, and snippets.

@k0nsl
Created July 28, 2020 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k0nsl/412e5782462aceefd649a5040be9bff4 to your computer and use it in GitHub Desktop.
Save k0nsl/412e5782462aceefd649a5040be9bff4 to your computer and use it in GitHub Desktop.
A sort of "set and forget" type of operation in order to not have your resolv.conf overwritten; uses two Danish resolvers (unicast and anycast respectively). Can be run once or placed in "/etc/cron.hourly" as "keep-resolvconf" -- remember to make it executable too. That is all.
#!/bin/sh
## this file can live in /etc/cron.hourly as "keep-resolvers".
sudo chattr -i /etc/resolv.conf
sudo chattr -e /etc/resolv.conf
sudo rm -f /etc/resolv.conf
sudo touch /etc/resolv.conf.tmp
sudo echo "nameserver 91.239.100.100" >> /etc/resolv.conf.tmp
sudo echo "nameserver 89.233.43.71" >> /etc/resolv.conf.tmp
sudo cp /etc/resolv.conf.tmp /etc/resolv.conf
sudo chattr +i /etc/resolv.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment