vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have a Solaris 2.7 dhcp server. About a month ago, our network guys took our dhcp tables, and entered it into there routers, firewall, something I am not to sure. Now when I have a unix box boot and get a dhcp address it also adds a host name to it, even if the host name is hard coded into the workstation itself. Is there any setting that could be changed on the box that would only pull back an ip address and not the host name? |
| |||
| In article <WsO5b.73510$Rz6.97076@news1.mts.net>, "LHradowy" <laura.hradowy@NOSPAM.mts.ca> writes: |> I have a Solaris 2.7 dhcp server. |> About a month ago, our network guys took our dhcp tables, and entered it |> into there routers, firewall, something I am not to sure. Now when I have a |> unix box boot and get a dhcp address it also adds a host name to it, even if |> the host name is hard coded into the workstation itself. |> |> Is there any setting that could be changed on the box that would only pull |> back an ip address and not the host name? You could put: hostname `cat /etc/nodename` in a file named /etc/init.d/rc2.d/S73hostname |
| |||
| [[ sorry, Laura, replied direct rather than followed up ]] "LHradowy" <laura.hradowy@NOSPAM.mts.ca> writes: > I have a Solaris 2.7 dhcp server. > About a month ago, our network guys took our dhcp tables, and entered it > into there routers, firewall, something I am not to sure. Now when I have a > unix box boot and get a dhcp address it also adds a host name to it, even if > the host name is hard coded into the workstation itself. Curiously, I have the exact opposite in that my MS DHCP server returns everything but the Hostname. Believe you me, not returning a hostname causes untold problems I finally discovered last night. To clarify what information you require from your DHCP server, the Solaris dhcpagent reads /etc/default/dhcpagent. At the bottom of that file is a line indicating which fields you're interested in: PARAM_REQUEST_LIST=1,3,12,43 The numbers are from /etc/dhcp/inittab and you probably want to change yours to exclude Hostname (number 12). However, if you do manage to exclude Hostname from the list of returns from the DHCP server, read on. For those that are interested, if you *don't* get back a hostname from DHCP then rcS.d/*network (near the bottom) sets your hostname to be "unknown". Innocent enough, except that it isn't innocent and the undocumented /sbin/netstrategy makes an awful lot of a hostname of "unknown". Depending on the mood of your box, netstrategy will return "ufs none none" after setting hostname to "unknown". The third field returned by netstrategy is put into the environment by /etc/rc? for the rc scripts to use as _INIT_NET_STRATEGY). If it is set to "dhcp" then /etc/rc2.d/*inetsvc does lots of useful things like set up /etc/hosts and /etc/resolv.conf (and could go on and do good things with /etc/ntp.conf etc etc although it doesn't). If it is set to "none" (as it will be if the hostname was set to "unknown") then it does none of the above. Oh dear. So, simply because the DHCP server didn't return a hostname all the DHCP information (NB IP address/mask/broadcast/default route are handled by dhcpagent directly) is lost. Tsk tsk. You can work round this DHCP client anomaly by adding a simple set-hostname script at the end of the rcS.d scripts. Firstly, put your real hostname into /etc/nodename then add the following script as /etc/init.d/set-hostname then link it into /etc/rcS.d/S99set-hostname: #! /sbin/sh case "$1" in start) uname -S `cat /etc/nodename` ;; esac Calling "uname -S" is enough to have netstrategy come back to the straight and narrow. Note that there is some fiddling required to add a sensible entry into /etc/hosts as /etc/rc2.d/*network will add that "unknown" entry, so have a /etc/rc2.d/S72inetsvc-reset-hosts (putting it right after inetsvc so that later scripts can have the benefit of looking up the IP address of your new hostname -- you can't do it before inetsvc as it has a clause in the code that rewrites any entry with your IP address to its value of hostname ("unknown")): #! /sbin/sh case "$1" in start) set -- `/sbin/netstrategy` hname=`uname -n` ipaddr=`netstat -ni -I $2 | awk '$1 !~ /Name/ {print $4}'` echo "$ipaddr $hname # $0" >> /etc/inet/hosts ;; esac You might argue that it would be easier to fix the MS DHCP server... Cheers, Ian For amusement value, and try this as root (on a machine you don't care about in case it breaks yours :-)) /sbin/netstrategy hname=`uname -n` uname -S unknown /sbin/netstrategy uname -S $hname /sbin/netstrategy Now that I've implemented all my code, mine's stopped doing it but calling /sbin/netstrategy in /etc/rc? should reveal all. |
| ||||
| "Ian Fitchet" <idf@lunanbay.LESS-SPAM.com> wrote in message news:m3he3r7btp.fsf@redhat-9.home.lunanbay.com... > > [[ sorry, Laura, replied direct rather than followed up ]] > > "LHradowy" <laura.hradowy@NOSPAM.mts.ca> writes: > > > I have a Solaris 2.7 dhcp server. > > About a month ago, our network guys took our dhcp tables, and entered it > > into there routers, firewall, something I am not to sure. Now when I have a > > unix box boot and get a dhcp address it also adds a host name to it, even if > > the host name is hard coded into the workstation itself. > > Curiously, I have the exact opposite in that my MS DHCP server > returns everything but the Hostname. Believe you me, not returning a > hostname causes untold problems I finally discovered last night. > > To clarify what information you require from your DHCP server, the > Solaris dhcpagent reads /etc/default/dhcpagent. At the bottom of > that file is a line indicating which fields you're interested in: > > PARAM_REQUEST_LIST=1,3,12,43 > > The numbers are from /etc/dhcp/inittab and you probably want to > change yours to exclude Hostname (number 12). > > However, if you do manage to exclude Hostname from the list of > returns from the DHCP server, read on. > > > For those that are interested, if you *don't* get back a hostname > from DHCP then rcS.d/*network (near the bottom) sets your hostname to > be "unknown". > > Innocent enough, except that it isn't innocent and the undocumented > /sbin/netstrategy makes an awful lot of a hostname of "unknown". > Depending on the mood of your box, netstrategy will return "ufs none > none" after setting hostname to "unknown". > > The third field returned by netstrategy is put into the environment > by /etc/rc? for the rc scripts to use as _INIT_NET_STRATEGY). If it > is set to "dhcp" then /etc/rc2.d/*inetsvc does lots of useful things > like set up /etc/hosts and /etc/resolv.conf (and could go on and do > good things with /etc/ntp.conf etc etc although it doesn't). If it > is set to "none" (as it will be if the hostname was set to "unknown") > then it does none of the above. Oh dear. > > So, simply because the DHCP server didn't return a hostname all the > DHCP information (NB IP address/mask/broadcast/default route are > handled by dhcpagent directly) is lost. Tsk tsk. > > > You can work round this DHCP client anomaly by adding a simple > set-hostname script at the end of the rcS.d scripts. Firstly, put > your real hostname into /etc/nodename then add the following script > as /etc/init.d/set-hostname then link it into > /etc/rcS.d/S99set-hostname: > > #! /sbin/sh > > case "$1" in > start) > uname -S `cat /etc/nodename` > ;; > esac > > Calling "uname -S" is enough to have netstrategy come back to the > straight and narrow. > > Note that there is some fiddling required to add a sensible entry > into /etc/hosts as /etc/rc2.d/*network will add that "unknown" entry, > so have a /etc/rc2.d/S72inetsvc-reset-hosts (putting it right after > inetsvc so that later scripts can have the benefit of looking up the > IP address of your new hostname -- you can't do it before inetsvc as > it has a clause in the code that rewrites any entry with your IP > address to its value of hostname ("unknown")): > > #! /sbin/sh > > case "$1" in > start) > set -- `/sbin/netstrategy` > > hname=`uname -n` > ipaddr=`netstat -ni -I $2 | awk '$1 !~ /Name/ {print $4}'` > > echo "$ipaddr $hname # $0" >> /etc/inet/hosts > ;; > esac > > > You might argue that it would be easier to fix the MS DHCP server... > > Cheers, > > Ian > > For amusement value, and try this as root (on a machine you don't > care about in case it breaks yours :-)) > > /sbin/netstrategy > hname=`uname -n` > uname -S unknown > /sbin/netstrategy > uname -S $hname > /sbin/netstrategy > > Now that I've implemented all my code, mine's stopped doing it but > calling /sbin/netstrategy in /etc/rc? should reveal all. Thank you I will give it a try. Very much appreciated for all the info. Laura |