# resolv.conf question



## Nikosis (Jun 8, 2009)

Is there any other way, than change flag, to prevent resolv.conf from being overwritten constantly. Is there something like 
DHCP_KEEPRESOLV[0]="yes"


----------



## DutchDaemon (Jun 8, 2009)

dhclient(8)
dhclient.conf(5)
Look at supersede, prepend and append options in the latter.

Example:

```
prepend domain-name-servers 127.0.0.1;
```


----------



## rocky (Jun 9, 2009)

Nikosis said:
			
		

> Is there any other way, than change flag, to prevent resolv.conf from being overwritten constantly. Is there something like
> DHCP_KEEPRESOLV[0]="yes"



Below my `dhclient.conf`. Please note that the file `resolv.conf` is still rewritten each time you call `dhclient`, but the response from DHCP server is "superseded" here.


```
interface "ndis0" {
  supersede domain-name-servers 127.0.0.1; 
}
interface "re0" {
  supersede domain-name-servers 127.0.0.1;
}
```


----------



## SirDice (Jun 9, 2009)

Create a file called /etc/dhclient-enter-hooks and put this in there:

```
add_new_resolv_conf() {
        # We don't want /etc/resolv.conf changed
        # So this is an empty function
        return 0
}
```

That will prevent dhclient from overwriting /etc/resolv.conf.


----------



## rocky (Jun 9, 2009)

That's great, SirDice!


----------



## Nikosis (Jun 11, 2009)

I'm not sure what's going on now, but after 3 min nothing works, no internet, terminal doesn't react to anything, even after I logout from kde, any command doesn't work and there is nothing I can do but restart the system. and then I have another 3 min.


----------



## SirDice (Jun 11, 2009)

Is the 3 min. consistent with your DHCP lease time?

Do you have a firewall running? You must make sure the DHCP messages are allowed through.


----------



## Nikosis (Jun 11, 2009)

I haven't change anything in firewall, so everything should be fine.
It's a fresh install.
It started to happen when I changed flags to immutable, but problem remains even after I changed that back.


----------

