Re: Fixing /etc/resolv.conf

Richard Adams
2005-07-22T14:25:13Z

On Friday 22 July 2005 03:05, Peter wrote:
> On Thu, 21 Jul 2005 01:38:50 -0600
>
> "Conway S. Smith" <beolach@comcast.net> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Peter H. wrote:
> > > Hi,
> > >
> > > In slackware the file /etc/resolv.conf is updated on every reboot.
> > >
> > > How can I stop that? I tried chattr +i and chmod -w w/o success.
> > >
> > > The reason is that the nameserver address which is put into the file on
>
> every
>
> > > reboot is not the the one I am supposed to use according to the advise
> > >from my broadband ISP.
> > >
> > > Thanks & regards
> >
> > Most likely /etc/resolv.conf is being overwritten by the DHCP client
> > every time you reboot. In Slackware, edit /etc/rc.d/rc.inet1 so that
> > when it runs dhcpcd it uses the option -R, which will prevent dhcpcd
> > from replacing the existing /etc/resolv.conf.
>
> Thanks! It does not work.

When i tryed that option a while ago it worked for me, however you can always
do things in many different ways with linux, simply make a copy
of /etc/resolv.conf and edit it to your needs and rename it something like
resolv.good.
Now place the following in your /etc/rc.d/rc.local file

cp /etc/resolv.good /etc/resolv.conf

rc.local is the last file to be executed which means you now have what you
want.

I ask myself why you get the wrong info everytime from your dhcp server tho.
Surely its better to solve the problem at the root instead of working around
it.

Regards Richard.