Koozali.org: home of the SME Server

DHCP/DNS

Scott Smith

DHCP/DNS
« on: August 30, 2001, 05:22:07 PM »
I have an e-smith 4.1.2 server at home:

     system name (TCP/IP) = e-smith
     domain name (TCP/IP) = smith.local
     windows server name (SMB) = e-smith
     windows workgroup (SMB) = smith
     domain master (SMB) = yes

There are 6 Win98 workstations attached. In the client for ms networks options, logon to window domain is disabled, and logon and restore connections is selected. In the network properties, identification tab, each workstation uses the person's name for identification:

     computer name = {dad, mom, trevor, etc.}
     workgroup = smith

In the TCP/IP configuration for the workstations:

     IP address = automatic
     WINS = disabled
     gateway = blank
     DNS = disabled

That's the configuration. Here's the problem/question:

From any workstation 'ping computer_name' works. So, for example:

     ping dad

will find the 'dad' system. However, from e-smith this does not work -- 'ping dad' returns the message:

     ping: unknown host dad

If I use the DHCP name of 'pc-00060.smith.local' with ping, then the workstation is reached just fine.

From the bit of research I've done, this is because 1) Windows is faking it and using Windows networking to fetch the address of 'dad' for ping run at the workstation, and 2) DHCP and DNS are not that well integrated on Linux so even though DHCP knows the hostname of the client, DNS does not.

On the Windows side, what if anything would be gained by having the workstations logon to the windows domain? As I understand it, that would have them logging into the e-smith server, right? Should I enable using DHCP for WINS resolution? Should I enable DNS and specify the host (system) name to match the computer name from the identification tab?

On the e-smith side, if I examine the /var/lib/dhcp/dhcpd.leases file, I can clearly see the 'client-hostname' entry for each workstation. Is it possible to have DHCP and DNS talk to each other and add this name to DNS?

What's driving this is that I have a program that I would like to run on e-smith, that will communicate with an application running on each workstation. I would prefer to address the workstations by their given name, rather than by having to use the DHCP-ized name, which would be no better than trying to use the IP address. (I realize that the chances are each system will always get the same IP, but I'd like to be proper about it.)

If there is no integration of this type, then is there a command that shows the currently active DHCP leases? The dhcpd.leases file appears to carry over entries that may not be in use, so there may be multiple entries for 'dad'. It appears that IP addresses for each entry in the file are unique, but client-hostnames are not.

I'd like to be able to find just the DHCP leases that are active. I can write a script to query the dhcpd.leases file, ping each address, output the names of active responders, etc, but there may a proggy out there that already does this that I just haven't found yet. I can do my own 'DHCP/DNS' resolution by querying the leases file for the client-hostname and finding the IP from there, but that is the avenue of last resort. And it would be better if I could cull the name from the list of actives.

Lots of info, so many thanks to those patient enough to wade through it.

Scott

Charlie Brady

Re: DHCP/DNS
« Reply #1 on: August 31, 2001, 05:19:08 AM »
Scott Smith wrote:

> What's driving this is that I have a program that I would
> like to run on e-smith, that will communicate with an
> application running on each workstation. I would prefer to
> address the workstations by their given name, rather than by
> having to use the DHCP-ized name, which would be no better
> than trying to use the IP address. (I realize that the
> chances are each system will always get the same IP, but I'd
> like to be proper about it.)

What you want is the hostnames and addresses panel. Tie a DNS name and IP address to each PC (via the MAC address of its NIC), and Bob's your uncle.

Regards

Charlie

Scott Smith

Re: DHCP/DNS
« Reply #2 on: August 31, 2001, 05:41:30 AM »
Charlie Brady wrote:
>
> What you want is the hostnames and addresses panel. Tie a DNS
> name and IP address to each PC (via the MAC address of its
> NIC), and Bob's your uncle.

I hadn't thought of that. Yes, that will work for the limited number of systems I have. Until I have to change a NIC or replace a system ;-)

I'll give it a whirl tonight and see how it does.

It would, though, be nice if DHCP and DNS could be tied together to handle this in a more automagic fashion. Probably asking for the moon, but you never know until you ask! Judging from the uunet postings, though, this is a common and long-standing issue.

Scott

Jochen Hoegerl

Re: DHCP/DNS
« Reply #3 on: August 31, 2001, 09:14:58 PM »
Scott Smith wrote:
>

> DHCP and DNS are not that well integrated on Linux so even
> though DHCP knows the hostname of the client, DNS does not.
>
> Scott

Well to be honest ( I'm a Admin of a native WinNT net with about 400 Clients )
if you have DNS and DHCP but NO WINS, Windows won't make it either ;-))

But for just 6WS why not giving them static IP's and make the neccecary
entries for DNS and Gateway and diable dhcp on your e-smith server.
Add the WS to your "Hostnames" without MAC-Address and you can also
change the NIC without a hassle, on the other hand it's just one entry
to change if a card fails


jochen

Scott Smith

Re: DHCP/DNS
« Reply #4 on: August 31, 2001, 09:36:02 PM »
Jochen Hoegerl wrote:

> But for just 6WS why not giving them static IP's and make the
> neccecary entries for DNS and Gateway and diable dhcp on
> your e-smith server. Add the WS to your "Hostnames" without
> MAC-Address and you can also change the NIC without a hassle,
> on the other hand it's just one entry to change if a card fails

Because it is only 6 systems now, in other cases it will be far more. I realize I could solve this particular network's issues via manual configuration. But I shouldn't have to, and I wouldn't want to if it were 60 instead of 6.

It less of an issue of "how can I solve this one instance", but rather "how can we make e-smith do this automatically". That is, after all, one of the hallmarks of e-smith -- simple configuration, automatic if possible. To have to manually configure the network, when all the bits exist in the DHCP info, seems a shame.

Scott

Scott Smith

Re: DHCP/DNS
« Reply #5 on: August 31, 2001, 09:40:21 PM »
> Charlie Brady wrote:
> >
> > What you want is the hostnames and addresses panel. Tie a DNS
> > name and IP address to each PC (via the MAC address of its
> > NIC), and Bob's your uncle.
>
> Scott Smith wrote:
>
> I hadn't thought of that. Yes, that will work for the limited
> number of systems I have. Until I have to change a NIC or
> replace a system ;-)
>
> I'll give it a whirl tonight and see how it does.

It works as advertised, Charlie. And the maitenance is not bad on a small network -- DHCP still supplies all other network info to the workstation -- but I wouldn't want to do it on a larger system.

Too bad this can't be linked into DHCP somehow. The client-hostname field is there with the pertinent information. Seems like this would have been addressed through the DHCP and DNS services.

Scott

Charlie Brady

Re: DHCP/DNS
« Reply #6 on: September 01, 2001, 09:06:37 AM »
Scott Smith wrote:

> Too bad this can't be linked into DHCP somehow. The
> client-hostname field is there with the pertinent
> information. Seems like this would have been addressed
> through the DHCP and DNS services.

Talk to Microsoft, my friend. They invented the extra name set - the windows networking names.

The fundamental problem is that you are mixing two different naming and name allocation schemes. DHCP and DNS, when all IP allocation is done by the server, and name resolution of IP addresses to names is done by the server, but, on the other hand, netbios networking, where the client says "my name is xxx".

Yes, it is possible to insert the names that are claimed by the client (netbios/WINS) into the naming system system which is administered by the server (DNS), but I don't know that the hooks to do this are available in the "free world" yet. It is on the TODO list, but hasn't percolated to the top of the pile yet.

Regards

Charlie

Jochen Hoegerl

Re: DHCP/DNS
« Reply #7 on: September 01, 2001, 10:29:53 AM »
I did a search with google and found this:

   http://jpsdomain.org/linux/linux.html

go to the DHCP & DDNS section

it is about integrating hostnames in dns

might also be interesting for MITEL for SME 5.x :-))


jochen

Scott Smith

Re: DHCP/DNS
« Reply #8 on: September 04, 2001, 06:55:52 PM »
Charlie Brady wrote:
>
> Talk to Microsoft, my friend. They invented the extra name
> set - the windows networking names.

True, but here's a twist for you. Windows also provides for specifying the DNS host and domain names, but this also has no effect. And, even if you don't set the DNS names, the Windows (netbios) system name is passed in the DHCP request as the client-hostname. Again, the problem here is that DNS on e-smith is simply not aware of the hostname assigned at the workstation.

> The fundamental problem is that you are mixing two different
> naming and name allocation schemes. DHCP and DNS, when all IP
> allocation is done by the server, and name resolution of IP
> addresses to names is done by the server, but, on the other
> hand, netbios networking, where the client says "my name is
> xxx".

True, but see the above. One way or the other, either via netbios alone or with the dns options set on the client, the client-hostname is being passed in the DHCP request, but the e-smith DNS is unaware of that name. So the issue appears to be more of the level of integration between DHCP and DNS on Linux, rather than anything specific to Windows itself. I don't have an extra box at the moment, but I'm wondering if the end result would be any different if it were another Linux system in the DHCP client role. Judging from the newsgroups postings on the subject, I think not.

> Yes, it is possible to insert the names that are claimed by
> the client (netbios/WINS) into the naming system system which
> is administered by the server (DNS), but I don't know that
> the hooks to do this are available in the "free world" yet.
> It is on the TODO list, but hasn't percolated to the top of
> the pile yet.

Yes, I've found a couple of scripts that are directed at this problem. It seems that DHCP and DNS have a long history of not playing well together :-( BTW, from the newgroup traffic it sounds like the current version of BIND and the current DHCP from ISC solve this problem and provide the expected integration. I didn't find anything to indicate if the same is true of djbdns (although I did find one script author that refuses to support BIND any more and works exclusively with djbdns.)

Bottom line -- the DHCP and DNS shipped with e-smith through 4.1.2 do not provide the desired integration "as is". It is, however, possible to add this functionality, but it appears to be very specific to the versions of BIND and DHCP used. I'll continue to investigate and see what I can come up with.

In the meantime, the best work-around appears to be defining the hostname, IP address, and MAC address in the hostnames and addresses panel. (It would be a nice touch if the IP address in this panel were optional if the MAC address is specified, as it seems DHCP can be configured to dynamically allocate the IP address while still associating the hostname with the specified MAC address and therefore the correct IP address. A future enhancement, perhaps.)

Scott

Sean Peacock

Re: DHCP/DNS
« Reply #9 on: September 06, 2001, 08:35:33 PM »
I've been doing some work on the integration. dhcp 3.0 will integrate with bind 8.x and provide dynamic updates to DNS. I've got it working at work. My attempt is to do it with dhcp 2.0 which is what is being shipped on e-smith. I was able to modify e-smith to the point of being ready for the script listed below. However the script does not appear to correctly work on e-smith and I'm reaching the limit on the amount of time I can spend on this. If someone would like to finish this I'm including my work to date.

download file from
http://www.heronforge.net/~stephen/DHCP-DNS/dhcp-dns.html
to /root with lynx if you wish

extract files with tar -zxf dhcp-dns.0.70.tar.gz
mv DHCP-DNS.0.70 DHCP-DNS

Change files:
/root/DHCP-DNS/ddns.cron.pl

my $DHCPD="/var/lib/dhcp/dhcpd.leases";
my $DOMAIN="speacock.com";

/root/DHCP-DNS/ndc.cron.pl

my $DDNSHOME="/root/DHCP-DNS";

mkdir -p /etc/e-smith/templates-custom/etc/named.conf/

cp /etc/e-smith/templates/etc/named.conf/40localptrs /etc/e-smith/templates-custom/etc/named.conf/

change to match the following:

zone "{ esmith::util::computeLocalNetworkReversed ($LocalIP, $LocalNetmask) }" \
{
        type master;
        allow-update \{127.0.0.1;\};
        file "named.localnetwork";
\};

cp /etc/e-smith/templates/etc/named.conf/60domains /etc/e-smith/templates-custom/etc/named.conf/

change to match the following:

zone "$domain"
{
    type master;
    file "db.$domain";
    allow-update {127.0.0.1;};
};

mkdir -p /etc/e-smith/templates-custom/var/named/named.localnetwork/
cp /etc/e-smith/templates/var/named/named.localnetwork/50localaddresses /etc/e-smith/templates-custom/var/named/named.localnetwork/

edit 50localaddresses and delete the following lines

    for ($i = 1; $i <= $maxHostid; $i++)
    {
        my $ip = esmith::util::IPaddrToBackwardQuad ($networkBits | $i);
       my $hostname = sprintf ("pc-%.5d", $i);
   
       $ip2name{$ip} = $hostname;
    }

which create the pc-0001, etc. reverse DNS entries


mkdir /etc/e-smith/templates-custom/var/named/named.primarydomain
cp /etc/e-smith/templates/var/named/named.primarydomain/50localnames /etc/e-smith/templates-custom/var/named/named.primarydomain

edit 50localnames and delete the following lines

    for ($i = 1; $i <= $maxHostid; $i++)
    {
        my $ip = esmith::util::IPaddrToQuad ($networkBits | $i);
        my $hostname = sprintf ("pc-%.5d", $i);
   
        $name2ip{$hostname} = $ip;
    }

which create the pc-0001, etc. forward DNS entries

Do Not run:

/sbin/e-smith/expand-template /etc/named.conf

named.conf is not in /etc it is chrooted to /home/dns/etc

expand-template will place it in /etc and it will not work.

Instead go into e-smith web manager Collabaration/Virtual Domains and create a virtual domain.
This will trigger the proper creation of the named.conf file.

Sean