# How to disable resolv.conf updates with dhcpcd 4.x [SOLVED]

## pekster

I'm running dhcpcd 4.0.2 (recently updated from a 2.x version) and am having some problems getting the client to leave my /etc/resolv.conf alone.  I run my own DNS server for my LAN, so dhcpcd should not overwrite my entries in resolv.conf with the ones handed out by upstream DHCP.  I believe I have configured my dhcpcd.conf file correctly to not execute the resolv.conf update script, yet it still gets overwritten each renewal, so perhaps I have missed something.  Any pointers as to what causes this behaviour is welcome.

file: /etc/dhcpcd.conf

```
# dhcpcd-run-hooks uses these options.

option domain_name_servers, domain_name, domain_search, host_name

# Most distros have ntp support.

option ntp_servers

# My custom items

# leave resolv.conf alone, don't touch hostname, NTP settings, or YP config

nohook 20-resolv.conf

nohook 30-hostname

nohook 50-ntp.conf

nohook 50-yp.conf

# Don't use APIPA

noipv4ll

# End of my custom items

```

dir listing of /lib/dhcpcd/dhcpcd-hooks/

```
-rw-r--r-- 1 root root  182 Jan 16 19:42 01-test

-rw-r--r-- 1 root root  133 Jan 16 19:42 10-mtu

-rw-r--r-- 1 root root 2940 Jan 16 22:16 20-resolv.conf

-rw-r--r-- 1 root root  502 Jan 16 22:15 30-hostname

-rw-r--r-- 1 root root 2196 Jan 16 22:15 50-ntp.conf

-rw-r--r-- 1 root root 1116 Jan 16 22:16 50-yp.conf

```

Last edited by pekster on Thu Jan 22, 2009 2:26 pm; edited 1 time in total

----------

## alex.blackbit

try

```
dhcp_eth0="nodns"
```

in /etc/conf.d/net.

----------

## mw007

After reading the file /etc/conf.d/net.example, you should be able to add the following to your /etc/conf.d/net file

```
dhcp_eth0="nodns"
```

Of course you'll need to replace eth0 with your interface name.

The handbook also confirms this: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8#doc_chap2. Scroll down to Code Listing 2.7

To my knowledge, the Gentoo init scripts use command line arguments which will override any configuration file settings for dhcp. I could be wrong on that, though. I'll see if I can find more info and let you know.

Hope that helps!

mw007

----------

## UberLord

Your config should work, but I would use this

```
nohook resolv.conf hostname ntp.conf yp.conf
```

----------

## depontius

 *UberLord wrote:*   

> Your config should work, but I would use this
> 
> ```
> nohook resolv.conf hostname ntp.conf yp.conf
> ```
> ...

 

Where do you put that line?

Last year I tried resolvconf with dhcpcd-3, wasn't happy with the results, and went back to custom scripts.  I use dnsmasq to handle VPNs, internal networks, and the like.  Am I likely to be happier with resolvconf and dhcpcd-4?  (Right now package.mask has >=dhcpcd-4)

----------

## UberLord

 *depontius wrote:*   

>  *UberLord wrote:*   Your config should work, but I would use this
> 
> ```
> nohook resolv.conf hostname ntp.conf yp.conf
> ```
> ...

 

/etc/dhcpcd.conf

 *Quote:*   

> 
> 
> Last year I tried resolvconf with dhcpcd-3, wasn't happy with the results, and went back to custom scripts.  I use dnsmasq to handle VPNs, internal networks, and the like.  Am I likely to be happier with resolvconf and dhcpcd-4?  (Right now package.mask has >=dhcpcd-4)

 

I use it with good success.

Try openresolv-2.x

----------

## pekster

 *alex.blackbit wrote:*   

> try
> 
> ```
> dhcp_eth0="nodns"
> ```
> ...

 

 *UberLord wrote:*   

> Your config should work, but I would use this
> 
> ```
> nohook resolv.conf hostname ntp.conf yp.conf
> ```
> ...

 

Thanks alex.blackbit and UberLord; both of those solutions worked and left resolv.conf alone. I thought I already had nodns in my dhcp options in net.conf, but clearly not.  It's interesting that my original dhcpcd.conf nohook entries didn't work as the manpage seems to suggest that they should.  At any rate I now have a working solution, (two actually!) so thanks for the suggestions.

----------

## UberLord

 *pekster wrote:*   

> t's interesting that my original dhcpcd.conf nohook entries didn't work as the manpage seems to suggest that they should. 

 

It's a bug!

Fixed here

http://roy.marples.name/projects/dhcpcd/changeset/1168

----------

