Le 22 mai à 06:57:59 Walter Dnes <[EMAIL PROTECTED]> a écrit notamment:

> On Sat, May 21, 2005 at 12:35:45PM +0200, Jean Magnan de Bornier wrote
>
>> I want to execute "ln -sf /etc/resolv.conf.fac /etc/resolv.conf" *before*
>> /etc/init.d/net.eth0, so that if I am at the "fac" (my office) location I
>> have these dns set up, but if I am home with dhcp the resolv.conf
>> file will be overwritten. 
>> Should I add a script in /etc/init.d for that, or is there something simpler?
>> cheers,
>
>   I don't think that you can get it done *BEFORE* net.eth0 is run. 
> Gentoo needs to run net.eth0 to set up the network connection.  Then it
> has to query ifconfig to find out what the situation is.  I think what
> you need is to correct resolv.conf if you are at the office.  The
> official Gentoo way to do this would be an init script.  I recommend the
> following...
>
>   1) If "local" is not already in the default runlevel, execute...
>
>      etc-update add local default
>
>
>   2) In /etc/conf.d/local.start add the following lines
>
> if ifconfig eth0 | grep 194\.199\.136\.151 > /dev/null ; then
>   cp /etc/resolv.conf.fac /etc/resolv.conf
> fi
>
>   *IMPORTANT*.  You must *COPY* /etc/resolv.conf.fac.  If you symlink it
> to /etc/resolv.conf, then the next time dhcp overwrites /etc/resolv.conf
> it will be overwriting /etc/resolv.conf.fac

Thanks a lot Walter; this is exactly what I needed.
I made a test without any internet connection, and the eth0 address as
well as the /etc/resolv.conf file had the right (office) values, coming
back with my home dhcp connection eveything's OK.
I appreciate your help, 
-- 
Jean Magnan de Bornier          |       email: jean-at-bornier.net
 

-- 
gentoo-user@gentoo.org mailing list

Reply via email to