utorok 28. novembra 2023

How to protect /etc/resolv.conf after reboot? (use the chattr command)

 How to protect /etc/resolv.conf after reboot? 





Once upon a time I had a problem with DNS configuration. Every reboot, the file /etc/resolv.conf was rewrite to from Network Manager. 


How to repair? 


We can use chattr command. 





so: 


lsattr - list of atributes 


chattr +i /etc/resolv.conf


-- after this option, the file not will be overwritten. 


In linux console: 


1) vi /etc/resolv.conf


# DNS server


nameserver 8.8.8.8

nameserver 8.8.4.4


2) chattr +i /etc/resolv.conf


3) reboot the server 





-- after reboot: 



[root@openstackstudy ~]# cat /etc/resolv.conf

# Generated by NetworkManager

nameserver 8.8.8.8

nameserver 8.8.4.4




Žiadne komentáre:

Zverejnenie komentára