# No auto generate for /etc/resolv.conf? [SOLVED]

## audiodef

I want to experiment with using Google and OpenDNS. How do I get my system to stop auto-generating /etc/resolv.conf every time /etc/init.d/net.eth0 starts?

----------

## Trog Dog

can't you set what you want in /etc/resolv.conf in /etc/resolv.conf.head?

----------

## audiodef

I just tried that, and what I ended up with was the contents of resolv.conf.head in addition to what net.eth0 added. I don't want net.eth0 to automatically add anything.

----------

## stoffepojken

You can put your name servers in /etc/conf.d/net. I have this for Google and OpenDNS:

dns_servers="8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220"

----------

## audiodef

 *stoffepojken wrote:*   

> You can put your name servers in /etc/conf.d/net. I have this for Google and OpenDNS:
> 
> dns_servers="8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220"

 

I gave that a try, and it didn't work. Perhaps my existing /etc/conf.d/net creates a conflict? I already have this:

```

config_eth0=( "192.168.1.3 netmask 255.255.255.0 brd 192.168.1.255" )

routes_eth0=( "default via 192.168.1.1" )

```

----------

## Hu

OP: that looks like a baselayout-1 syntax.  Are you still using the old initscripts?

----------

## audiodef

I don't know what the "old" init scripts are. I just know that I'm on ~arch and I update once a month, so I'm pretty sure none of my machines are "old".

----------

## cach0rr0

old as in baselayout-1 syntax, instead of baselayout-2/openrc syntax

either way, try:

```

dhcp_eth0="nodns"

```

try that. I *think* that's the syntax for baselayout-2/openrc (which is stable now, removed from ~arch some months ago)

in some cases for whatever reason, bl-2/openrc doesn't upchuck on the old format for /etc/conf.d/net - dont know why, but it doesnt, and I'm not complaining.

----------

## Hu

 *cach0rr0 wrote:*   

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

 That looks right.  I would have said the same earlier, except that the snippet the OP provided shows he is using static addressing for the interface, so setting DHCP options will not have any effect.

----------

## cach0rr0

 *Hu wrote:*   

> That looks right.  I would have said the same earlier, except that the snippet the OP provided shows he is using static addressing for the interface, so setting DHCP options will not have any effect.

 

hrm. you're quite right. wonder if the invalid bl-2 config would default to dhcp (?) or if it would simply fail altogether. 

audiodef: in case you havent already, try dns_servers_eth0="8.8.8.8 8.8.4.4" instead of simply dns_servers="8.8.8.8 8.8.4.4"

without dhcp, nothing should be clobbering resolv.conf. And unless /etc/conf.d/net is set to use dhcp, or there's something else (e.g. wicd, networkmanager, connman) that might fire off dhcp, shouldnt be used. 

I have no great insight otherwise

----------

## audiodef

OK, I think I get it now. I normally set up a new machine with net.* and dhcpcd, not realizing that once you hard-code /etc/conf.d/net, dhcpcd will override resolv.conf. 

Now I see that I just need to stop dhcpcd and remove it from my default run level, leaving only net.eth0, which leaves me with the desired resolv.conf. 

I thank y'all, dudes.   :Very Happy: 

----------

