# [SOLVED] /etc/resolv.conf problem

## queen

Hello Everyone

Since yesterday I have a problem that the contents of /etc/resolv.conf is erased and therefore I am dissconnected from the internet. I have a modem-router siemens and I connect via wifi. 

Here is how it looks like before 

```
more /etc/resolv.conf

# Generated by dhcpcd

# /etc/resolv.conf.head can replace this line

# /etc/resolv.conf.tail can replace this line

```

 and after copying a backup file I get this

```
more /etc/resolv.conf

# Generated by dhcpcd from eth2

# /etc/resolv.conf.head can replace this line

search siemens

nameserver 10.0.0.138

# /etc/resolv.conf.tail can replace this line

```

First, why it is happening. 2nd, how can I solve this problem. I haven't done anything special. my mtu is 1500 for wifi, the same as the router. 

The content of the file is erased every few minutes.Last edited by queen on Mon Dec 15, 2008 6:37 am; edited 1 time in total

----------

## Raniz

If it happens every few minutes it's probably when the lease refreshes since your dhcp client will rewrite resolv.conf with the information from the previous dhcp request.

You can solve this in two ways, either you check why your router isn't giving you any DNS information or you tell your dhcp client to not overwrite resolv.conf and use your backup. The first solution is of course the best one.

----------

## queen

 *Raniz wrote:*   

> If it happens every few minutes it's probably when the lease refreshes since your dhcp client will rewrite resolv.conf with the information from the previous dhcp request.
> 
> You can solve this in two ways, either you check why your router isn't giving you any DNS information or you tell your dhcp client to not overwrite resolv.conf and use your backup. The first solution is of course the best one.

 

Until I figure out why the router isn't giving dns, how do I arrange the 2nd part?

----------

## Hu

Setting the nodns option for that interface should suppress changes to /etc/resolv.conf.  See /etc/conf.d/net.example for details.

----------

## queen

 *Hu wrote:*   

> Setting the nodns option for that interface should suppress changes to /etc/resolv.conf.  See /etc/conf.d/net.example for details.

 

I had nodns set. 

So, the problem is probably in other place.

----------

## Raniz

You can try forcing DNS settings for that interface.

```
dns_domain_eth0="your.domain"

dns_servers_eth0="192.168.0.2 192.168.0.3"

dns_search_eth0="this.domain that.domain"
```

----------

## queen

 *Raniz wrote:*   

> You can try forcing DNS settings for that interface.
> 
> ```
> dns_domain_eth0="your.domain"
> 
> ...

 

will try this option. But from what I see it disregards 

```
/etc/conf.d/net
```

The reason for my remark is because I have mtu as 2200 (wifi) in  

```
/etc/conf.d/net
```

 , but when I check ifconfig -a (after dhcpcd ), I see that mtu is 1500 and not 2200. Is there other file that overwrites  

```
/etc/conf.d/net
```

 ?

----------

## Raniz

MTU is negotiated when establishing the connection with the other end. If the other end cannot handle an MTU of 2200 they will negotiate another MTU (most likely 1500 since that's the default).

----------

## UberLord

You didn't say which dhcpcd version has the error. Try dhcpcd-4.0.7

----------

## queen

 *UberLord wrote:*   

> You didn't say which dhcpcd version has the error. Try dhcpcd-4.0.7

 

[I] net-misc/dhcpcd

     Available versions:  3.0.16-r1 3.1.5-r1 3.2.3 ~4.0.0 4.0.1-r1 4.0.2 ~4.0.3 ~4.0.4 ~4.0.5 ~4.0.6 ~4.0.7 [M]~4.99.5 [M]~4.99.6 {compat vram zeroconf}

     Installed versions:  4.0.2(08:21:05 PM 10/12/2008)(compat zeroconf)

will try 4.0.7. Appears unstable in my portage, but I will upgrade.

----------

## queen

The problem was solved. I discovered there was from time to time a low signal from the router which caused lots of connections, disconnections.

----------

