LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   resolv.conf in ubuntu server? (https://www.linuxquestions.org/questions/linux-networking-3/resolv-conf-in-ubuntu-server-4175435567/)

aleksnikolic 11-04-2012 09:48 AM

resolv.conf in ubuntu server?
 
Hi guys,

I am trying statically to set DNS servers in my ubuntu server running as virtual machine. I followed all recommendations on official ubuntu support pages but I simply cannot get rid of my ISP's DNS servers set by DHCP.

I assigned br0 interface on my host machine static IP address and eth0 on VM to use google DNS and my own local DNS running on the second vm by setting it in the /etc/network/interfaces. Tried to fiddle with head base and tail files in resolvconfd directory and tried to shuffle interfaces order in the same directory but simply when I restarted network service ISP DNSes got back everytime.

Is there a way so I can stop resolvconf(8) and set up my resolv.conf file manually as I always did on Red Hat? Or at least how can I find which hook script keeps putting ISP DNSs in resolv.conf? My ISP don't allow me to change DHCP settings on my router so I cannot do it that way.

Why is such a simple thing such as setting DNS servers got so complicated???

acid_kewpie 11-05-2012 03:46 AM

looks simple (yet long winded) to override the hook script... http://www.cyberciti.biz/faq/dhclien...olvconf-hooks/

root@linux 11-12-2012 07:01 AM

this is because dhcp server automatically overwrites the resolv.conf file on each boot. you may lock the file resolv.conf by chattr +i command...

add your details in that file and enter this command as root
Code:

chattr +i resolv.conf

acid_kewpie 11-12-2012 07:15 AM

Quote:

Originally Posted by root@linux (Post 4827536)
this is because dhcp server automatically overwrites the resolv.conf file on each boot. you may lock the file resolv.conf by chattr +i command...

add your details in that file and enter this command as root
Code:

chattr +i resolv.conf

I'd *REALLY* urge the OP to use a proper solution here, and not making files immutable.

DutchGeek 11-12-2012 05:14 PM

If you want to know what modified your /etc/resolv.conf maybe you can use monitoring software like audit?
www.cyberciti.biz/tips/tag/audit-daemon

Another option, why not use a router? This way only the router worries about DHCP and you can set your server to use a static IP in your "LAN".


All times are GMT -5. The time now is 07:26 AM.