View previous topic :: View next topic |
Author |
Message |
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Tue Aug 05, 2008 10:05 pm Post subject: PBM: dhcpcd periodically overwrites /etc/resolv.conf |
|
|
Hi.
I think dhcpcd interacts with pptpclient in that it overwites /etc/resolv.conf periodically (probably each time it renews the lease from the local network). This creates a side effect when I'm running a VPN client with option usepeerdns. Actually I'm using pon to start my VPN client... because I've always done that way.
Is there a way to have dhcpcd and pptp VPN coexist nicely? Will it do the trick if I move my VPN definitions into /etc/conf.d/net?
Thanks in advance. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
geowapa n00b
Joined: 08 Sep 2004 Posts: 50
|
Posted: Wed Aug 06, 2008 2:33 am Post subject: |
|
|
You can change dhcpcd parameters in the network definition by including the following line into the /etc/conf.d/net configuration:
dhcpcd_eth<n>=""
Add the following:
-R, --nodns
Don't send DNS information to resolvconf or touch /etc/resolv.conf.
For example, to cause eth2 to
- wait 10 seconds for DHCP
- Don't touch NTP configuration
- Don't touch DNS config
- Don't use IPv4 local addressing (169.x.x.x addresses)
include:
dhcpcd_eth2="-t 10 -N -R -L" |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Wed Aug 06, 2008 7:49 am Post subject: |
|
|
geowapa wrote: | You can change dhcpcd parameters in the network definition by including the following line into the /etc/conf.d/net configuration:
dhcpcd_eth<n>=""
Add the following:
-R, --nodns
Don't send DNS information to resolvconf or touch /etc/resolv.conf.[...] |
Yes, I know that but (I didn't say) my computer is a laptop so I need the DNS server information gathered from DHCP when I roam around different sites and networks. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Wed Aug 06, 2008 9:28 am Post subject: |
|
|
UberLord wrote: | Sounds sounds you need resolvconf - more specifically, openresolv. Find it in a portage near you |
Oh, great, I remember we've already talked about resolvconf. At that time it gave me a hard time but it's an excellent opportunity to tell it who's the master . _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Fri Aug 08, 2008 11:11 pm Post subject: |
|
|
UberLord wrote: | With my help we can make it your willing slave |
Rhoooo... _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Sun Aug 10, 2008 3:35 pm Post subject: |
|
|
I've installed openresolv and I've seen it immediately adds remote name server addresses when I start a new VPN connection, which is perfect. However it doesn't seem to remove them when I close the connection, is it normal? I haven't changed nor added any custom script or variable, perhaps should I? _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Mon Aug 11, 2008 12:17 pm Post subject: |
|
|
UberLord wrote: | Does "resolvconf -l" still list the VPN resolv.conf? |
Yes, it does. But I realize now that once I rebooted everything went to normal. Now openresolv removes the entries it added for the remote nameservers once the VPN connection is over. Great tool, thanks .
(Maybe it messed up a little since I installed it while my network link was already active. I suppose it had to somewhat «learn» about my existing networks, right?) _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Mon Aug 11, 2008 12:22 pm Post subject: |
|
|
Well I'm just curious as to know how openresolv intercepts changes made to the flat file. It looks like it can be done with only a single shell script, does it? _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
depontius Advocate
Joined: 05 May 2004 Posts: 3526
|
Posted: Mon Aug 11, 2008 12:49 pm Post subject: |
|
|
Extra question about openresolv...
Do VPN applications have to be "openresolv aware" in order for openresolv to work?
I tried resolvconf a while back, and for some reason it never worked for me. As a result, I've been using dnsmasq and some of my own scripts to do what resolvconf was supposed to do. I haven't tried openresolv yet, but it seems like a good idea, for a rainy day.
In the meantime, my employer has migrated us to a different VPN, and this one doesn't give me the ability to hook my own scripts in, like the old one did. If openresolv can do its magic without a hook from the VPN side, maybe it's now the easier solution to my problems. _________________ .sigs waste space and bandwidth |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Mon Aug 11, 2008 1:02 pm Post subject: |
|
|
depontius wrote: | Do VPN applications have to be "openresolv aware" in order for openresolv to work? |
No, it just works . I've checked it right now -- or a couple of minutes ago as you can see. Note that openresolv is different from resolvconf-gentoo. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Tue Aug 12, 2008 8:37 am Post subject: |
|
|
They both work the same way, openresolv just has less bugs.
Things do have to be resolvconf aware though - it's like this.
Code: |
interface="eth0"
conf="nameserver 1.2.3.4\n"
if type resolvconf >/dev/null 2>/dev/null; then
printf "${conf}" | resolvconf -a "${interface}"
else
printf "${conf}" >/etc/resolv.conf
fi |
You get the idea.
Most things in Gentoo "just work" with resolvconf though, which is why you get that impression _________________ Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Tue Aug 12, 2008 9:08 am Post subject: |
|
|
I suppose the code you wrote is pseudo-code or something like that. And since you also wrote dhcpcd, it's naturally aware of resolvconf. Is net-dialup/ppp also aware of resolvconf the same way?
EDIT: Found the answer! through ip-up and ip-down scripts. Well, it's just as if all developers of network utilities were one... _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Tue Aug 12, 2008 11:39 am Post subject: |
|
|
VinzC wrote: | I suppose the code you wrote is pseudo-code or something like that. |
shell code
Quote: | And since you also wrote dhcpcd, it's naturally aware of resolvconf. Is net-dialup/ppp also aware of resolvconf the same way?
EDIT: Found the answer! through ip-up and ip-down scripts. Well, it's just as if all developers of network utilities were one... |
And that is why open is good
Sadly closed products don't normally allow scripting like so, and cannot work with resolvconf. Well, they could, but it's not in their interests. _________________ Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool |
|
Back to top |
|
|
|