an attempt at documentation of my ongoing struggles with solaris and opensolaris on x86. I believe strongly in the (public) documentation of trials, struggles and failures, even more so than in the documentation of success: With a long standing commitment to solaris, looking for answers and just finding "I tried it on distibution 'X' and it worked for me" is not very informative.

Sunday, June 11, 2006

Act one: No.1 Duetto "Bashing the SMF scripts for sake of a sane DHCP client config"

So I've been able to pick up a DHCP address from my ISP. I've resolved the client name issue. Big deal. But now, every time I log in, be it via X or via shell, I am told the hostname is the same as whatever my external interface has. Counterintuitive I would say: Wasn't the whole purpose of /etc/nodename to overcome this? (at least, this is the way it works if you configure interfaces statically!)

So I decided to start digging in the SMF framework to work around this. (I'll regret this when I start patching or upgrading again is my guess)

It was pretty easy to dig up the files related to the SMF framework:
  • the XML files are in /var/svc/manifest//....
  • the methods defined in the XMLs are located in /lib/svc/method.
A "fgrep -l '/etc/nodename' /lib/svc/method/* | xargs less" revealed that the hostname is set to the contents of /etc/nodename in two locations:

at the end of /lib/svc/method/identity-node:
# If the netstrategy was unsuccessful and we haven't got a locally configured
# name, default to "unknown"
#
if [ -z "$hostname" ]; then
hostname="`shcat /etc/nodename 2>/dev/null`"
if [ -z "$hostname" ]; then
hostname="unknown"
fi
fi
And then there's a similar snippet in /lib/svc/method/net-physical:
#In order to avoid bringing up the interfaces that have
# intentionally been left down, perform RARP only if the system
# has no configured hostname in /etc/nodename
hostname="`shcat /etc/nodename 2>/dev/null`"


I went for the easy way out. I modified both scripts to read the entry from a new file /etc/machine, containing the machinename.

Rebooted, and voila. Logging in showed the hostname I wanted all along for this machine.

routing table looks a clean as well:
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
192.168.200.0 dc-utr01-int U 1 495 hme1
XX.XXX.XXX.0 dc-utr01-ext U 1 999 hme2
BASE-ADDRESS.MCAST.NET dc-utr01-ext U 1 0 hme2



Saturday, June 10, 2006

Act one: recitative "my server as a DHCP client"

the manuals say it's so easy. all you have to do is the following:

# touch /etc/hostname.hme2
# touch /etc/dhcp.hme2

reboot and you're done.
Which I did.

And cursed.

And cursed again.

I always forget that solaris doesn't stick to it's own hostname when it has DHCP configured addresses. And since windows clients do, no ISP in their right mind provides a hostname over DHCP. Endresult: the hostname is set to "unknown".

So: my initial attempt was to put the hostname in /etc/nodename.
In my opinion, an IP-address is tied to an interface. When naming them, I prefer to have some logical description as their name. in this case: the ip-address on hme2 should be associated with "dc-utr01-ext" which is short for "the external (ISP facing) interface in my datacenter in Utrecht, location #1"
A bit over the top for just a single box, but hey. think big.
following the same logic, I assigned hme2 a static address and name: "dc-utr01-int". This makes for easy interpretation of lots of network stuff like network snoops, dhcp server, firewall rules etc etc

So I did:

# echo "dc-utr01-ext" > /etc/nodename
and rebooted.

Only to find out that when I log in, the hostname has changed to this as well!
e.g.:
# uname -a
SunOS dc-utr01-ext 5.10 Generic_118822-30 sun4u sparc SUNW,Ultra-2

that doesn't make sense at all! It's ugly!

At this point I left it for what it was and went for some sleep.

Ouverture "copperjet anger"

For about 6 months now, I've been running solaris 10 at home as my primary server. I've got a bundle of all SUN/sparc branded hardware from the stone ages, which I try to utilize as much as possible, and ever since I threw my ISP provided Copper Jet 816-2p against the wall and swore never ever again to use it as something more than just a dumb modem (yes I know, it *can* be setup as a router, I've done that and cursed it every time it hung for some unknown reason) I've been struggling to set my Ultra 2 up as a proper replacement.

It was about time however that I started documenting my struggles as I think I've come a long way since I started out configuring and my guess is I'll never be able to reconfigure it like that again. (my OS grows organically).

As an overview, I think a diagram is always useful, but since I loathe diagram drawing software (or any graphics stuff for that matter), I put my white board & brand new camerato good use:

[ note: I got it wrong here: hme2 is attached to the copperjet. and hme1 is connected to the hub ]

Yup. I know. handwriting and drawing is not my thing either (this explains as well my craze for anything with a keyboard attached). For the record: the copperjet is attached to the hme1 and a very old 3Com superstackII 24 port hub is attached to hme2.

the cursed copperjet
The copperjet comes factory configured with an ip-address of 172.19.3.1/16 but for now, that's not really relevant since it's in bridging mode.

superstack hub
I can't exactly say why, but the superstack hub and I have had a loving relationship ever since I found and bought it at a flea market for about 5 euros. There's simply something magical about being able to observe and manage your network. It's not really fancy, since managing is limited to switching ports off and on, but a mighty fine set of ethernet statistics is gathered round the clock. Simply wonderful despite all it's shortcomings (i.e. 10 MBit, half duplex, and not being a switch). A long time ago, when I was still running a 10.0.0.0/8 network at home, I assigned it an address of 10.0.1.3/8 which I'll leave like that for now.

The clients
Talk about overkill: I've got two clients semi-permanent clients in my network! one is my primary interface to the net: my faithul iBook G4, the other one is my upstairs neighbour. The flat above me is apparently some kind of company owned flat where they put up all their international trainees. So every six months or so, a new trainee from (usually) France settles in. It's not that I mind helping them get around in the Netherlands, but we tend to go through the same cycles... "Can you help me set up my internet?" etc etc. I even ended up in assisting them to talk to some of the ADSL and cable-internet providers... Every six months or so, for about two years. So I decided to make life easy for myself and just connect her onto my pretty fat ADSL wire.

The server
my faithful Ultra 2! what a beauty she is! Such stability! So much perseverance when faced with adversity! We go a long way back, my Ultra 2 and me... I got her about 3 years ago, when I traded my Ultra 10 for her. I've lovingly upgraded her since, with 2x 18GB disks, a HVD scsi card, a SE scsi card, a quad ethernet card, additional external disks, and finally: 2x400MHz ultra sparc II procs which enabled me to run solaris 10, without dirty hacks to get it running.
The latest addition is a 7 slot DLT4000 autoloader, which I intend to use for the incidental backup.