Dear all,
I have a fedora 11 running on virtualbox (host windows 7) and I have a
problem with the resolv.conf being overwritten by dhclient-script even
though I have a static ip in my network configuration and dhcpd is not
active.
I tried already to use the dhclient-exit-hooks to overload
make_resolv_conf function, but it didn't work and the only way I have to
make it working is to enable the NetworkManager service where I specify
all the parameters I need.
My point is, why the script is executed if there's no trace of using
dhcp (obviously to my knowledge)?
Thanks a lot in advance,
Al
--
Alessandro Basili
CERN, PH/UGC
Hardware Designer
|
|
0
|
|
|
|
Reply
|
Alessandro
|
10/14/2010 3:06:23 PM |
|
Alessandro Basili <alessandro.basili@cern.ch> wrote:
> Dear all,
> I have a fedora 11 running on virtualbox (host windows 7) and I have a
> problem with the resolv.conf being overwritten by dhclient-script even
> though I have a static ip in my network configuration and dhcpd is not
> active.
> I tried already to use the dhclient-exit-hooks to overload
> make_resolv_conf function, but it didn't work and the only way I have to
> make it working is to enable the NetworkManager service where I specify
> all the parameters I need.
>
> My point is, why the script is executed if there's no trace of using
> dhcp (obviously to my knowledge)?
> Thanks a lot in advance,
>
> Al
>
The exit hooks only get invoked when dhclient-script exits, via
exit_with_hooks. By that time, /etc/resolv.conf has been changed.
Try dhclient-enter-hooks, it gets sourced *before* dhclient-script does
anything. Just define make_resolv_conf a dummy function.
You could also turn off dhcp for the interface, but not being a Fedora
user, I have no idea how.
Jerry
|
|
0
|
|
|
|
Reply
|
Jerry
|
10/14/2010 8:06:07 PM
|
|
On Thu, 14 Oct 2010 17:06:23 +0200, Alessandro Basili wrote:
> Dear all,
> I have a fedora 11 running on virtualbox (host windows 7) and I have a
> problem with the resolv.conf being overwritten by dhclient-script even
> though I have a static ip in my network configuration and dhcpd is not
> active.
My recommendation:
o stop the network
o delete all network interfaces
o create a new interface for internet access
Be sure to set it Manual/Static set your gateway and DNS ip addressed.
o Restart the network
|
|
0
|
|
|
|
Reply
|
Bit
|
10/14/2010 9:00:05 PM
|
|
At Thu, 14 Oct 2010 20:06:07 +0000 (UTC) Jerry Peters <jerry@example.invalid> wrote:
>
> Alessandro Basili <alessandro.basili@cern.ch> wrote:
> > Dear all,
> > I have a fedora 11 running on virtualbox (host windows 7) and I have a
> > problem with the resolv.conf being overwritten by dhclient-script even
> > though I have a static ip in my network configuration and dhcpd is not
> > active.
> > I tried already to use the dhclient-exit-hooks to overload
> > make_resolv_conf function, but it didn't work and the only way I have to
> > make it working is to enable the NetworkManager service where I specify
> > all the parameters I need.
> >
> > My point is, why the script is executed if there's no trace of using
> > dhcp (obviously to my knowledge)?
> > Thanks a lot in advance,
> >
> > Al
> >
>
> The exit hooks only get invoked when dhclient-script exits, via
> exit_with_hooks. By that time, /etc/resolv.conf has been changed.
>
> Try dhclient-enter-hooks, it gets sourced *before* dhclient-script does
> anything. Just define make_resolv_conf a dummy function.
>
> You could also turn off dhcp for the interface, but not being a Fedora
> user, I have no idea how.
The OP should read:
/usr/share/doc/initscripts-<mumble>/sysconfig.txt:
Under the /etc/sysconfig/network-scripts/ifcfg-<interface-name> section:
PEERDNS=yes|no
modify /etc/resolv.conf if peer uses msdns extension (PPP only) or
DNS{1,2} are set, or if using dhclient. default to "yes".
The OP wants to set PEERDNS=no.
>
> Jerry
>
--
Robert Heller -- 978-544-6933 / heller@deepsoft.com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments
|
|
0
|
|
|
|
Reply
|
Robert
|
10/14/2010 9:01:52 PM
|
|
On 2010-10-14, Bit Twister <BitTwister@mouse-potato.com> wrote:
> On Thu, 14 Oct 2010 17:06:23 +0200, Alessandro Basili wrote:
>> Dear all,
>> I have a fedora 11 running on virtualbox (host windows 7) and I have a
>> problem with the resolv.conf being overwritten by dhclient-script even
>> though I have a static ip in my network configuration and dhcpd is not
>> active.
>
> My recommendation:
> o stop the network
> o delete all network interfaces
> o create a new interface for internet access
> Be sure to set it Manual/Static set your gateway and DNS ip addressed.
> o Restart the network
Assuming your systems' networks are brought up at boot and stay
up until shutdown, one (not-very-civilized) solution is to edit
/etc/rc.d/rc.local to cat what you _DO_ want in /etc/resolv.conf
there. Here's a doctored snippet of my rc.local:
echo "Attempting to fix resolv.conf"
cat >! /etc/resolv.conf <<EOF
# This is my resolv.conf.
nameserver 127.0.0.1
nameserver ...
nameserver ...
search localnet
EOF
echo "Apparently succeeded at fixing resolv.conf"
--
Robert Riches
spamtrap42@jacob21819.net
(Yes, that is one of my email addresses.)
|
|
0
|
|
|
|
Reply
|
Robert
|
10/15/2010 3:21:00 AM
|
|
On 10/14/2010 11:01 PM, Robert Heller wrote:
> The OP should read:
>
> /usr/share/doc/initscripts-<mumble>/sysconfig.txt:
>
> Under the /etc/sysconfig/network-scripts/ifcfg-<interface-name> section:
>
> PEERDNS=yes|no
> modify /etc/resolv.conf if peer uses msdns extension (PPP only) or
> DNS{1,2} are set, or if using dhclient. default to "yes".
>
> The OP wants to set PEERDNS=no.
>
Thanks for the suggestions, meanwhile I realized that my needs are
slightly different. I use my wired connection at work and my wireless
one at home, that's why I have configured virtualbox to start with one
adapter (bridged mode) at work and another one (NAT) at home.
Since the hardware emulated is different I can configure two network
interfaces (eth1/2) and depending on which one is detected at boot I can
have a different configuration.
Indeed I believe the proper way is to let resolv.conf been overwritten
by the network-scripts in order to have always a coherent configuration
which depends on the interface.
So after I tried PEERDNS=no, I set it to "yes" again since when I'm home
I will need DNS which is different from the one at work, meantime I
edited the second network interface script (ifcfg-eth2) in order to have
both DNS and DOMAIN accordingly.
at the moment they read:
> DEVICE=eth1
> BOOTPROTO=dhcp
> TYPE=Ethernet
> HWADDR=08:00:27:BB:37:ED
> NM_CONTROLLED=no
> ONBOOT=yes
> USERCTL=no
> IPV6INIT=no
> NAME="System eth1"
> UUID=9c92fad9-6ecb-3e6c-eb4d-8a47c6f50c04
> PEERDNS=yes
> PEERROUTES=yes
and
> DEVICE=eth2
> ONBOOT=yes
> BOOTPROTO=none
> TYPE=Ethernet
> NM_CONTROLLED=no
> USERCTL=no
> NEEDHOSTNAME=yes
> IPV6INIT=no
>
> IPADDR=137.138.189.250
> NETMASK=255.255.0.0
> DNS2=137.138.17.5
> GATEWAY=137.138.189.193
> DNS1=137.138.16.5
> PREFIX=16
> NAME="System eth2"
> UUID=3a73717e-65ab-93e8-b518-24f5af32dc0d
> DOMAIN=cern.ch
I haven't checked what will happen when I connect at work, but I believe
it will work.
If you have any concerns or pitfalls in this approach I would be happy
to discuss them.
Al
|
|
0
|
|
|
|
Reply
|
Alessandro
|
10/15/2010 10:11:04 AM
|
|
On 10/15/2010 5:21 AM, Robert Riches wrote:
> Assuming your systems' networks are brought up at boot and stay
> up until shutdown, one (not-very-civilized) solution is to edit
> /etc/rc.d/rc.local to cat what you _DO_ want in /etc/resolv.conf
> there. Here's a doctored snippet of my rc.local:
>
> echo "Attempting to fix resolv.conf"
> cat>! /etc/resolv.conf<<EOF
> # This is my resolv.conf.
> nameserver 127.0.0.1
> nameserver ...
> nameserver ...
> search localnet
> EOF
> echo "Apparently succeeded at fixing resolv.conf"
>
Thanks for the suggestion, I would prefer to understand why I had that
problem rather than finding a "patch" which will temporarily fix it
until something else jumps in and invalidates the solution.
I appreciate your idea, but it's something that doesn't fit my way of
fixing problems :-)
|
|
0
|
|
|
|
Reply
|
Alessandro
|
10/15/2010 10:32:43 AM
|
|
Robert Riches wrote:
> Assuming your systems' networks are brought up at boot and stay
> up until shutdown, one (not-very-civilized) solution is to edit
> /etc/rc.d/rc.local to cat what you _DO_ want in /etc/resolv.conf
> there. Here's a doctored snippet of my rc.local:
>
> echo "Attempting to fix resolv.conf"
> cat >! /etc/resolv.conf <<EOF
> # This is my resolv.conf.
> nameserver 127.0.0.1
> nameserver ...
> nameserver ...
> search localnet
> EOF
> echo "Apparently succeeded at fixing resolv.conf"
An even less civilized solution is to set the "imutable" flag
on /etc/resolv.conf , works fine on my box :)
|
|
0
|
|
|
|
Reply
|
Harald
|
10/15/2010 1:44:25 PM
|
|
On Fri, 15 Oct 2010 12:32:43 +0200, Alessandro Basili wrote:
> Thanks for the suggestion, I would prefer to understand why I had that
> problem rather than finding a "patch" which will temporarily fix it
What you may find out, is the last nic to come up will determine the
network configuration.
I have not looked at Redhat's network scripts in quite a while but it
used to have nic config files in two places. Try doing a locate eth0
to find fallback configuration file directory.
Your exit script might run when eth0 startup failed, dinking up your
wireless setting. I assume you tested arguments/variables in your
script to figure out what you need to do with resolv.conf.
|
|
0
|
|
|
|
Reply
|
Bit
|
10/15/2010 2:39:12 PM
|
|
On 10/15/2010 4:39 PM, Bit Twister wrote:
> What you may find out, is the last nic to come up will determine the
> network configuration.
>
Since my nics are software emulated (I'm running on virtualbox), I can
selectively select which configuration I want to have each time (no need
to have both interfaces running at the same time).
> I have not looked at Redhat's network scripts in quite a while but it
> used to have nic config files in two places. Try doing a locate eth0
> to find fallback configuration file directory.
>
I have the following:
/etc/sysconfig/networking/profiles/default/ifcfg-eth1
/etc/sysconfig/networking/devices/ifcfg-eth1
/etc/sysconfig/network-scripts/ifcfg-eth1
Which one is used? What will happen if I modify only one of them?
> Your exit script might run when eth0 startup failed, dinking up your
> wireless setting. I assume you tested arguments/variables in your
> script to figure out what you need to do with resolv.conf.
I abandoned the idea of "enter/exit" hooks, at least for now.
|
|
0
|
|
|
|
Reply
|
Alessandro
|
10/18/2010 9:20:28 AM
|
|
On Mon, 18 Oct 2010 11:20:28 +0200, Alessandro Basili wrote:
>>
> Since my nics are software emulated (I'm running on virtualbox), I can
> selectively select which configuration I want to have each time (no need
> to have both interfaces running at the same time).
It was just a warning, eth1 could overwrite eth0 dns settings. :(
Or, maybe, in your case, left over eth0 content not overwritten by
eth1 settings.
The network script gets a list of ifcfg-eth* files, sources each, then
decides what to do with it.
>> I have not looked at Redhat's network scripts in quite a while but it
>> used to have nic config files in two places. Try doing a locate eth0
>> to find fallback configuration file directory.
>>
> I have the following:
>
> /etc/sysconfig/networking/profiles/default/ifcfg-eth1
> /etc/sysconfig/networking/devices/ifcfg-eth1
> /etc/sysconfig/network-scripts/ifcfg-eth1
Yep, that is why I had made the suggestion of deleting the nic.
Hopefully, that would delete all three.
Then using the gui interface you could set which dns values you wanted.
> Which one is used?
I can not say without going through the scripts. I run Mandriva Linux,
a RedHat/fedora spinoff, and we have the feature of different profile
selection during boot. No idea if Fedora has the same feature.
> What will happen if I modify only one of them?
Going to depend on which one is used, when.
When in this situation, I create a hold/ directory, copy file into hold,
then modify file and test. I can always copy hold/ file back when needed.
Why use a hold directory, you ask.
I have seen scripts look for ifcfg-eth* which would pick up something
like ifcfg-eth1.backup :(
Also ascii editor may leave a backup copy which may be used last, overwriting
your change. :(
Example:
ifcfg-eth1
ifcfg-eth1~
be sure to delete ifcfg-eth1~
|
|
0
|
|
|
|
Reply
|
Bit
|
10/18/2010 1:23:47 PM
|
|
|
10 Replies
472 Views
(page loaded in 0.123 seconds)
|