HOSTNAME from DNS name server
Pieter.Donche at ua.ac.be
Mon Jun 29 14:50:43 UTC 2009
> On Mon, 2009-06-29 at 15:22 +0200, Michael Zoet wrote:
>> 1. your DNS Server needs to accept DNS zone updates from your DHCP server
>> 2. your DHCP server must send DNS zone updates to your DNS server
>> 3. (maybe) you need to tweak the file /etc/dhcp3/dhclient.conf
> All this will (may) fix the problem by making the DNS entry for an
> address match the hostname. It doesn't solve the problem of what
> hostname should be set locally, how those names should be set locally,
> or how hostnames get set on multiple machines.
> An alternative might be to set the hostname locally based on information
> already in the DNS.
> 1: For the addresses that will be used, make sure you have reverse
> lookups in your DNS. E.g.:
> $ORIGIN 1.168.192.in-addr.arpa.
> 201 IN A PTR host1.mydomain.
> 202 IN A PTR host2.mydomain.
> 203 IN A PTR host3.mydomain.
$ dig +short -x XXX.YYY.ZZZ.UUU
with XXX.YYY.ZZZ.UUU an IP address in my subnet returns the correct
fully qualified hostname ..
> 2: Use a DHCP exit hook to set the local hostname to the appropriate DNS
> name. The DHCP exit hooks are in /etc/dhcp3/dhclient-exit-hooks.d
> Then every time your address is set with DHCP, the hostname will be set
$ sudo vi /etc/dhcp3/dhclient-exit-hooks.d/debug
and changed RUN to
then rebooted, but there is no file /tmp/dhclient-script.debug written (?)
also a file /etc/dhcp3/dhclient-script does not exist in Ubuntu 9.04 (?)
nor /sbin/dhclient.script. There is a file /etc/dhclient.conf
with a line
If I uncomment this line, should i just make a file
( .MYDOMAIN being e.g. .denim.gim.org )
myname=`dig +short -x new_ip_address`
myhost=`basename $myname .MYDOMAIN`
and these instructions will be executed at every boot??
What must new_ip_address be?
(sorry, couldn't get debug to produce output..)
> Look at the exit hook "debug" to find out what variables you have at
> your disposal - you probably want to use "new_ip_address". You can find
> out the relevant name by doing a reverse lookup of that address:
> myname=`dig +short -x new_ip_address`
> You can reduce the name to just a hostname using basename:
> myhost=`basename $myname .mydomain`
> If your addresses are in several domains you'll have to do something
> more complicated; you need to strip off everything after the first dot
> from the left.
> Then you can set the hostname:
> hostname $myhost
> Remember to set your hostname *after* /etc/resolv.conf has been set up,
> because you need correct nameserver info to do the reverse lookup.
> If you don't want to fiddle with exit hooks, modify the client script
> instead - usually /sbin/dhclient.script or /etc/dhcp3/dhclient-script,
> but settable in dhclient.conf.
> All this is for the ISC DHCP client; other clients should have similar
> Regards, K.
> PS: I've done DHCP hooks, but not to change the hostname, so the above
> is untested for that purpose.
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: application/pgp-signature
> Size: 189 bytes
> Desc: This is a digitally signed message part
> Url : https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090630/7cfb4ec5/attachment.pgp
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
> End of ubuntu-users Digest, Vol 58, Issue 324
More information about the ubuntu-users