Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Apr 2002 09:50:04 -0600
From:      Nate Williams <nate@yogotech.com>
To:        Luigi Rizzo <rizzo@icir.org>
Cc:        Nate Williams <nate@yogotech.com>, arch@FreeBSD.ORG
Subject:   Re: proposed code: automatic setting of hostname from MAC address
Message-ID:  <15539.3500.712066.51894@caddis.yogotech.com>
In-Reply-To: <20020408235226.B57765@iguana.icir.org>
References:  <20020407035941.B37911@iguana.icir.org> <15538.12905.744914.71228@caddis.yogotech.com> <20020408235226.B57765@iguana.icir.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> Nate, probably i did not explain it clearly.

I used the stuff in PicoBSD, so I'm fairly comfortable with it.

> As Garance says, the code i am proposing lets you use the same
> configuration file (/etc/rc.conf) on multiple machines, instead of
> having to customise it for each one.

Right.  It allows you to use the a custom configuration file that will
allow you to configure multiple machines with the same configuration
file, right?

I don't like it because it's non-standard, and uses a completely
non-standard configuration file.

However, I don't have a better solution.  What I did was rip out all of
the code in my PicoBSD builds to use the stock 'rc.conf' stuff, and then
I add a customized rc.conf for each different machine I build (by hand)
that contains that machine's configuration.  However, in my case, each
machine has a slightly different configuration, so I need something more
than a different ifconfig line, so my situation is obviously different
than yours.

(Replacing rc.conf is trivial by doing the copy && gunzip over top of
the MFS version by sticking a compresses copy of the customized rc.conf
on the floppy in a special directory as the examples in the past have
done.)

> The call to auto_set_hostname() in rc.conf will fetch the MAC address
> from the first ethernet card, look it up in a database of
> MAC<->hostname pairs (/etc/ethers, or /etc/hosts), and sets the
> "hostname" and "ifconfig_foo0" shell variables accordingly. From
> there on, rc.conf is absolutely the same as usual.

Unless the box needs a different configuration.  Basically, you're
trying to batch configure the hosts using the exact same configuration
files, but differentiating them by MAC address.  This only works if you
know the MAC addresses ahead of time, and in my case, this can change
when a piece of hardware fails, etc...

> This is not replacing the current scheme -- you can still choose
> to put
>    
>         hostname="foo.bar"
>         ifconfig_ed0="inet 1.2.3.4 netmask 0xffffff00"
>    
> in your rc.conf. But since this is often the only significant
> difference among different rc.conf, having this sorted out
> automatically can be very convenient.

I wish this worked with PicoBSD, but it didn't. :(

>  + in a site that I know, the sysadmin manages a number of
>    FreeBSD boxes, and whenever an OS upgrade needs to be made,
>    he has to push around a number of configuration files. For
>    the most part, they are all the same except for rc.conf
>    (where the difference in most cases is limited to the setting
>    of "hostname" and "ifconfig_foo0", and possibly /etc/fstab.
> 
>  + for things such as PicoBSD images, or "rescue" floppy/CDs,
>    having this code lets you use the same exact media to
>    come up with the correct configuration on different boxes
> 
>  + (a bit less common, though still someone might do this)
>    for some time I used to carry my hard disk in a removable
>    frame and move it between my home and office machine.
>    Again this code would let the OS use the correct configuration in
>    the different places.
> 
> Does it make more sense now ?

Yes, but it's not quite as bullet-proof as you let on, since you still
need to do all the MAC addresses ahead of time.   So, if you replace an
ethernet card, you have to build a new customized floppy anyways.

It works well for fairly static configurations you know about ahead of
time.  However, in those cases, you still need N different floppies, so
it's almost just as easy to create customized rc.conf files for each
floppy.

Just my .02 worth....



nate

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15539.3500.712066.51894>