# dhcpcd alway seems to overwrite /etc/resolv.conf - [SOLVED]

## cwall64

I have a DNS server running inside of my home network that i would always like to hit first (hardware router doesn't allow for passing any extra variables in dhcp), so I would like for dhcpcd not to overwrite /etc/resolv.conf.  I have tried many things in /etc/conf.d/net (this is the current state which doesn't work!):

 *Quote:*   

> 
> 
> station-b ~ # cat /etc/conf.d/net
> 
> # This blank configuration will automatically use DHCP for any net.*
> ...

 

All I want is for this to stay:

 *Quote:*   

> 
> 
> station-b ~ # cat /etc/resolv.conf
> 
> nameserver 192.168.1.250
> ...

 

I have gotten dhcpcd to work on ArchLinux with a simple "DHCPCD_ARGS="-R -t 30 -h $HOSTNAME"" and Debian is just as easy with the ISC DHCP client.  I am about ready to try dhclient on this gentoo box!  Any suggestions first?Last edited by cwall64 on Fri Aug 03, 2007 11:05 pm; edited 1 time in total

----------

## Rob1n

What does your /etc/resolv.conf currently end up as?

----------

## cwall64

 *Rob1n wrote:*   

> What does your /etc/resolv.conf currently end up as?

 

 *Quote:*   

> 
> 
> station-b ~ # ls -l /etc/resolv.conf
> 
> -rw-r--r-- 1 root root 23 Aug  3  2007 /etc/resolv.conf
> ...

 

----------

## NeddySeagoon

cwall64,

```
dhcp_eth0="release nodns nontp nonis" 
```

says you don't want dhcp to provide a nameserver in /etc/resolv.conf.

Remove the nodns

----------

## cwall64

 *NeddySeagoon wrote:*   

> cwall64,
> 
> ```
> dhcp_eth0="release nodns nontp nonis" 
> ```
> ...

 

But i do not want DNS to be populated by DHCP.  I want to hard code my dns servers in to the resolv.conf manually and not have it overwriten.  And currently it does overwrite the hand coded values with the one (192.168.1.1) from the dhcp server, so it is doing the exact opposite...Last edited by cwall64 on Fri Aug 03, 2007 3:11 pm; edited 1 time in total

----------

## Rob1n

Hmm, very odd - it all looks to be set up properly.  You could try settings things on lo rather than eth0 - not sure whether this works or not:

```

dns_domain_lo="chris-wall.local" 

dns_servers_lo="192.168.1.250 192.168.1.1" 

dns_search_lo="chris-wall.local"

```

You could also try using resolvconf - I've not really played around with this but it allows you to do various amounts of fiddling with how /etc/resolv.conf is generated.

----------

## cwall64

 *Rob1n wrote:*   

> Hmm, very odd - it all looks to be set up properly.  You could try settings things on lo rather than eth0 - not sure whether this works or not:
> 
> ```
> 
> dns_domain_lo="chris-wall.local" 
> ...

 

Good idea, but that didn't work either.  Also tried no device as the net.example file says " If you omit the _eth0 suffix, then it applies to all interfaces unless overridden by the interface suffix."  I will try and dig up info on resolvconf-gentoo!

----------

## cwall64

Not necessarily a fix but installing net-misc/dhcp fixed the problem!

So:

```

emerge -av net-misc/dhcp

then change the entry in /etc/conf.d/net for modules to modules=( "dhclient" ) from modules=( "dhcpcd" ).

then create a /etc/dhcp/dhclient.conf file:

send host-name "intel2800.chris-wall.local";

supersede domain-name "chris-wall.local hsd1.tx.comcast.net.";

prepend domain-name-servers 192.168.1.250;

```

----------

## cwall64

to wrap this thread up it turns out that I change the configuration back to dhcpcd and it still didn't work after dhclient did - but then I started turning services off to see if that made a difference and of coarse it did!  It looks like the avahi-* daemons conflicted with the configurations.  With both avahi- daemons off, either dhcpcd or dhclient worked for me - meaning that I could manually put the dns_servers_eth0="X.X.X.X" and dns_search_eth0="X.X.X.X" in the /etc/conf.d/net file and it would successfully create them in /etc/resolv.conf!  Thanks for the help!!!

----------

