public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Override DHCP-provided DNS
@ 2011-06-15 14:07 Florian Philipp
  2011-06-15 14:27 ` YoYo Siska
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Philipp @ 2011-06-15 14:07 UTC (permalink / raw
  To: Gentoo User List

[-- Attachment #1: Type: text/plain, Size: 832 bytes --]

Hello list!

for some wireless access points, I want to get an IP via DHCP but not
use the provided DNS-server (I use an openvpn setup with its own DNS
server, domain name, etc.).

In /usr/share/doc/openrc-0.8.2-r1/net.example it reads:
# Setting name/domain server causes /etc/resolv.conf to be overwritten
# Note that if DHCP is used, and you want this to take precedence then
# please put -R in your dhcpcd options

But dhcpcd does not seem to have a -R option. It does have a --static
option, though. While this is good enough for simply setting the DNS
server, it does not seem to allow specifying domain names or
search-domains (at least it is not shown in the man-page).

Please tell me what the proper way is and whether the mention of "-R" is
a documentation bug.

Thanks in advance,
Florian Philipp


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Override DHCP-provided DNS
  2011-06-15 14:07 [gentoo-user] Override DHCP-provided DNS Florian Philipp
@ 2011-06-15 14:27 ` YoYo Siska
  2011-06-15 15:40   ` Juan Diego Tascón
  0 siblings, 1 reply; 5+ messages in thread
From: YoYo Siska @ 2011-06-15 14:27 UTC (permalink / raw
  To: gentoo-user

On Wed, Jun 15, 2011 at 04:07:43PM +0200, Florian Philipp wrote:
> Hello list!
> 
> for some wireless access points, I want to get an IP via DHCP but not
> use the provided DNS-server (I use an openvpn setup with its own DNS
> server, domain name, etc.).
> 
> In /usr/share/doc/openrc-0.8.2-r1/net.example it reads:
> # Setting name/domain server causes /etc/resolv.conf to be overwritten
> # Note that if DHCP is used, and you want this to take precedence then
> # please put -R in your dhcpcd options
> 
> But dhcpcd does not seem to have a -R option. It does have a --static
> option, though. While this is good enough for simply setting the DNS
> server, it does not seem to allow specifying domain names or
> search-domains (at least it is not shown in the man-page).
> 
> Please tell me what the proper way is and whether the mention of "-R" is
> a documentation bug.
> 
> Thanks in advance,
> Florian Philipp

from the man page, this seems to do  what you want
(never tried, i use dhclient and its /etc/dhcp/dhclient.conf):

     -C, --nohook script
	     Don't run this hook script.  Matches full name, or prefixed with 2 numbers optionally ending with .sh.

	     So to stop dhcpcd from touching your DNS or MTU settings you would do:-
		   dhcpcd -C resolv.conf -C mtu eth0


 yoyo



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Override DHCP-provided DNS
  2011-06-15 14:27 ` YoYo Siska
@ 2011-06-15 15:40   ` Juan Diego Tascón
  2011-06-15 18:53     ` Dale
  0 siblings, 1 reply; 5+ messages in thread
From: Juan Diego Tascón @ 2011-06-15 15:40 UTC (permalink / raw
  To: gentoo-user

On Wed, Jun 15, 2011 at 9:27 AM, YoYo Siska <yoyo@gl.ksp.sk> wrote:
> On Wed, Jun 15, 2011 at 04:07:43PM +0200, Florian Philipp wrote:
>> Hello list!
>>
>> for some wireless access points, I want to get an IP via DHCP but not
>> use the provided DNS-server (I use an openvpn setup with its own DNS
>> server, domain name, etc.).
>>
>> In /usr/share/doc/openrc-0.8.2-r1/net.example it reads:
>> # Setting name/domain server causes /etc/resolv.conf to be overwritten
>> # Note that if DHCP is used, and you want this to take precedence then
>> # please put -R in your dhcpcd options
>>
>> But dhcpcd does not seem to have a -R option. It does have a --static
>> option, though. While this is good enough for simply setting the DNS
>> server, it does not seem to allow specifying domain names or
>> search-domains (at least it is not shown in the man-page).
>>
>> Please tell me what the proper way is and whether the mention of "-R" is
>> a documentation bug.
>>
>> Thanks in advance,
>> Florian Philipp
>
> from the man page, this seems to do  what you want
> (never tried, i use dhclient and its /etc/dhcp/dhclient.conf):
>
>     -C, --nohook script
>             Don't run this hook script.  Matches full name, or prefixed with 2 numbers optionally ending with .sh.
>
>             So to stop dhcpcd from touching your DNS or MTU settings you would do:-
>                   dhcpcd -C resolv.conf -C mtu eth0
>
>
>  yoyo
>
>

I use the google dns servers so I created a /etc/resolv.conf file and
set the i attribute on it:

chattr +i /etc/resolv.conf

that way it can't be removed or overwritten and you won't have that
problem no matter what dhcp client you are using



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Override DHCP-provided DNS
  2011-06-15 15:40   ` Juan Diego Tascón
@ 2011-06-15 18:53     ` Dale
  2011-06-15 19:21       ` Florian Philipp
  0 siblings, 1 reply; 5+ messages in thread
From: Dale @ 2011-06-15 18:53 UTC (permalink / raw
  To: gentoo-user

Juan Diego Tascón wrote:
> On Wed, Jun 15, 2011 at 9:27 AM, YoYo Siska<yoyo@gl.ksp.sk>  wrote:
>    
>> On Wed, Jun 15, 2011 at 04:07:43PM +0200, Florian Philipp wrote:
>>      
>>> Hello list!
>>>
>>> for some wireless access points, I want to get an IP via DHCP but not
>>> use the provided DNS-server (I use an openvpn setup with its own DNS
>>> server, domain name, etc.).
>>>
>>> In /usr/share/doc/openrc-0.8.2-r1/net.example it reads:
>>> # Setting name/domain server causes /etc/resolv.conf to be overwritten
>>> # Note that if DHCP is used, and you want this to take precedence then
>>> # please put -R in your dhcpcd options
>>>
>>> But dhcpcd does not seem to have a -R option. It does have a --static
>>> option, though. While this is good enough for simply setting the DNS
>>> server, it does not seem to allow specifying domain names or
>>> search-domains (at least it is not shown in the man-page).
>>>
>>> Please tell me what the proper way is and whether the mention of "-R" is
>>> a documentation bug.
>>>
>>> Thanks in advance,
>>> Florian Philipp
>>>        
>> from the man page, this seems to do  what you want
>> (never tried, i use dhclient and its /etc/dhcp/dhclient.conf):
>>
>>      -C, --nohook script
>>              Don't run this hook script.  Matches full name, or prefixed with 2 numbers optionally ending with .sh.
>>
>>              So to stop dhcpcd from touching your DNS or MTU settings you would do:-
>>                    dhcpcd -C resolv.conf -C mtu eth0
>>
>>
>>   yoyo
>>
>>
>>      
> I use the google dns servers so I created a /etc/resolv.conf file and
> set the i attribute on it:
>
> chattr +i /etc/resolv.conf
>
> that way it can't be removed or overwritten and you won't have that
> problem no matter what dhcp client you are using
>
>
>    

Does this still work?

config_eth0=( "dhcp" )
dhcp_eth0="nodns"
dns_servers_eth0="8.8.8.8 8.8.4.4"

This worked before the openrc update but I guess it still does.  Someone 
speak up if it doesn't.

Hope that helps.

Dale

:-)  :-)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] Override DHCP-provided DNS
  2011-06-15 18:53     ` Dale
@ 2011-06-15 19:21       ` Florian Philipp
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Philipp @ 2011-06-15 19:21 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1885 bytes --]

Am 15.06.2011 20:53, schrieb Dale:
> Juan Diego Tascón wrote:
>> On Wed, Jun 15, 2011 at 9:27 AM, YoYo Siska<yoyo@gl.ksp.sk>  wrote:
>>   
>>> On Wed, Jun 15, 2011 at 04:07:43PM +0200, Florian Philipp wrote:
>>>     
>>>> Hello list!
>>>>
>>>> for some wireless access points, I want to get an IP via DHCP but not
>>>> use the provided DNS-server (I use an openvpn setup with its own DNS
>>>> server, domain name, etc.).
>>>>
>>>> In /usr/share/doc/openrc-0.8.2-r1/net.example it reads:
>>>> # Setting name/domain server causes /etc/resolv.conf to be overwritten
>>>> # Note that if DHCP is used, and you want this to take precedence then
>>>> # please put -R in your dhcpcd options
>>>>
>>>> But dhcpcd does not seem to have a -R option. It does have a --static
>>>> option, though. While this is good enough for simply setting the DNS
>>>> server, it does not seem to allow specifying domain names or
>>>> search-domains (at least it is not shown in the man-page).
>>>>
>>>> Please tell me what the proper way is and whether the mention of
>>>> "-R" is
>>>> a documentation bug.
>>>>
[...]
>>>
>>>              So to stop dhcpcd from touching your DNS or MTU settings
>>> you would do:-
>>>                    dhcpcd -C resolv.conf -C mtu eth0
>>>
[...]
>>
>> I use the google dns servers so I created a /etc/resolv.conf file and
>> set the i attribute on it:
>>
>> chattr +i /etc/resolv.conf
>>
>> that way it can't be removed or overwritten and you won't have that
>> problem no matter what dhcp client you are using
>>
[...]
> dhcp_eth0="nodns"

A, great. That's exactly what I was looking for. Wonder why I overlooked
it. Probably because I searched the example file for DNS and dns. -.-

Thanks for all the proposals! I guess I stick with the nodns option. The
others aren't bad to know, either.

Regards,
Florian Philipp


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-15 19:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 14:07 [gentoo-user] Override DHCP-provided DNS Florian Philipp
2011-06-15 14:27 ` YoYo Siska
2011-06-15 15:40   ` Juan Diego Tascón
2011-06-15 18:53     ` Dale
2011-06-15 19:21       ` Florian Philipp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox