# blank resolv.conf after some time

## net

for some time I use a amd64 setup.

```

Linux gentoo-x64-src 3.12.13-gentoo #2 SMP Sun Apr 13 20:59:30 CEST 2014 x86_64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz GenuineIntel GNU/Linux

```

and lose the resolv.conf after some time. It can work for 1 day or 1 week.

It never worked correctly with this or older kernels.

my /etc/conf.d/net is :

```

config_eth0="dhcp"

dhcp_eth0="nontp nonis"

```

when it happen i get:

```

!!! getaddrinfo failed for 'rsync.fr.gentoo.org': [Errno 111] Connection refused

```

and  resolv.conf is empty:

```

gentoo-x64-src ~ # cat /etc/resolv.conf

gentoo-x64-src ~ #

```

to resolve it, i restart the interface:

```

gentoo-x64-src ~ # /etc/init.d/net.eth0 restart

 * Bringing down interface eth0

 *   Stopping dhcpcd on eth0 ...                                                                [ ok ]

 * Bringing up interface eth0

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[21743]: sending commands to master dhcpcd process                                        [ ok ]

 *     received address                                                                         [ ok ]

gentoo-x64-src ~ #

gentoo-x64-src ~ # cat /etc/resolv.conf

# Generated by dhcpcd from eth0

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

domain sk.loc

nameserver 192.168.0.200

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

gentoo-x64-src ~ #

```

The ip is always good

The DHCP server:

```

Linux sk-srv 3.12.13-gentoo #1 Thu Mar 27 22:32:47 CET 2014 i686 Intel(R) Pentium(R) 4 CPU 2.00GHz GenuineIntel GNU/Linux

[ebuild   R    ] net-misc/dhcp-4.2.5_p1-r2  USE="client ldap server ssl -ipv6 (-selinux) -vim-syntax" 

```

Any idea about that ?

----------

## DONAHUE

assuming nameserver 192.168.0.200 is correct

```
echo "nameserver 192.168.0.200" > /etc/resolv.conf.head

echo "nameserver 8.8.8.8" >> /etc/resolv.conf.head
```

or

/etc/conf.d/net:

 *Quote:*   

> dns_servers="192.168.0.200 8.8.8.8"
> 
> config_eth0="dhcp" 
> 
> dhcp_eth0="nontp nonis nodns"

 

may or may not fix the problem since the cause of the erasure is not known.

----------

## net

Good workaround, but I need to make it work  with DNS pushed by the DHCP server.

What can I try to grab more informations:

Network trace, Kernel parameter,.... ?

One more information : It run as VM in a VMware Workstation 10.0.2 on a Windows 8.1 Pro, 64-bit PC

Should move to a ESX farm later

----------

## DONAHUE

dmesg

/var/log/rc.log after enabling logging in /etc/rc.conf

run wireshark or the like on the interface

----------

## queen

 *DONAHUE wrote:*   

> assuming nameserver 192.168.0.200 is correct
> 
> ```
> echo "nameserver 192.168.0.200" > /etc/resolv.conf.head
> 
> ...

 

I have the same problem with /etc/resolv.conf. My workaround is to copy a backup of the nameservers that I have, into /etc/resolv.conf. I don't know why it gets empty.

----------

## net

I found this in the logs:

May  9 21:42:39 gentoo-x64-src dhcpcd[3301]: eth0: IAID 29:4c:d9:c1

May  9 21:42:39 gentoo-x64-src dhcpcd[3301]: eth0: IAID conflicts with one assigned to eth0

May  9 21:42:39 gentoo-x64-src dhcpcd[3301]: eth0: rebinding lease of 192.168.0.103

May  9 21:42:39 gentoo-x64-src dhcpcd[3301]: lo: unsupported interface type 00, falling back to ethernet

May  9 21:42:39 gentoo-x64-src dhcpcd[3301]: lo: IAID 00:00:01:00

May  9 21:42:39 gentoo-x64-src dhcpcd[3301]: lo: needs a clientid to configure

May  9 21:42:42 gentoo-x64-src kernel: [523345.765316] dhcpcd[3301]: segfault at 60a2 ip 00000000004119cf sp 00007fff0a2a2eb0 error 4 in dhcpcd[400000+1d000]

my /etc/conf.d/net file

```

config_eth0="dhcp"

dhcp_eth0="nontp nonis"

```

result of /etc/init.d/net.eth0 restart

```

gentoo-x64-src ~ # /etc/init.d/net.eth0 restart

 * Caching service dependencies ...                                                             [ ok ]

 * Bringing down interface eth0

 *   Caching network module dependencies

need firewalld

 * Bringing up interface eth0

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[24275]: control_open: Connection refused

dhcpcd[24275]: version 6.2.0 starting

dhcpcd[24275]: eth0: waiting for carrier

dhcpcd[24275]: eth0: carrier acquired

dhcpcd[24275]: DUID 00:01:00:01:1a:dd:b9:44:00:0c:29:4c:d9:c1

dhcpcd[24275]: eth0: IAID 29:4c:d9:c1

dhcpcd[24275]: eth0: soliciting a DHCP lease

dhcpcd[24275]: eth0: offered 192.168.0.103 from 192.168.0.200

dhcpcd[24275]: eth0: leased 192.168.0.103 for 300 seconds

dhcpcd[24275]: eth0: adding route to 192.168.0.0/24

dhcpcd[24275]: eth0: adding default route via 192.168.0.254

dhcpcd[24275]: forked to background, child pid 24307                                            [ ok ]

 *     received address 192.168.0.103/24                                                        [ ok ]

```

Any idea ?

----------

## vaxbrat

One thing to note is that the dhcp setup will modify the /etc/resolv.conf file based on "option" records that got put into the lease pool that it manages.  It looks like your dhcp server has an option record for the default route but maybe not ones that set the domain-name nor the dns-name-servers.  That will tend to whack you with a blank resolv.conf file.

Another possible culprit is network-mangler (err, network-manager) but that tends to only rear its ugly head around my Redhat and Fedora boxes.

If your dhcp servers are brain dead, you might try putting something like the following into your /etc/conf.d/net file:

```

dns_domain_eth0="example.com"

dns_servers_eth0="xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy zzz.zzz.zzz.zzz"

dns_search_eth0="example.com"

```

----------

## NeddySeagoon

net,

The following /etc/dhcp/dhcpd.conf covers my wireless segment

```
# wireless 

# lease times from 1 to 4 hours

# option interface-mtu 1492 for PPoE

subnet 192.168.54.0 netmask 255.255.255.0 {

        range 192.168.54.220 192.168.54.239;

        default-lease-time 3600;

        max-lease-time 14400;

        option subnet-mask 255.255.255.0;

        option broadcast-address 192.168.54.255;

        option routers 192.168.54.253;

        option interface-mtu 1492;

        }
```

Globally I have 

```
# we could run unbound and do our own dns but we don't

option domain-name "example.org";

option domain-name-servers 212.23.3.100,212.23.6.100;
```

----------

