[nzlug] assign host name to computer

Michal Ludvig michal at logix.cz
Mon Mar 5 12:54:49 NZDT 2007


anru chen wrote:
> yes, at  most time you get a fixed IP, but i just want to know is
> there any thing i can do to get a fixed name with dynamic IP.

What hostname are you after?

1) Local system hostname that appears e.g. in bash prompt?

I guess it depends on distribution. For instance in OpenSUSE 10.2 you
have the hostname in /etc/HOSTNAME and in /etc/hosts next to IP
127.0.0.2 (which is not assigned on any interface, I suggest it's a
glibc kludge to get the hostname this way).

2) LAN name?

You'll need a DNS server with dynamic updates enabled and either
a) configure your system to send the hostname from #1 above in the DHCP
request and let the DHCP server update DNS, or
b) let your system update the DNS after every address change (usually
some ifup-script will be used for this).
To be a good network citizen you should update reverse DNS at the same
time as well.

Michal



More information about the NZLUG mailing list