Re: DHCP and hostname
Would work for the hostname command, I am unsure if you have a MTA
set up, which you would also need to change the hostname in.
do a "grep <yourcurrenthostname> /etc/* | more" to see how many
files it is in. On mine it comes up in: HOSTNAME hostname mailname
hosts and ssh config files [which you can't 'properly' edit, due to
using hostname <newname> doesn't change any of these files. If you
change these, I am unsure of what all daemons you would have to
restart to make it 'stick'.
Here is the last option I can think of:
Don't turn your computer off for longer than the DHCP server's lease
time [don't turn it off ever, get a UPS and be and set a world
record for uptime (I had Win 95 up continually for 4 days once!)].
If you do this, you will continually be re-assigned the same IP
address, and it would be effectively a static-dynamic address,
unless they changed the DHCP Server around (reload?). This would
work because when your IP lease has reached half of its life, the
DHCP client asks the DHCP server to renew its lease with the same
IP. So, as long as it can get the lease renewed consistently before
expiration, you would have that IP address indefinately.
Hope any of this helps,
E. S. Venkatraman wrote:
> Getting a static IP address is not feasible. Also to get the DHCP server
> to return the right hostname might not be feasible.
> Will it be feasible to get the hostname from the DNS once the IP address
> has been assigned (either when I boot the machine up or when the lease for
> the address is renewed) and run the "hostname" command automatically so
> that the correct hostname is in effect? I do it now manually by logging
> in as root (use "ifconfig" to get the IP address and "host" for the name).
> On Fri, 24 Jul 1998, Troy Hanson wrote:
> > The simplest way is to get a static address assigned (outside of the DHCP
> > pool). And have a static DNS entry for that address.
> > The second way is to have the DHCP Administrator add a static-mapping for
> > your ethernet card address, so you always get the same IP (whether your
> > lease expired or not). Also, have a static DNS entry for that reserved lease.
> > As far as your question about asking the DNS for your IP, you can't query
> > a name server until you have an IP address, which puts you in a catch-22
> > situation. In addition, the DHCP server + DNS would need to have dynamic
> > DNS ability (to keep the DHCP addresses associated with the names). WINS
> > does this, but only for NetBIOS/NetBEUI names, not hostnames.
> > In theory, you could get a random IP, find out what name is assoiciated
> > with that IP, and have a script go through every file that contains your
> > hostname, change that hostname, and restart all the affected daemons. :)
> > later,
> > troy
> > At 12:35 PM 7/24/98 -0400, you wrote:
> > >My linux machine is in a network where the IP addresses are assigned
> > >using DHCP. I use "dhcpcd" to get the IP address but it also mangles
> > >my machine's hostname (probably because the DHCP server is not properly
> > >configured). Is there a way to query the DNS server for the correct
> > >hostname from the assigned IP address and assign it? Can this be
> > >automated? Thanks.
> > >
> > >Venkat
> > >
> > >
> > >--
> > >Unsubscribe? mail -s unsubscribe firstname.lastname@example.org <
> > /dev/null
> > >
> Unsubscribe? mail -s unsubscribe email@example.com < /dev/null
Unsubscribe? mail -s unsubscribe firstname.lastname@example.org < /dev/null