public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] DHCPCD and nameserver
@ 2010-08-21  6:16 Dale
  2010-08-21  8:16 ` Jorge Almeida
  0 siblings, 1 reply; 6+ messages in thread
From: Dale @ 2010-08-21  6:16 UTC (permalink / raw
  To: Gentoo User

Hi folks,

I'm trying to get my nameserver setting to stick in resolv.conf when I 
restart the network or reboot.  Layman will not work with my ISP's DNS 
server for some crazy reason.  Anyway, I have this in /etc/conf.d/net file:

modules="dhcpcd"
config_eth2="dhcp"
dns_servers_eth2="nameserver 8.8.8.8 nameserver 8.8.4.4"

As you can see I need it set to 8.8.8.8 but it doesn't seem to see my 
setting.  After I restart my network, it updates resolv.conf to this:

root@smoker / # cat /etc/resolv.conf
# Generated by dhcpcd from eth2
# /etc/resolv.conf.head can replace this line
nameserver 192.168.1.254
# /etc/resolv.conf.tail can replace this line
root@smoker / #

I have read some example files and I think I have it set correctly but 
maybe something moved or I am missing something else.

Ideas?   Thanks.

Dale

:-)  :-)



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

* Re: [gentoo-user] DHCPCD and nameserver
  2010-08-21  6:16 [gentoo-user] DHCPCD and nameserver Dale
@ 2010-08-21  8:16 ` Jorge Almeida
  2010-08-21  8:26   ` Dale
  2010-08-21  9:30   ` Marc Joliet
  0 siblings, 2 replies; 6+ messages in thread
From: Jorge Almeida @ 2010-08-21  8:16 UTC (permalink / raw
  To: gentoo-user

>
> I'm trying to get my nameserver setting to stick in resolv.conf when I
> restart the network or reboot.  Layman will not work with my ISP's DNS
> server for some crazy reason.  Anyway, I have this in /etc/conf.d/net file:
>

Dale,
if I understood correctly, you want to set the contents of
/etc/resolv.conf and don't want dhcp to overwrite ir. Right?

> modules="dhcpcd"
> config_eth2="dhcp"
> dns_servers_eth2="nameserver 8.8.8.8 nameserver 8.8.4.4"
>
> As you can see I need it set to 8.8.8.8 but it doesn't seem to see my
> setting.  After I restart my network, it updates resolv.conf to this:
>

I don't know about dhcpcd, but I'm using dhclient, and it works like this:
$cat /etc/resolv.conf
config_eth0=("dhcp")
modules_eth0=("dhclient")
dhcp_eth0="nodns"

I'm not sure the last line is necessary.
Then:

$ cat /etc/dhcp/dhclient.conf
append option domain-name-servers 127.0.0.1

Substitute 127.0.0.1 by 8.8.8.8

HTH

Jorge



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

* Re: [gentoo-user] DHCPCD and nameserver
  2010-08-21  8:16 ` Jorge Almeida
@ 2010-08-21  8:26   ` Dale
  2010-08-21  8:50     ` Jorge Almeida
  2010-08-21  9:30   ` Marc Joliet
  1 sibling, 1 reply; 6+ messages in thread
From: Dale @ 2010-08-21  8:26 UTC (permalink / raw
  To: gentoo-user

Jorge Almeida wrote:
>> I'm trying to get my nameserver setting to stick in resolv.conf when I
>> restart the network or reboot.  Layman will not work with my ISP's DNS
>> server for some crazy reason.  Anyway, I have this in /etc/conf.d/net file:
>>
>>      
> Dale,
> if I understood correctly, you want to set the contents of
> /etc/resolv.conf and don't want dhcp to overwrite ir. Right?
>    

Yep, that is what I want.  DHCP just keeps overriding my file.

>    
>> modules="dhcpcd"
>> config_eth2="dhcp"
>> dns_servers_eth2="nameserver 8.8.8.8 nameserver 8.8.4.4"
>>
>> As you can see I need it set to 8.8.8.8 but it doesn't seem to see my
>> setting.  After I restart my network, it updates resolv.conf to this:
>>
>>      
> I don't know about dhcpcd, but I'm using dhclient, and it works like this:
> $cat /etc/resolv.conf
> config_eth0=("dhcp")
> modules_eth0=("dhclient")
> dhcp_eth0="nodns"
>
> I'm not sure the last line is necessary.
> Then:
>
> $ cat /etc/dhcp/dhclient.conf
> append option domain-name-servers 127.0.0.1
>
> Substitute 127.0.0.1 by 8.8.8.8
>
> HTH
>
> Jorge
>    

I kept playing with this because I did it once before and knew it could 
be done.  I did finally figure out how to get it to work.  It appears 
the syntax has changed a little bit.  This is what I ended up with after 
some trial and error, maybe a little tooth pulling too.  ;-)  This is my 
net file:

modules="dhcpcd"
config_eth2="dhcp"
dhcp_eth2="nodns"
dns_servers_eth2="8.8.8.8 8.8.4.4"

Now I get this in resolv.conf:

root@smoker / # cat /etc/resolv.conf
# Generated by net-scripts for interface eth2
nameserver 8.8.8.8
nameserver 8.8.4.4

root@smoker / #

So, it's working now.  It's not quite the same config as last time but 
it works.

Thanks.

Dale

:-)  :-)



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

* Re: [gentoo-user] DHCPCD and nameserver
  2010-08-21  8:26   ` Dale
@ 2010-08-21  8:50     ` Jorge Almeida
  0 siblings, 0 replies; 6+ messages in thread
From: Jorge Almeida @ 2010-08-21  8:50 UTC (permalink / raw
  To: gentoo-user

On Sat, Aug 21, 2010 at 9:25 AM, Dale <rdalek1967@gmail.com> wrote:

>> I don't know about dhcpcd, but I'm using dhclient, and it works like this:
>> $cat /etc/resolv.conf

Oops... It was "cat /etc/conf.d/net"...

>> config_eth0=("dhcp")
>> modules_eth0=("dhclient")
>> dhcp_eth0="nodns"
>>


>
> I kept playing with this because I did it once before and knew it could be
> done.  I did finally figure out how to get it to work.  It appears the
> syntax has changed a little bit.  This is what I ended up with after some
> trial and error, maybe a little tooth pulling too.  ;-)  This is my net
> file:
>
> modules="dhcpcd"
> config_eth2="dhcp"
> dhcp_eth2="nodns"
> dns_servers_eth2="8.8.8.8 8.8.4.4"
>
> Now I get this in resolv.conf:
>
> root@smoker / # cat /etc/resolv.conf
> # Generated by net-scripts for interface eth2
> nameserver 8.8.8.8
> nameserver 8.8.4.4
>
> root@smoker / #
>
> So, it's working now.  It's not quite the same config as last time but it
> works.
>
OK, now I know how to do it also with dhcpcd.
Cheers.

Jorge



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

* Re: [gentoo-user] DHCPCD and nameserver
  2010-08-21  8:16 ` Jorge Almeida
  2010-08-21  8:26   ` Dale
@ 2010-08-21  9:30   ` Marc Joliet
  2010-08-21 22:24     ` Dale
  1 sibling, 1 reply; 6+ messages in thread
From: Marc Joliet @ 2010-08-21  9:30 UTC (permalink / raw
  To: Gentoo-User ML

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

Am Sat, 21 Aug 2010 09:15:26 +0059
schrieb Jorge Almeida <jjalmeida@gmail.com>:

[...]
> I don't know about dhcpcd, but I'm using dhclient, and it works like this:
> $cat /etc/resolv.conf
> config_eth0=("dhcp")
> modules_eth0=("dhclient")
> dhcp_eth0="nodns"
> 
> I'm not sure the last line is necessary.
> Then:
> 
> $ cat /etc/dhcp/dhclient.conf
> append option domain-name-servers 127.0.0.1
> 
> Substitute 127.0.0.1 by 8.8.8.8

With dhcpcd you can do something similar. When I was setting up dnsmasq on my
system I found out you can create hooks for dhcpcd; for instance,
in /etc/dhcpcd.enter-hook I have (well, now "had"):

	# Prepend localhost to the list of DNS servers
	new_domain_name_servers="127.0.0.1 ${new_domain_name_servers}"

The resulting resolv.conf:

    marcec marcec # cat /etc/resolv.conf
    # Generated by dhcpcd from eth0
    # /etc/resolv.conf.head can replace this line
    search huntemann.uni-oldenburg.de
    nameserver 127.0.0.1
    nameserver 192.168.0.250
    # /etc/resolv.conf.tail can replace this line

However, the comments in resolv.conf indicate you you can create one or both of
/etc/resolv.conf.{head,tail}, which will be merged into /etc/resolv.conf
automatically! The resulting resolv.conf:

    marcec marcec # cat /etc/resolv.conf
    # Generated by dhcpcd from eth0
    # force localhost as first nameserver
    nameserver 127.0.0.1
    search huntemann.uni-oldenburg.de
    nameserver 192.168.0.250
    # /etc/resolv.conf.tail can replace this line

So both methods are slighly different. I think I'll stick with the latter now,
as I think it's more correct. However, I'm not sure whether this works with
other DHCP clients or just for dhcpcd.

> HTH
>
> Jorge

HTH
--
Marc Joliet
--
Lt. Frank Drebin: "It's true what they say: cops and women don't mix. Like
eating a spoonful of Drāno; sure, it'll clean you out, but it'll leave you
hollow inside."

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [gentoo-user] DHCPCD and nameserver
  2010-08-21  9:30   ` Marc Joliet
@ 2010-08-21 22:24     ` Dale
  0 siblings, 0 replies; 6+ messages in thread
From: Dale @ 2010-08-21 22:24 UTC (permalink / raw
  To: gentoo-user

Marc Joliet wrote:
> Am Sat, 21 Aug 2010 09:15:26 +0059
> schrieb Jorge Almeida<jjalmeida@gmail.com>:
>
> [...]
>    
>> I don't know about dhcpcd, but I'm using dhclient, and it works like this:
>> $cat /etc/resolv.conf
>> config_eth0=("dhcp")
>> modules_eth0=("dhclient")
>> dhcp_eth0="nodns"
>>
>> I'm not sure the last line is necessary.
>> Then:
>>
>> $ cat /etc/dhcp/dhclient.conf
>> append option domain-name-servers 127.0.0.1
>>
>> Substitute 127.0.0.1 by 8.8.8.8
>>      
> With dhcpcd you can do something similar. When I was setting up dnsmasq on my
> system I found out you can create hooks for dhcpcd; for instance,
> in /etc/dhcpcd.enter-hook I have (well, now "had"):
>
> 	# Prepend localhost to the list of DNS servers
> 	new_domain_name_servers="127.0.0.1 ${new_domain_name_servers}"
>
> The resulting resolv.conf:
>
>      marcec marcec # cat /etc/resolv.conf
>      # Generated by dhcpcd from eth0
>      # /etc/resolv.conf.head can replace this line
>      search huntemann.uni-oldenburg.de
>      nameserver 127.0.0.1
>      nameserver 192.168.0.250
>      # /etc/resolv.conf.tail can replace this line
>
> However, the comments in resolv.conf indicate you you can create one or both of
> /etc/resolv.conf.{head,tail}, which will be merged into /etc/resolv.conf
> automatically! The resulting resolv.conf:
>
>      marcec marcec # cat /etc/resolv.conf
>      # Generated by dhcpcd from eth0
>      # force localhost as first nameserver
>      nameserver 127.0.0.1
>      search huntemann.uni-oldenburg.de
>      nameserver 192.168.0.250
>      # /etc/resolv.conf.tail can replace this line
>
> So both methods are slighly different. I think I'll stick with the latter now,
> as I think it's more correct. However, I'm not sure whether this works with
> other DHCP clients or just for dhcpcd.
>
>    
>> HTH
>>
>> Jorge
>>      
> HTH
> --
> Marc Joliet
> --
> Lt. Frank Drebin: "It's true what they say: cops and women don't mix. Like
> eating a spoonful of Drāno; sure, it'll clean you out, but it'll leave you
> hollow inside."
>    

I read about the head/tail files but wasn't sure what they did or how it 
worked.  I need new glasses so I can see better.  I spend more time 
trying to read than being able to understand what I read.  -_- <<==  
That would be eyes closed.

I guess I could have created a head file and just put my prefs on top.  
Thing is, I just removed the overlays so now I don't even need this.  
lol  Then again, those are faster than my ISPs servers.  Still better off.

Thanks for the info.  I learned something.

Dale

:-)  :-)



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

end of thread, other threads:[~2010-08-21 22:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-21  6:16 [gentoo-user] DHCPCD and nameserver Dale
2010-08-21  8:16 ` Jorge Almeida
2010-08-21  8:26   ` Dale
2010-08-21  8:50     ` Jorge Almeida
2010-08-21  9:30   ` Marc Joliet
2010-08-21 22:24     ` Dale

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