Re: hostname comes up as "unknown" with cheap-o cable modem router
From: Ian Fitchet (idf_at_lunanbay.LESS-SPAM.com)
Date: 11/16/03
- Next message: Michael Laajanen: "Re: hostname comes up as "unknown" with cheap-o cable modem router"
- Previous message: Langelage, Frank: "Re: Iplanet"
- In reply to: Logan Shaw: "Re: hostname comes up as "unknown" with cheap-o cable modem router"
- Next in thread: Ian Fitchet: "Re: hostname comes up as "unknown" with cheap-o cable modem router"
- Reply: Ian Fitchet: "Re: hostname comes up as "unknown" with cheap-o cable modem router"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 16 Nov 2003 18:16:49 +0000
Logan Shaw <lshaw-usenet@austin.rr.com> writes:
> Since you asked the correct way, the correct way is to fix the
> DHCP server that is giving you a bogus hostname.
I shall address my complaint to Microsoft regarding their Windows
Server 2003 DHCP Server presently.
I found that the issue is slightly more complicated by Solaris' use
of /sbin/dhcpstrategy which sneaks in when nobody's looking to make
vital executive decisions regarding how your computer will work.
If the DHCP server fails to return a hostname then in
rcS.d/S29network.sh :-
# If DHCP was used on a primary interface then set the hostname
# that was returned. If no hostname was returned, set the name
# to be "unknown". The hostname must be set to something, because
# tooltalk will hang unless the name can be locally resolved.
# Sendmail also requires the name to be resolvable locally.
# Later, in inetsvc, we create a name "unknown" and create a entry
# in the local /etc/inet/hosts file pairing "unknown" with the IP
# address assigned by DHCP.
#
But, if the hostname is unknown then dhcpstrategy sets
_INIT_NET_STRATEGY (in /sbin/rc?) to be "none". If it's set to
"none" then all subsequent tests for DHCP related info fail! Most
obviously, /rc2.d/S72inetsvc fails to do anything with the DHCP info
in its hands. How jolly tiresome, we British might say.
I haven't attempted to decifer the meanderings of the network
initialisation code so my hack was two-fold:
1. put your hostname into /etc/nodename and add
/etc/rcS.d/S99set-hostname
which simply calls "uname -S `cat /etc/nodename`" which means that
the subsequent call to dhcpstrategy in /sbin/rc2 will set
_INIT_NET_STRATEGY to "dhcp"
2. add
/etc/rc2.d/S72inetsvc-reset-hosts
which wants to add an appropriate entry into /etc/hosts so that name
lookups for sendmail and friends works. Something along the lines
of:
set -- `/sbin/netstrategy`
hname=`uname -n`
ipaddr=`netstat -ni -I $2 | awk '$1 !~ /Name/ {print $4}'`
echo "$ipaddr $hname # $0" >> /etc/inet/hosts
Note that the name of this init script is vital -- you must put the
entry in /etc/hosts before any subsequent script tries to use it.
You may also wish to modify the above script to only add the
IP/Host line if it's not already there. I get a new one every reboot
because I'm too lazy!
Given Bryan Cantrell's posting re: dtrace and that this is still true
on b44 (as I've literally just done it and the first thing I did was
read some news!) perhaps our heroes in Mountain View might want to
take a look at how the system sets up the networking in the face of
arguably broken but common enough DHCP servers.
Cheers,
Ian
- Next message: Michael Laajanen: "Re: hostname comes up as "unknown" with cheap-o cable modem router"
- Previous message: Langelage, Frank: "Re: Iplanet"
- In reply to: Logan Shaw: "Re: hostname comes up as "unknown" with cheap-o cable modem router"
- Next in thread: Ian Fitchet: "Re: hostname comes up as "unknown" with cheap-o cable modem router"
- Reply: Ian Fitchet: "Re: hostname comes up as "unknown" with cheap-o cable modem router"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|