how to stop dhcp from messing with resolve.conf during boot

Issues related to configuring your network
Post Reply
km4hr
Posts: 60
Joined: 2005/03/16 19:12:47

how to stop dhcp from messing with resolve.conf during boot

Post by km4hr » 2005/03/17 17:22:01

I'm not sure what I'm talking about but I'll try.

My computer is finding the wrong domain(?) when it boots. I don't understand why but my company uses two dns servers, one for Windows and another for everything else. (or something like that. I'm in a Linux-hostile IT environment so I don't ask a lot of questions). Anyway, when I boot my centos 4 pc it puts the wrong domain name in resolv.conf. I have to edit resolv.conf after boot for dns to work. For example, immediately after booting the computer I have a line like this in resolv.conf:

search ab.cde.com

I have to change the line to:

search cde.com

I've remove all write privileges from resolv.conf but it gets overwritten during boot anyway. I've set the correct domain in the Gnome network config screen but that doesn't make any difference.

So the question is, how can I get the "correct" line into resolv.conf during booting.

xyz

arrfab
Site Admin
Posts: 870
Joined: 2005/01/03 21:30:54
Location: /country/belgium
Contact:

how to stop dhcp from messing with resolve.conf during boot

Post by arrfab » 2005/03/17 21:28:12

Is your computer connected to a Microsoft network ? I mean do you get your IP Address from a Windows W2K or W2K3 server ?
Because it's the DHCP server that gives you the domain name (option 15) so you have to see with your network admin ...
It seems (as explained in your domain : domain.com and sub.domain.com) that your company is assigning several dns search scopes (it's possible to have a primary domain search for Windows computers obtained by the dhcp server and receive others suffix search through Group Policy ).
Anyway, you can modify your /etc/rc.d/rc.local to reflect the domain you want to search ( echo search domain.com >> /etc/rc.local) : it will add the domain you want in your resolv.conf and you'll be able to resolve host.domain.com and/or host.subdomain.com ... I know this workaround is stupid, but why not ? (i like the KISS concept : Keep It Stupid and Simple) :-D

km4hr
Posts: 60
Joined: 2005/03/16 19:12:47

Re: how to stop dhcp from messing with resolve.conf during boot

Post by km4hr » 2005/03/18 16:34:08

Thanks arrfab,

Your solution works fine! I think you meant to say:

echo search domain.com >> /etc/resolv.conf

instead of:

echo search domain.com >> /etc/rc.local

thanks again,
David

arrfab
Site Admin
Posts: 870
Joined: 2005/01/03 21:30:54
Location: /country/belgium
Contact:

Re: how to stop dhcp from messing with resolve.conf during boot

Post by arrfab » 2005/03/18 18:17:18

Oups, right, i forgot to read my message before posting .... :-D
But i'm happy this workaround works for you , and that you've found the mistake in my post ... :-D

Post Reply