setting the client hostname

Steve zephod at cfl.rr.com
Wed Feb 18 14:59:12 UTC 2009


---- "Jeremy C. Reed" <Jeremy_Reed at isc.org> wrote: 
> > ---- Steve <zephod at cfl.rr.com> wrote: 
> 
> > > Can someone point me to where dhclient sets the hostname from what is 
> > > received fron the dhcpd server?
> 
> 
> Have a look at the dhclient-script(8) manual page and your installed 
> dhclient-script.
> 

I see in /sbin/dhclient-script in the dhconfig function:

if [ -n "$new_host_name" ] && need_hostname; then
    host_name $new_host_name
fi

and I can see that the script could get called from the script-go() function from dhclient, however when I tried to echo $new_host_name and need_hostname from dhclient_script to a log file, I get no output.

I've been looking at the code some more and it appears to me that the hostname should be passed to the client in the options array of the dhcp_packet struct. Now I need to figure out which option and if it is actually there.

Steve

> 
> > > It appears to be some time after 
> > > dhclient becomes a daemon which causes stdout and stderr to be closed 
> > > and so I don't know how to debug this any further. Perhaps it is 
> > > possible to write to the system log somehow?
> > > 
> > > My problem is that the hostname is set to one of two different values 
> > > every other time the machine is booted. ie
> > > 
> > > boot #1 -> hostname A
> > > boot #2 -> hostname B
> > > boot #3 -> hostname A
> > > boot #4 -> hostname B
> > > etc
> > > 
> > > The hostname is always supposed to be A.
> > > I'm trying to find out whay this is happening.
> > > 
> > > Thanks,
> > > Steve
> > > 
> > > Running dhcp-4.0.0 on Fedora 9.
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users




More information about the dhcp-users mailing list