SUMMARY: Changing from static IP to DHCP (Solaris 2.6)

From: Gene Matthews <gene_at_mmc-inc.com>
Date: Fri Apr 26 2002 - 10:53:16 EDT
The suggestions for setting the hostname were to add a startup script to set it, which is what i did. 
I tried to see if DHCP was giving me back one via 'dhcpinfo Hostname, but that
didn't return anything.

I created the following in /etc/init.d/set_dhcp_hostname:

HOSTNAME=`cat /etc/nodename`

if [ -f /etc/dhcp.hme0 ]; then
        echo "Setting hostname to $HOSTNAME...  \c"
        uname -S $HOSTNAME
        echo "Done.";
fi

I wrapped it in the 'if' in case I forget about this script when/if I change
back to a static ip. I guess, however, as long at it is using /etc/nodename
to get the hostname from, it wouldn't matter if I forgot about it.

I then created a symbolic link in /etc/rc2.d:

ln -s /etc/init.d/set_dhcp_hostname /etc/rc2.d/S70set_dhcp_hostname


After another reboot, it all came up fine.

There was one suggestion to put the following in /etc/init.d/network:


>if you have a look into /etc/init.d/network:
>
>case "$_INIT_NET_STRATEGY" in
>        "dhcp") hostname=`/sbin/dhcpinfo Hostname` ;;
>        "rarp") hostname=`/sbin/hostconfig -h -p bootparams`
>                trap 'intr=1' 2 3
>                while [ -z "$hostname" -a ! -f /etc/.UNCONFIGURED -a \
>                    -z "$intr" ]; do
>                        echo "re-trying host configuration..."
>                        # Restrict this to IPv4 interfaces.
>                        /sbin/ifconfig -adD4 auto-revarp up 2>&1 >/dev/null
>                        hostname=`/sbin/hostconfig -h -p bootparams 2>&1 \
>                            >/dev/null`
>                done
>                trap 2 3 ;;
>        "none") hostname="`shcat /etc/nodename 2>/dev/null`" ;;
>esac>
>
>
>/sbin/uname -S $hostname
>echo "Hostname: `/sbin/uname -n`" >&2
>

>----------------------------------------------------------------------------
>your hostname comes from dhcp (check if you can get it from your DHCP
>server)
>if it does not work, you can hardcode your hostname to set according to your
>nodename file: 
>hostname="`shcat /etc/nodename 2>/dev/null`"
>befor it calles the uname command.

I decided to leave the network script alone, although by doing it this way
it would get rid of the "Hostname: unknown" message at startup.

Thanks to all for the suggestions and help!

gene


======================
Most suggestions were to touch /etc/dhcp.hme0.  Some also suggested to run 
sys-unconfig and select DHCP.  



I tried the sys-unconfig, but I guess 2.6 doesn't give you the DHCP option.
I have touched the /etc/dhcp.hme0 file and that seemed to do the trick.  When 
I reboot, it comes up with hme0 getting its IP from DHCP and the default
route is added ok too.  

The problem I'm trying to overcome now is that the hostname is not getting set.
I'm not sure of the config of the DHCP server as I don't control it.  I don't
think it is setting the hostname as I have a linux laptop that i use on this
network that gets its IP via dhcp and i set the hostname and it uses that.

I have /etc/nodename with the hostname in it and as best as I can tell, 
/etc/init.d/rootusr looks like it will attempt to set it using this file,
but it still comes up with hostname as 'unknown'.

Anyone have any thoughts on how to set the hostname?

Thanks,

Gene


============================
Original post below:
============================

I'm having some difficulty changing an Ultra 10 running Solaris 2.6 from
a static IP to DHCP.

I'm sure there is a config file somewhere I'm not changing. 

What I have now is the system coming up with hme0 set to 0.0.0.0

/etc/hostname.hme0 is blank (i used to have the hostname in it)

Once the system is up, i can login in via the console and do:

ifconfig hme0 dhcp

and get an ip and all is well.  What config file (and how) do I modify
so that this occurs automagically upon system startup.

Thanks,

Gene
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Fri Apr 26 12:00:42 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:41 EST