# dhcpd doesn't create resolv.conf

## musv

Hi,

I'm trying to connect my notebook (client) to the internet through my desktop computer (server). 

On the desktop computer is running a pdsnd for caching and filtering dns an and dhcpd. I receive an IP on my notebook but the resolv.conf on the notebook is only created when I boot the notebook and it's always empty. dhclient eth0 on the notebook or /etc/init.d/net.eth0 also doesn't write anything to the resolv.conf

On the server:

```

ddns-update-style interim;

option domain-name "csn.tu-chemnitz.de hrz.tu-chemnitz.de informatik.tu-chemnit$

option domain-name-servers 192.168.0.1;

default-lease-time 43200;

max-lease-time 86400;

authoritative;

log-facility local7;

subnet 192.168.0.0 netmask 255.255.255.0 {

  range 192.168.0.2 192.168.0.254;

  option broadcast-address 192.168.0.255;

  option routers 192.168.0.1;

  host Fehlermelder {

        hardware ethernet 00:08:74:9A:33:DB;

        fixed-address 192.168.0.250;

  }

}

subnet 192.168.1.0 netmask 255.255.255.0 {

  range 192.168.1.2 192.168.1.254;

  option broadcast-address 192.168.1.255;

  option routers 192.168.1.1;

}

```

On the client (= Fehlermelder)

```

hotplug_eth0="no"

hotplug_ath0="yes"

config_eth0=( "dhcp" )

dhcp_eth0=""

```

When I restart the network on the client I receive an IP, I can ping to the server and to external ip-addesses, I can mount and export nfs drives. But I don't receive any data for /etc/resolv.conf.

----------

## UberLord

Do you have resolvconf-gentoo installed? If so, did you emerge --config resolvconf-gentoo ?

----------

## musv

Thx, I installed it now on my client and it works. I didn't know about this package. Can you explain why is it necessary? Because if I receive my external IP on my server I don't need it. 

And another thing (sorry for combining theses threads):

Client:

```

# Generated by resolvconf

search csn.tu-chemnitz.de hrz.tu-chemnitz.de informatik.tu-chemnitz.de

nameserver 127.0.0.1

```

How can I change 127.0.0.1 to a different IP?

Server:

```

global {

        perm_cache=8192;

        cache_dir="/var/cache/pdnsd";

       run_as="pdnsd";

        server_ip = any;       # Use eth0 here if you want to allow other

                                # machines on your network to query pdnsd.

        status_ctl = on;

#       paranoid=on;

#       query_method=tcp_udp;   # pdnsd must be compiled with tcp

                                # query support for this to work.

        min_ttl=15m;       # Retain cached entries at least 15 minutes.

        max_ttl=1w;        # One week.

        timeout=10;        # Global timeout option (10 seconds).

}

# The following section is most appropriate for fixed connections to the Intern$

server {

        label= "CSN-DNS";

        ip = 134.109.102.249,134.109.102.1;  # Put your ISP's DNS-server addres$

        proxy_only=on;     # Do not query any name servers beside your ISP's.

        timeout=4;         # Server timeout; this may be much shorter

                           # that the global timeout option.

        uptest=if;

        interface=eth0;

        interval=10m;      # Check every 10 minutes.

        purge_cache=off;   # Keep stale cache entries in case the ISP's

                           # DNS servers go offline.

}

```

server_ip works with 127.0.0.1, and any on the server. But the client always receives 127.0.0.1. When I write 192.168.0.1 or my external IP to the server_ip it doesn't work anymore.

----------

## UberLord

 *musv wrote:*   

> Thx, I installed it now on my client and it works. I didn't know about this package. Can you explain why is it necessary? Because if I receive my external IP on my server I don't need it.

 

You don't need it, but if you have it installed it the dhcp clients assume it has been configured correctly.

 *Quote:*   

> 
> 
> And another thing (sorry for combining theses threads):
> 
> Client:
> ...

 

Simple, don't define a local resolver

If you have nameserver 127.0.0.1 then it means you're offloading local dns from libc to something more powerful. I use dnsmasq myself on my laptop.

 *Quote:*   

> 
> 
> server_ip works with 127.0.0.1, and any on the server. But the client always receives 127.0.0.1. When I write 192.168.0.1 or my external IP to the server_ip it doesn't work anymore.

 

Well, post your /etc/conf.d/net config then.

No client should ever receive 127.0.0.1, but may force it locally which is probably the case.

----------

## musv

 *UberLord wrote:*   

> Well, post your /etc/conf.d/net config then.

 

dhcpd.conf (Server) and /etc/conf.d/net (client) are the ones from my first post. 

Searching the net I found this one:

http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg396160.html

Ok, the posted patch only touches the init-script and resolvconf on Debian but maybe it's the same problem. 

Strange for me is the behaviour of dhcpd. Why does the entry 

```
option domain-name-servers 192.168.0.1;
```

exist, if I receive on the client only 

```
nameserver 127.0.0.1
```

?

dhcpd is really strange in some things. Maybe I'll switch to dnsmasq.

----------

## musv

Ok, I deinstalled pdnsd and shut down dhcpd. Every functionality I need including adblock I get from dnsmaq on every computer in the net.

----------

## UberLord

resolvconf -l

See which interface is giving the 127.0.0.1 address

----------

## hoyanf

I used dns caching with these setting from wiki :- http://gentoo-wiki.com/TIP_Gentoo%27s_resolv.conf_handling

Edited /etc/conf.d/net with the following so as on reboot it'll stick onto /etc/resolv.conf

```
dns_servers_bond0="127.0.0.1 208.67.222.222 208.67.220.220"
```

It's good thing to add external dns server such as opendns.com as forwarder...

Regards,

hoyanf

----------

## gentoo_ram

I'm looking at the dhcp.conf from the OP.  My dhcp.conf on my home server is slightly different.

Instead of making:

option domain-name-servers 192.168.0.1;

global.  How about making a separate one for each subnet.

Within the 192.168.0.1 subnet declaration:

option domain-name-servers 192.168.0.1;

And within the 192.168.1.0 subnet:

option domain-name-servers 192.168.1.1;

----------

## hoyanf

DNS should work as long as gateway announces the nameservers...

You could do load balancing base on your set-up too...

Regards,

hoyanf

----------

## pmatos

 *UberLord wrote:*   

> Do you have resolvconf-gentoo installed? If so, did you emerge --config resolvconf-gentoo ?

 

doing config just creates a bad link:

```
 # ls -la /etc/resolv.conf

lrwxrwxrwx 1 root root 26 Nov  3 12:38 /etc/resolv.conf -> resolvconf/run/resolv.conf
```

There's no "resolvconf/run/resolv.conf"

so I'm sticking to my hand made link:

```
 ln -s resolvconf/run/interfaces/eth0 resolv.conf
```

----------

