Re: Setting hostname with DHCP
Dear List and Vineet,
I began:
> > I have scoured the web and even read the generally helpful
> > Chapter 10 - Network Configuration from Debian Reference
> > http://www.debian.org/doc/manuals/reference/ch-gateway.en.html,
> > but I cannot figure out how to set hostname and domain using
> > dhcp.
Vineet wrote (full comment below):
> ....my dhcp client tells the dhcp server that its hostname
> is "wingnut", instead of somehow asking the dhcp server
> for a hostname. This way, if the dhcp server is set up to
> do so, I get a dns record set up for wingnut. Unless the
> dhcp server is configured to assign certain addresses to
> certain hostnames and it doesn't know anything about
> wingnut this works just fine. This way my hostname is
> always wingnut; it doesn't change depending on the whims
> of a particular site's (potentially whack) dhcp server.
Thank you, Vineet, for the response. I do indeed want the
opposite of the behavior that you have, i.e., I want the
dhcp server to send my computer the hostname. I also want
like to have domain set properly by dhclient.
The main reason is that I frequently ssh or scp to the
machine and it's easiest if I can see the hostname in front
of me. The server won't let me choose hostname via "send
host-name" and I am happy to live with the assigned names,
which are reasonable on my campus, e.g.,
buildingname-arbitrarynumber.dhcp.myschool.edu But once this
is the assigned name, I would prefer to have it everywhere
on the computer, i.e., in /etc/hostname, as the response to
"hostname --fqdn", etc., etc.
Also I cannot get dhclient to set the domain.
The other response from the list was:
> The dhclient script is broken; it doesn't do the hostname
> properly. It is probably fixable, but that script is a
> big mess.
Thanks--it is good to know that I am not alone with this
problem. I fiddled around with dhclient-exit-hooks, which I
could get to run when I ran dhclient from the command line
but not on bootup.
I guess I consider this whole thing a pretty serious problem
(the domain setting more important than the hostname, which
I can live with). I want my computer to know its domain.
Is there a fix?
Should I move to a different DHCP-client program?
Can you recommend one? Is there a program called "pump"?
Best,
M.A.
P.S. Not to generate invidious comparison, but on one of my
other Linux boxes, made by some company in the Carolinas, I
plug the box into the campus network, flip on the computer,
walk away, and return to find it with hostname, domain name,
etc.
Vineet's full comment:
> I can't quite wrap my head around why you'd want to do this; do you
> expect your hostname to be changing all the time? Is this what you
> want? Is there a requirement for the campus network that you use a
> hostname assigned by them? If you use a different dhcp hostname, will
> you not get an address?
>
> The way my laptop is set up is pretty much the opposite of what you're
> asking to do: I set my own hostname the regular way, and I also added a
> line to me /etc/dhclient.conf:
>
> send host-name "wingnut";
>
> This way, my dhcp client tells the dhcp server that its hostname is
> wingnut, instead of somehow asking the dhcp server for a hostname. This
> way, if the dhcp server is set up to do so, I get a dns record set up
> for wingnut. Unless the dhcp server is configured to assign certain
> addresses to certain hostnames and it doesn't know anything about
> wingnut this works just fine. This way my hostname is always wingnut;
> it doesn't change depending on the whims of a particular site's
> (potentially whack) dhcp server.
Reply to: