LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How can i update the dns server ip on multiple systems (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-update-the-dns-server-ip-on-multiple-systems-4175510581/)

James0806 07-09-2014 09:23 AM

How can i update the dns server ip on multiple systems
 
In a environment of 20 systems i want to update the dns server ip in all the 20 systems what might be done in easy way

szboardstretcher 07-09-2014 09:28 AM

Something like:

Code:

#untested, but should be solid
for i in 192.168.1.{2..10}; do ssh $i "sed -i '1s/^/nameserver 8.8.4.4\n/' resolv.conf"; done

which will ssh to 192.168.1.2 through .10 and add nameserver 8.8.4.4 to the top of resolv.conf in each server.


All times are GMT -5. The time now is 09:34 AM.