LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Updating DHCP with an extra nameserver (http://www.linuxquestions.org/questions/linux-networking-3/updating-dhcp-with-an-extra-nameserver-771242/)

Cybrax 11-24-2009 11:03 AM

Updating DHCP with an extra nameserver
 
Hello Linux Guru's,

Im facing a little problem on my debian box, My ISP connection is with DHCP and receieves its ip and nameserver from my provider, this is all working fine but i also run my own bind for some local names.

Now at first i had added my own machine to /etc/resolv.conf and this worked fine but after a while i found out that the dhcpclient updates this file (obviously) but also removes my custom ns i added.

After searching i came across some information on how to hook scripts using
/etc/dhcp3/dhclient-enter-hooks.d it involved overriding the function

make_resolv_conf(

however when i do this the nameserver from the ISP are no longer updated to my resolv.conf and this is not what i want.

if i use my nameservers alone, i can no longer relove names on the net ofcourse and im not so experienced yet to configure bind dynamicaly to forward to my ISP

Basically what i want is my own nameserver always standard first and appended to that the ns of my ISP.

Maybe someone could point me in the right direction.

Thank you
Cybrax.

toynbee 11-24-2009 11:17 AM

I've had a similar problem in the past. I found this which offers a few different methods for dealing with your problem:
http://forums.debian.net/viewtopic.php?t=7239

Cybrax 11-24-2009 11:54 AM

Quote:

Originally Posted by toynbee (Post 3768038)
I've had a similar problem in the past. I found this which offers a few different methods for dealing with your problem:
http://forums.debian.net/viewtopic.php?t=7239

Thank you, however if you see my post you kind of see that is already how far i got, the problem is however the resolv.conf needs to be updated with my ISP NS because they can change.

So this does not really solve my problem.

However the little line echo "doing nothing to resolv.conf" in the link you posted did bring me to an idea

i could use grep like gettig ip from ifconfig
then write my own NS first then the NS from grep to resolv.conf

however ill have to figure out how i fix that because it seems ifconfig doesnt show ns by defualt

Thank you i guess i manage from here i was on the right way.

Cybrax 11-24-2009 01:06 PM

here is my override function
it works ok but the problem im facing is how do i get the nameservers for my isp without taking it from resolv.conf i tried grep with ifconfig but it does not seems to be specified there

Code:


#!/bin/sh
make_resolv_conf(){
        rm /etc/resolv.conf
        touch /etc/resolv.conf
        echo "127.0.0.1" >> /etc/resolv.conf

        # how to get ns without resolv.conf?
        NS1 = ifconfig eth0 | grep 'nameserver1'
        NS1 = ifconfig eth0 | grep 'nameserver2'
     

        echo $NS1 >> /etc/resolv.conf
        echo $NS2 >> /etc/resolv.conf
}



All times are GMT -5. The time now is 08:36 PM.