Subject: Solved: Obtaining a host name
To: None <netbsd-users@netbsd.org>
From: Jan Danielsson <jan.danielsson@gmail.com>
List: netbsd-users
Date: 08/14/2005 21:46:25
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig5F9AC7174E2750246E3036B4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hello all,

Continued from a previous thread..

   The problem was that my hostname was not properly matched with my
dhcp assigned ip. The solution was pretty easy, if I had known more
about networking. :-) For future reference:

$ vi /etc/dhclient-enter-hooks

  if [ "$new_ip_address" != "" ]
  then
    if sed -e
'/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}[[:space:]]*\'$(/bin/hostname)'/s/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/'$new_ip_address'/'
< /etc/hosts > /etc/hosts.new.$$
    then
      /bin/cp /etc/hosts /etc/hosts.old
      mv /etc/hosts.new.$$ /etc/hosts
    else
      rm /etc/hosts.new.$$
    fi
  fi

   This will make sure that my host name is always matched to my current
ip address. Unless there's something I'm missing. Thanks to those who
replied.

-- 
Kind Regards,
Jan Danielsson
Te audire no possum. Musa sapientum fixa est in aure.

--------------enig5F9AC7174E2750246E3036B4
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)

iD8DBQFC/5+W8wBCTJQ8HEIRAqc7AJ9S099cGxSe31mBw1Fcos4MQFeZPQCdFG0P
AuiyRuqJzbxctGA5Yi3quEg=
=tErm
-----END PGP SIGNATURE-----

--------------enig5F9AC7174E2750246E3036B4--