Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Override DHCP-provided DNS
Date: Wed, 15 Jun 2011 18:55:29
Message-Id: 4DF8FFB5.3020108@gmail.com
In Reply to: Re: [gentoo-user] Override DHCP-provided DNS by "Juan Diego Tascón"
1 Juan Diego Tascón wrote:
2 > On Wed, Jun 15, 2011 at 9:27 AM, YoYo Siska<yoyo@××××××.sk> wrote:
3 >
4 >> On Wed, Jun 15, 2011 at 04:07:43PM +0200, Florian Philipp wrote:
5 >>
6 >>> Hello list!
7 >>>
8 >>> for some wireless access points, I want to get an IP via DHCP but not
9 >>> use the provided DNS-server (I use an openvpn setup with its own DNS
10 >>> server, domain name, etc.).
11 >>>
12 >>> In /usr/share/doc/openrc-0.8.2-r1/net.example it reads:
13 >>> # Setting name/domain server causes /etc/resolv.conf to be overwritten
14 >>> # Note that if DHCP is used, and you want this to take precedence then
15 >>> # please put -R in your dhcpcd options
16 >>>
17 >>> But dhcpcd does not seem to have a -R option. It does have a --static
18 >>> option, though. While this is good enough for simply setting the DNS
19 >>> server, it does not seem to allow specifying domain names or
20 >>> search-domains (at least it is not shown in the man-page).
21 >>>
22 >>> Please tell me what the proper way is and whether the mention of "-R" is
23 >>> a documentation bug.
24 >>>
25 >>> Thanks in advance,
26 >>> Florian Philipp
27 >>>
28 >> from the man page, this seems to do what you want
29 >> (never tried, i use dhclient and its /etc/dhcp/dhclient.conf):
30 >>
31 >> -C, --nohook script
32 >> Don't run this hook script. Matches full name, or prefixed with 2 numbers optionally ending with .sh.
33 >>
34 >> So to stop dhcpcd from touching your DNS or MTU settings you would do:-
35 >> dhcpcd -C resolv.conf -C mtu eth0
36 >>
37 >>
38 >> yoyo
39 >>
40 >>
41 >>
42 > I use the google dns servers so I created a /etc/resolv.conf file and
43 > set the i attribute on it:
44 >
45 > chattr +i /etc/resolv.conf
46 >
47 > that way it can't be removed or overwritten and you won't have that
48 > problem no matter what dhcp client you are using
49 >
50 >
51 >
52
53 Does this still work?
54
55 config_eth0=( "dhcp" )
56 dhcp_eth0="nodns"
57 dns_servers_eth0="8.8.8.8 8.8.4.4"
58
59 This worked before the openrc update but I guess it still does. Someone
60 speak up if it doesn't.
61
62 Hope that helps.
63
64 Dale
65
66 :-) :-)

Replies

Subject Author
Re: [gentoo-user] Override DHCP-provided DNS Florian Philipp <lists@×××××××××××.net>