Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
using dhcp with bind to resolve hostnames within you LAN
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
ocbMaurice
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2003
Posts: 90
Location: Switzerland

PostPosted: Sun Feb 23, 2003 10:15 pm    Post subject: using dhcp with bind to resolve hostnames within you LAN Reply with quote

Hi,

Basically this evolved from a problem which I had with gentoo. I have my name- and dhcp-server working together to be able to resolve my hosts via the nameserver. Sadly, the gentoo network scripts (net.ethx) do not really support this setup as they do not take use of the hostname for dhcp. So far, every other linux distribution seems implement the hostname-feature for dhcp.

First thing is a nameserver; for completeness, I give you a short overview of my /etc/named.conf :

Code:
key "DHCP_UPDATER" {
        algorithm       hmac-md5;
        secret          "a421afe49cdub3VnaCBmb3IgYSBtYu324212355234234m9yIGEgd29tYW4K";
};

zone "0.168.192.in-addr.arpa" IN {
        type master;
        file "myzone.net.arpa";
        allow-update { key "DHCP_UPDATER"; };
        allow-transfer { none; };
};

zone "myzone.net" {
        type master;
        file "myzone.net.zone";
        allow-update { key "DHCP_UPDATER"; };
        allow-transfer { none; };
};


The corresponding dhcpd.conf looks the fallowing :

Code:
ddns-update-style interim;

key "DHCP_UPDATER" {
        algorithm       hmac-md5;
        secret          "a421afe49cdub3VnaCBmb3IgYSBtYu324212355234234m9yIGEgd29tYW4K";
};

....

option domain-name "myzone.net";
option domain-name-servers 192.168.0.109;
option nis-domain "myzone.net";

default-lease-time 600;
max-lease-time 7200;

range 192.168.0.50 192.168.0.99;
zone myzone.net {
         primary 192.168.0.109;
         key DHCP_UPDATER;
}
zone 0.168.192.in-addr.arpa. {
         primary 192.168.0.109;
         key DHCP_UPDATER;
}


With this setup, every host that aquires an IP from your DHCP server should be inserted into your local nameserver (both, nameserver and dhcp-server run on the same machine). For this to happen, the dhcp-server needs to know the hostname and as it seems, this only is submited when you give the hostname as an argument to dhcpcd (-h hostname). Therefore I adjusted "/etc/init.d/net.eth0". In my case this was line 26 and it should look like this :

Code:
local dhcp_args="$(eval echo \$\{dhcpcd_${IFACE}\}) -h $(eval hostname)"


If everything works correctly you now can resolve all hosts that aquired their IPs trough the dhcp-server. It's highly suggested that you take use of the dhcp 'option domain-name "myzone.net";'.

I'm quite new to gentoo and didn't find a "feature request" place. Maybe this could be included in future releases !?

greets, Maurice
Back to top
View user's profile Send private message
tkdack
n00b
n00b


Joined: 12 Apr 2002
Posts: 44
Location: Sydney, Australia

PostPosted: Sun Feb 23, 2003 10:22 pm    Post subject: Reply with quote

Quote:
For this to happen, the dhcp-server needs to know the hostname and as it seems, this only is submited when you give the hostname as an argument to dhcpcd (-h hostname).


You might try adding something similar to /etc/conf.d/net. There is an environment variable in there that you can set to pass extra options to dhcpcd. This means you don't have to hack your net.eth0 startup script.
_________________
Troy
http://linux.tkdack.com

Former Gentoo contributor TaD
Back to top
View user's profile Send private message
BonezTheGoon
Bodhisattva
Bodhisattva


Joined: 14 Jun 2002
Posts: 1408
Location: Albuquerque, NM -- birthplace of Microsoft and Gentoo

PostPosted: Wed Feb 26, 2003 5:38 pm    Post subject: Re: using dhcp with bind to resolve hostnames within you LAN Reply with quote

ocbMaurice wrote:
I'm quite new to gentoo and didn't find a "feature request" place. Maybe this could be included in future releases !?


File a bug report if you would like to have this added into future releases.

Regards,
BonezTheGoon
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum