LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 11-04-2012, 09:48 AM   #1
aleksnikolic
LQ Newbie
 
Registered: Nov 2012
Posts: 1

Rep: Reputation: Disabled
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???
 
Old 11-05-2012, 03:46 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,345

Rep: Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945
looks simple (yet long winded) to override the hook script... http://www.cyberciti.biz/faq/dhclien...olvconf-hooks/
 
2 members found this post helpful.
Old 11-12-2012, 07:01 AM   #3
root@linux
LQ Newbie
 
Registered: Aug 2011
Location: Pakistan
Distribution: Ubuntu
Posts: 11

Rep: Reputation: Disabled
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
 
Old 11-12-2012, 07:15 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,345

Rep: Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945
Quote:
Originally Posted by root@linux View Post
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.
 
Old 11-12-2012, 05:14 PM   #5
DutchGeek
Member
 
Registered: Sep 2006
Distribution: SuSE, Slackware
Posts: 51

Rep: Reputation: 4
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".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] resolv.conf - dns server outdated gene292 Linux - Networking 3 09-12-2011 11:41 AM
[SOLVED] resolv.conf was edited, server stopped serving websites davecox Linux - Server 4 02-22-2010 10:02 AM
resolv.conf changes automatically in Ubuntu ahmed_as8 Linux - Newbie 3 05-08-2009 07:00 AM
Cento OS 4.4 server with no resolv.conf? YAOMK Linux - Server 3 12-03-2007 08:54 AM
dns server and /etc/resolv.conf freeosfreesoul Linux - Laptop and Netbook 2 09-02-2005 06:45 PM


All times are GMT -5. The time now is 03:06 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration