# resolv.conf question | hooking into /etc/init.d/net script

## joeklow

Hi all.

I have multiple network interfaces and a ton of mess around them including load balancing etc.

When interface X goes down via /etc/init.d/netX stop, it automatically removes all entries from resolv.conf, including those I added manually.

When DHCP starts for netX, it does the same (unfortunately netX has to get dynamic DNS via DHCP, so can't just add static route via dns_servers_netX).

Where and when does /etc/init.d/network changes /etc/resolv.conf? I need to put my own hook there, since it is also planned to use hacked udhcp(d) instead of dhcpd to keep interface IPs somewhere in /var/dhcp/$interface_ip_config. (by the way, where's initscripts dhcp module is stored? - need to modify it too)

Or, how to enable this functionality of resolvconf(5)?

NAME

     resolvconf — a framework for managing multiple DNS configurations

SYNOPSIS

     resolvconf -I

     resolvconf [-m metric] [-p] -a interface <file

     resolvconf [-f] -d interface

     resolvconf -il pattern

     resolvconf -u

 *Quote:*   

> 
> 
>      resolvconf solves this by letting the daemon send their resolv.conf(5) file to resolvconf via stdin(3) with the argument -a
> 
>      interface instead of the filesystem.  resolvconf then updates /etc/resolv.conf as it thinks best.  When a local resolver
> ...

 

I need multiple resolv.conf's for all interfaces of /etc/conf.d/net..

----------

## Raptor85

add your entries into /etc/resolv.conf.head instead.

----------

## djinnZ

or better you can configure udev for mirror the NICs as different devices (only if you have multiple network to connect, as in a laptop) and use the ifup_*/ifdown_* function in /etc/conf.d/net.* (where * is the network interface) to set up resolv.conf and/or resolv.conf.head.

----------

