Ubuntu keeps resetting my DNS settings
I am searching for a solution to the problem of Ubuntu resetting my DNS server settings after reboot.. I have tried sudo chattr +i /etc/resolv.conf
to stop resolv.conf from resetting, however it returns chattr: Operation not supported while reading flags on /etc/resolv.conf
..
I am super new to Linux since I have just installed it, so I need help over here.. Tried many things and broke the resolv.conf so I couldn't set DNS even for the short period before rebooting (it didn't even set DNS)..Anyone got this problem ? Solutions ? Thanks !! (Using Ubuntu MATE 17.04 - Fresh Install)
Saw many questions on here but always ran into some problems :S
Solution 1:
You can try with -f flag with the command as
sudo chattr -f +i /etc/resolv.conf
Solution 2:
What I think you are experiencing is resolvconf modifying your settings.
Check to see if /etc/resolv.conf is a link versus a file. Most likely it is a link as such or similar.
# ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 45 Oct 10 2016 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
You can just delete the link with "sudo rm /etc/resolv.conf" and create the file manually with any text editor via sudo and that should keep your settings to what you want.
# ls -al /etc/resolv.conf
-rw-r--r-- 1 root root 45 Oct 10 2016 /etc/resolv.conf
# cat /etc/resolv.conf
## my simple setup pointing at google then my router.
nameserver 8.8.8.8
nameserver 192.168.1.1
With that said, I'm assuming that you only use a single network setup for this system. On these newer distro's there is a lot going on with NetworkManager, resolvconf and dnsmasq that can bring diverse options for network but most people just one setup a connection that never changes.